5089 lines
254 KiB
C#
5089 lines
254 KiB
C#
using LoggingHelper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using GODATA.RoleServices;
|
|
using GODATA.AuthenticationServices;
|
|
using RestSharp;
|
|
using Newtonsoft.Json;
|
|
using Kendo.Mvc.UI;
|
|
using Kendo.Mvc.Extensions;
|
|
using GODATA.Models.Ticket;
|
|
using GODATA.Models.Report;
|
|
using GODATA.Models.FilterKendoGrid;
|
|
using ExcelHelper;
|
|
using ExportToExcel;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.IO;
|
|
using GODATA.Models;
|
|
using System.Reflection;
|
|
using GODATA.Models.UserInventory;
|
|
using GODATA.Models.Tracking;
|
|
|
|
|
|
namespace GODATA.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Class which contains all the methods to convert a Model List to Datatable.
|
|
/// </summary>
|
|
public static class ListToDatatableHelper
|
|
{
|
|
/// <summary>
|
|
/// Converts a list to data-table
|
|
/// </summary>
|
|
/// <typeparam name="TSource">type of list</typeparam>
|
|
/// <param name="data">list</param>
|
|
/// <returns>data-table</returns>
|
|
public static DataTable ToDataTable<TSource>(this IList<TSource> data)
|
|
{
|
|
DataTable dataTable = new DataTable(typeof(TSource).Name);
|
|
PropertyInfo[] props = typeof(TSource).GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
|
foreach (PropertyInfo prop in props)
|
|
{
|
|
dataTable.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ??
|
|
prop.PropertyType);
|
|
}
|
|
|
|
foreach (TSource item in data)
|
|
{
|
|
var values = new object[props.Length];
|
|
for (int i = 0; i < props.Length; i++)
|
|
{
|
|
values[i] = props[i].GetValue(item, null);
|
|
}
|
|
dataTable.Rows.Add(values);
|
|
}
|
|
return dataTable;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Contains all the methods to show and export reports
|
|
/// </summary>
|
|
[GODATA.MvcApplication.SessionExpire]
|
|
public class ReportController : Controller
|
|
{
|
|
|
|
#region Global Variables
|
|
|
|
/// <summary>
|
|
/// Global variable for Ticket administration CCE portal repository.
|
|
/// </summary>
|
|
private TicketAdministrationRepository objTicketAdministrationRepository = null;
|
|
|
|
/// <summary>
|
|
/// Global variable for Ticket administration CCE portal repository.
|
|
/// </summary>
|
|
private UserInventoryRepository objUserInventoryRepository = null;
|
|
|
|
/// <summary>
|
|
/// Global variable for Report repository to access methods of report repository.
|
|
/// </summary>
|
|
private ReportRepository objReportRepository = null;
|
|
|
|
/// <summary>
|
|
/// Represent object of LoggingUtility class
|
|
/// </summary>
|
|
LoggingUtility objLog = new LoggingUtility();
|
|
|
|
/// <summary>
|
|
/// Represent string object contain log file path
|
|
/// </summary>
|
|
//string path = "~/Log/";
|
|
string path = System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]);
|
|
|
|
/// <summary>
|
|
/// Represent string object contain log status
|
|
/// </summary>
|
|
string logtf = (ConfigurationManager.AppSettings["Log"]);
|
|
|
|
/// <summary>
|
|
/// Represent string object contain Error log status
|
|
/// </summary>
|
|
string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]);
|
|
|
|
/// <summary>
|
|
/// getting application name from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _appName = ConfigurationManager.AppSettings["ApplicationName"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting web api token from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _securityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting web api Utc Minute from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _UtcMinute = ConfigurationManager.AppSettings["UtcMinute"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting user's utc minutes from session
|
|
/// </summary>
|
|
private static string _timeOffSetMinutes = null;
|
|
|
|
/// <summary>
|
|
/// getting user's utc minutes from session
|
|
/// </summary>
|
|
private static int _UtcMinutes;
|
|
|
|
/// <summary>
|
|
/// getting login user's id
|
|
/// </summary>
|
|
private static string _LoginUserId = null;
|
|
|
|
/// <summary>
|
|
/// getting login user's name
|
|
/// </summary>
|
|
private static string _LoginUserName = null;
|
|
|
|
|
|
private static string _LoginUserRole = null;
|
|
|
|
/// <summary>
|
|
/// getting time zone id from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _TimeZoneId = ConfigurationManager.AppSettings["TimeZoneId"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting rest api url from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _RestClientUrl = ConfigurationManager.AppSettings["RestfulApiUrl"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting total count of rows of a grid in one page from AppSetting in web.config file
|
|
/// </summary>
|
|
private static int _pageSize = Convert.ToInt16(ConfigurationManager.AppSettings["reportPageSize"]);
|
|
|
|
|
|
/// <summary>
|
|
/// URI to Path to Excel Export location.
|
|
/// </summary>
|
|
private static string _exportLocation = ConfigurationManager.AppSettings["excelExportPath"].ToString();
|
|
|
|
/// <summary>
|
|
/// Absolute Path on server in which excel files are saved
|
|
/// </summary>
|
|
private static string _excelExportPathOnServer = ConfigurationManager.AppSettings["excelExportPathOnServer"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting date time format from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _dateTimeFormat = ConfigurationManager.AppSettings["dateTimeFormat"].ToString();
|
|
|
|
/// <summary>
|
|
/// Global variable for Page Size, offset.
|
|
/// </summary>
|
|
int lPageSise = Convert.ToInt32(ConfigurationManager.AppSettings["reportPageSize"]);
|
|
|
|
#endregion
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// To generate transpose of a datatable
|
|
/// </summary>
|
|
/// <param name="inputTable">input Table</param>
|
|
/// <returns>transpose of input datatable</returns>
|
|
private DataTable GenerateTransposedTable(DataTable inputTable)
|
|
{
|
|
DataTable outputTable = new DataTable();
|
|
|
|
// Add columns by looping rows
|
|
|
|
// Header row's first column is same as in inputTable
|
|
outputTable.Columns.Add(inputTable.Columns[0].ColumnName.ToString());
|
|
|
|
// Header row's second column onwards, 'inputTable's first column taken
|
|
foreach (DataRow inRow in inputTable.Rows)
|
|
{
|
|
string newColName = inRow[0].ToString();
|
|
outputTable.Columns.Add(newColName);
|
|
}
|
|
|
|
// Add rows by looping columns
|
|
for (int rCount = 0; rCount <= inputTable.Columns.Count - 1; rCount++)
|
|
{
|
|
DataRow newRow = outputTable.NewRow();
|
|
|
|
// First column is inputTable's Header row's second column
|
|
newRow[0] = inputTable.Columns[rCount].ColumnName.ToString();
|
|
for (int cCount = 0; cCount <= inputTable.Rows.Count - 1; cCount++)
|
|
{
|
|
string colValue = inputTable.Rows[cCount][rCount].ToString();
|
|
newRow[cCount + 1] = colValue;
|
|
}
|
|
outputTable.Rows.Add(newRow);
|
|
}
|
|
|
|
return outputTable;
|
|
}
|
|
|
|
|
|
private bool DataTableToCSV(DataTable dt, string fileName)
|
|
{
|
|
try
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
IEnumerable<string> columnNames = dt.Columns.Cast<DataColumn>().
|
|
Select(column => column.ColumnName);
|
|
|
|
sb.AppendLine(string.Join(",", columnNames));
|
|
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
IEnumerable<string> fields = row.ItemArray.Select(field => field.ToString());
|
|
sb.AppendLine(string.Join(",", fields));
|
|
}
|
|
|
|
//File(fileName, sb.ToString());
|
|
System.IO.File.WriteAllText(fileName, sb.ToString());
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region open and close ticket report
|
|
|
|
#region Report Ticket_Open
|
|
|
|
/// <summary>
|
|
/// Get Open Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Ticket_Open()
|
|
{
|
|
objLog.AddLogFile("Reports_Ticket_Open", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Open", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of open tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <param name="startDate">String representation of start date</param>
|
|
/// <param name="endDate">String representation of end date</param>
|
|
/// <param name="limit">String representation of limit of pages</param>
|
|
/// <param name="offset">String representation of offset</param>
|
|
/// <param name="ticketStatus">String representation of ticket status</param>
|
|
/// <returns>return partial view of open tickets</returns>
|
|
public ActionResult Ticket_Open_Grid(string userId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Reports_Ticket_Open_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
string fromDate = "01 jan 1900";
|
|
string toDate = DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]);
|
|
if (startDate != "" && endDate != "")
|
|
{
|
|
fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
}
|
|
//Get list of open ticket
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(userId, fromDate, toDate, _pageSize, 0, ticketStatus, null,null);
|
|
List<TicketList> oList = new List<TicketList>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketList);
|
|
}
|
|
|
|
//List<ReportOpenTicketModel> oTicketOpenCount = objReportRepository.GetOpenTicketsList(userId, fromDate, toDate, _pageSize, 0, "count");
|
|
|
|
//Int32 totalCount = 0;
|
|
//foreach (var item in oTicketOpenCount)
|
|
//{
|
|
// totalCount = item.TicketCount;
|
|
//}
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
//ViewBag.total = totalCount;
|
|
ViewBag.ticketStatus = ticketStatus;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Open_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
///// <summary>
|
|
///// Server side paging
|
|
///// </summary>
|
|
///// <param name="request"></param>
|
|
///// <param name="userId"></param>
|
|
///// <param name="startDate"></param>
|
|
///// <param name="endDate"></param>
|
|
///// <param name="ticketStatus"></param>
|
|
///// <param name="total"></param>
|
|
///// <returns></returns>
|
|
//public ActionResult Ticket_Open_Pager([DataSourceRequest]DataSourceRequest request, string userId, string startDate, string endDate, string ticketStatus, int total)
|
|
//{
|
|
// objLog.AddLogFile("Ticket_Open_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
// try
|
|
// {
|
|
// objReportRepository = new ReportRepository();
|
|
|
|
// List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), ticketStatus, null);
|
|
// List<TicketList> oList = new List<TicketList>();
|
|
// foreach (var item in oTicketOpenFullList)
|
|
// {
|
|
// oList.AddRange(item.TicketList);
|
|
// }
|
|
// // List<ReportOpenTicketModel> model = objBSS_Repository.GetDailyDo_Rev_A_Cell_Level(circleId, date, request.PageSize, request.PageSize * (request.Page - 1));
|
|
// DataSourceResult result = oList.ToDataSourceResult(request);
|
|
// result.Total = total;
|
|
// result.Data = oList;
|
|
// return Json(result);
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region Report Ticket_Close
|
|
|
|
/// <summary>
|
|
/// Get Close Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Ticket_Close()
|
|
{
|
|
objLog.AddLogFile("Reports_Ticket_Close", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Close", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of close tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <param name="startDate">String representation of start date</param>
|
|
/// <param name="endDate">String representation of end date</param>
|
|
/// <param name="ticketStatus">String representation of ticket status</param>
|
|
/// <returns>return partial view of close tickets</returns>
|
|
public ActionResult Ticket_Close_Grid(string userId, string startDate, string endDate, string ticketStatus, string regionTag, string dealerTag, string emmisionTag, string vehicleTag, string customerTag,string tstatus,string TicketType)
|
|
{
|
|
objLog.AddLogFile("Reports_Ticket_Close_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Adding time to start date and end date
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
string query = null;
|
|
//Getting list of close ticket list
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(userId, fromDate, toDate, _pageSize, 0, ticketStatus, null, TicketType);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketList> oList = new List<TicketList>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketList);
|
|
}
|
|
|
|
string strticketstatus = "";
|
|
if (ticketStatus.ToLower() == "close")
|
|
{
|
|
|
|
strticketstatus = "Closed";
|
|
}
|
|
string ticketStatusTag = "Closed";
|
|
string filterdataval = filterdata(regionTag, dealerTag, emmisionTag, vehicleTag, customerTag, tstatus);
|
|
// filterData = "TicketStatusAlias~eq~'Closed'~and~((ticketid_alias)~contains~'E1'~or~ticketid_alias~contains~'E2')~and~((vehicle_emission_norms)~eq~'BS III'~or~vehicle_emission_norms~eq~'BS VI'~or~vehicle_emission_norms~eq~'BS IV')~and~((VehicleTagging)~eq~'BUS'~or~VehicleTagging~eq~'HD')";
|
|
// get query from filter object,
|
|
// filterData = "TicketStatusAlias~eq~'Closed'~and~" + stremmisionTagval1 +")";
|
|
// filterData = "TicketStatusAlias~eq~'" + strticketstatus + "'~and~" + stremmisionTagval1 + ")";
|
|
query = FilterKendoGrid.CreateFilterQuery(filterdataval);
|
|
//string strdata = "TicketStatusAlias~eq~'Closed'~and~(vehicle_emission_norms~contains~'BS II'~or~vehicle_emission_norms~contains~'BS IV')";
|
|
|
|
//Server side paging, Get total count of tickets
|
|
// List<ReportOpenTicketModel> oTicketCloseCount = objReportRepository.GetOpenTicketsList(userId, fromDate, toDate, _pageSize, 0, "count", null);
|
|
List<ReportOpenTicketModel> oTicketCloseCount = objReportRepository.GetOpenTicketsList(userId, startDate, endDate, _pageSize, 0, "count", query, TicketType);
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oTicketCloseCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = totalCount;
|
|
ViewBag.ticketStatus = ticketStatus;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
ViewBag.regionTag = regionTag;
|
|
ViewBag.dealerTag = dealerTag;
|
|
ViewBag.emmisionTag = emmisionTag;
|
|
ViewBag.vehicleTag = vehicleTag;
|
|
ViewBag.customerTag = customerTag;
|
|
ViewBag.tstatus = tstatus;
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Close_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Server side paging on close ticket report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <returns>return list of close tickets</returns>
|
|
/// <summary>
|
|
/// Server side paging on close ticket report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <returns>return list of close tickets</returns>
|
|
public ActionResult Ticket_Close_Pager([DataSourceRequest] DataSourceRequest request, string userId, string startDate, string endDate, string ticketStatus, int total, string regionTag, string dealerTag, string emmisionTag, string vehicleTag, string customerTag,string tstatus)
|
|
|
|
{
|
|
objLog.AddLogFile("Ticket_Close_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
|
|
string query = null;
|
|
if (request.Filters.Count > 0)
|
|
{
|
|
string strticketstatus = "";
|
|
if (ticketStatus.ToLower() == "close")
|
|
{
|
|
|
|
strticketstatus = "Closed";
|
|
}
|
|
string ticketStatusTag = "Closed";
|
|
string filterdataval= filterdata(regionTag, dealerTag, emmisionTag, vehicleTag, customerTag, tstatus);
|
|
// filterData = "TicketStatusAlias~eq~'Closed'~and~((ticketid_alias)~contains~'E1'~or~ticketid_alias~contains~'E2')~and~((vehicle_emission_norms)~eq~'BS III'~or~vehicle_emission_norms~eq~'BS VI'~or~vehicle_emission_norms~eq~'BS IV')~and~((VehicleTagging)~eq~'BUS'~or~VehicleTagging~eq~'HD')";
|
|
// get query from filter object,
|
|
// filterData = "TicketStatusAlias~eq~'Closed'~and~" + stremmisionTagval1 +")";
|
|
// filterData = "TicketStatusAlias~eq~'" + strticketstatus + "'~and~" + stremmisionTagval1 + ")";
|
|
query = FilterKendoGrid.CreateFilterQuery(filterdataval);
|
|
//string strdata = "TicketStatusAlias~eq~'Closed'~and~(vehicle_emission_norms~contains~'BS II'~or~vehicle_emission_norms~contains~'BS IV')";
|
|
}
|
|
objReportRepository = new ReportRepository();
|
|
|
|
//Getting list of close ticket list
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), ticketStatus, query,null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketList> oList = new List<TicketList>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketList);
|
|
}
|
|
|
|
//Server side paging, Get total count of tickets
|
|
List<ReportOpenTicketModel> oTicketCloseCount = objReportRepository.GetOpenTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), "count", query,null);
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oTicketCloseCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
DataSourceResult result = oList.ToDataSourceResult(request);
|
|
//check if filters are applied than total count fetched from server
|
|
if (query == null) { result.Total = total; } else { result.Total = totalCount; }
|
|
|
|
//send data to kendo grid
|
|
result.Data = oList;
|
|
return Json(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_Close_Pager", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
public string filterdata(string strregionTag, string strdealerTag, string stremmisionTag, string strvehicleTag, string strcustomerTag, string strticketstatus)
|
|
|
|
{
|
|
string strregionTagval = "";
|
|
if (strregionTag == null || strregionTag == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
//strregionTagval = "(ticketid_alias)~contains~";
|
|
strregionTagval = "(ticketid_alias)~contains~";
|
|
|
|
string source = strregionTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
// names[i] = "'" + names[i].Trim() + "'";
|
|
|
|
string strresult = names[i].Trim().Substring(0, 1);
|
|
string strlastresult = names[i].Trim().Substring(names[i].Length - 1, 1);
|
|
var finalregion = strresult + strlastresult;
|
|
strregionTagval += "'" + finalregion + "'~or~ticketid_alias~contains~";
|
|
}
|
|
|
|
int positionemission = strregionTagval.LastIndexOf("~or~ticketid_alias~contains~");
|
|
strregionTagval = strregionTagval.Substring(0, positionemission);
|
|
strregionTagval = strregionTagval + ")~and~";
|
|
}
|
|
string strdealerTagval = "";
|
|
if (strdealerTag == null || strdealerTag == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
strdealerTagval = "(DealerDealerName)~eq~";
|
|
string source = strdealerTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
strdealerTagval += "'" + names[i].Trim() + "'~or~DealerDealerName~eq~";
|
|
}
|
|
int positionemission = strdealerTagval.LastIndexOf("~or~DealerDealerName~eq~");
|
|
strdealerTagval = strdealerTagval.Substring(0, positionemission);
|
|
strdealerTagval = strdealerTagval + ")~and~";
|
|
// strdealerTag = string.Join(",", names);
|
|
}
|
|
|
|
string stremmisionTagval = "";
|
|
if (stremmisionTag == null || stremmisionTag == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
stremmisionTagval = "(vehicle_emission_norms)~eq~";
|
|
string source = stremmisionTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
// names[i] = "'" + names[i].Trim() + "'";
|
|
stremmisionTagval += "'" + names[i].Trim() + "'~or~vehicle_emission_norms~eq~";
|
|
}
|
|
int positionemission = stremmisionTagval.LastIndexOf("~or~vehicle_emission_norms~eq~");
|
|
stremmisionTagval = stremmisionTagval.Substring(0, positionemission);
|
|
stremmisionTagval = stremmisionTagval + ")~and~";
|
|
// strvehicleTag = string.Join(",", names);
|
|
}
|
|
|
|
|
|
string stremmisionTagval1 = "";
|
|
if (stremmisionTagval1 == null || stremmisionTagval1 == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
stremmisionTagval1 = "(vehicle_emission_norms)~eq~";
|
|
string source = stremmisionTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
// names[i] = "'" + names[i].Trim() + "'";
|
|
stremmisionTagval1 += "'" + names[i].Trim() + "'~or~vehicle_emission_norms~eq~";
|
|
}
|
|
int positionemission = stremmisionTagval1.LastIndexOf("~or~vehicle_emission_norms~eq~");
|
|
stremmisionTagval1 = stremmisionTagval1.Substring(0, positionemission);
|
|
// stremmisionTagval = stremmisionTagval + ")~and~";
|
|
// strvehicleTag = string.Join(",", names);
|
|
}
|
|
if (strcustomerTag == null || strcustomerTag == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
string source = strcustomerTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
names[i] = "'" + names[i].Trim() + "'";
|
|
}
|
|
|
|
// strcustomerTag = string.Join(",", names);
|
|
}
|
|
|
|
string strverticle = "";
|
|
if (strvehicleTag == null || strvehicleTag == "")
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
strverticle = "(VehicleTagging)~eq~";
|
|
string source = strvehicleTag;
|
|
string[] names = source.Split(',');
|
|
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
// names[i] = "'" + names[i].Trim() + "'";
|
|
strverticle += "'" + names[i].Trim() + "'~or~VehicleTagging~eq~";
|
|
}
|
|
int positionver = strverticle.LastIndexOf("~or~VehicleTagging~eq~");
|
|
strverticle = strverticle.Substring(0, positionver);
|
|
strverticle = strverticle + ")~and~";
|
|
// strvehicleTag = string.Join(",", names);
|
|
}
|
|
|
|
|
|
// var customerId =(Request.Params["filter[filters][0][value]"]).ToString();
|
|
// ModifyFilters((IList<IFilterDescriptor>)request.Filters);
|
|
var filterData = (System.Web.HttpContext.Current.Request.Params["filter"]);
|
|
|
|
string strfinal = strregionTagval + strdealerTagval + stremmisionTagval + strverticle;
|
|
if (strfinal == "" || strfinal == null)
|
|
{
|
|
filterData = "TicketStatusAlias~eq~'" + strticketstatus +"'";
|
|
}
|
|
else {
|
|
int position = strfinal.LastIndexOf("~and~");
|
|
strfinal = strfinal.Substring(0, position);
|
|
filterData = "TicketStatusAlias~eq~'" + strticketstatus + "'~and~" + strfinal + "";
|
|
}
|
|
|
|
return filterData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Export to excel Open and Close Ticket Report
|
|
/// </summary>
|
|
/// <param name="UserId">Login user id</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="ticketStatus">Ticket Status(Open or Close)</param>
|
|
/// <returns>Returns excel file</returns>
|
|
[HttpPost]
|
|
public string Ticket_Close_Open_ExportToExcel(string UserId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_Close_Open_ExportToExcel", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string filename = null;
|
|
string templatePath = null;
|
|
objReportRepository = new ReportRepository();
|
|
|
|
string fromDate = "01 jan 1900";
|
|
string toDate = DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]);
|
|
if (startDate != "" && endDate != "")
|
|
{
|
|
fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
}
|
|
|
|
//string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
//string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Get list of ticket
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(UserId, fromDate, toDate, 100000, 0, ticketStatus, null,null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketList> oList = new List<TicketList>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketList);
|
|
}
|
|
DataTable OpenTicketTable = oList.ToDataTable();
|
|
|
|
//Server side paging, Get total count of tickets
|
|
Int32 OpenTicketTableColumnCount = OpenTicketTable.Columns.Count - 1;
|
|
for (var count = OpenTicketTableColumnCount; count >= 20; count--)
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(count);
|
|
}
|
|
|
|
if (ticketStatus.ToLower().Trim() == "open")
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
//OpenTicketTable.Columns.RemoveAt(14);
|
|
}
|
|
else
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(17);
|
|
OpenTicketTable.Columns.RemoveAt(2);
|
|
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(OpenTicketTable);
|
|
|
|
////Give column names
|
|
ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Ticket Status";
|
|
ds.Tables[0].Columns[2].ColumnName = "Ticket Creation Time";
|
|
ds.Tables[0].Columns[3].ColumnName = "Customer Name";
|
|
ds.Tables[0].Columns[4].ColumnName = "Customer Contact No.";
|
|
ds.Tables[0].Columns[5].ColumnName = "Vehicle Registration No.";
|
|
ds.Tables[0].Columns[6].ColumnName = "Vehicle Type";
|
|
ds.Tables[0].Columns[7].ColumnName = "Default SLA Time (In Min)";
|
|
ds.Tables[0].Columns[8].ColumnName = "Response(In min)";
|
|
ds.Tables[0].Columns[9].ColumnName = "EOS Team Member/Van Reg No.";
|
|
ds.Tables[0].Columns[10].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[11].ColumnName = "Dealer Contact No.";
|
|
ds.Tables[0].Columns[12].ColumnName = "Language";
|
|
ds.Tables[0].Columns[13].ColumnName = "Pre Closure Time";
|
|
ds.Tables[0].Columns[14].ColumnName = "Chassis Number";
|
|
ds.Tables[0].Columns[15].ColumnName = "Odometer Reading";
|
|
|
|
|
|
|
|
if (ticketStatus == "close")
|
|
{
|
|
ds.Tables[0].Columns.RemoveAt(1);
|
|
}
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ticketStatus == "open")
|
|
{
|
|
filename = "OpenTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Open Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["OpenTicketReportTemplate"].ToString());
|
|
}
|
|
else
|
|
{
|
|
filename = "CloseTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Close Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["CloseTicketReportTemplate"].ToString());
|
|
}
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
|
|
// returning path to generated Excel file
|
|
if (result.Status == 1) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_Close_Open_ExportToExcel", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public string Ticket_Close_Open_NewExportToExcel(string UserId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_Close_Open_ExportToExcel", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string filename = null;
|
|
string templatePath = null;
|
|
objReportRepository = new ReportRepository();
|
|
|
|
string fromDate = "01 jan 1900";
|
|
string toDate = DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]);
|
|
if (startDate != "" && endDate != "")
|
|
{
|
|
fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
}
|
|
|
|
|
|
//Get list of ticket
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetOpenTicketsList(UserId, fromDate, toDate, 100000, 0, ticketStatus, null,null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketList> oList = new List<TicketList>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketList);
|
|
}
|
|
DataTable OpenTicketTable = oList.ToDataTable();
|
|
|
|
//Server side paging, Get total count of tickets
|
|
|
|
Int32 OpenTicketTableColumnCount = OpenTicketTable.Columns.Count - 1;
|
|
|
|
//--------- *** changes on 13-10-2020 start ***----------------------------------------------------------
|
|
if (ticketStatus.ToLower().Trim() == "close")
|
|
{
|
|
for (var count = OpenTicketTableColumnCount; count >= 35; count--) //modified count on 25-11-2020 //modified count from 34 to 35 on 23-12-2020
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(count);
|
|
}
|
|
|
|
if (ticketStatus.ToLower().Trim() == "open")
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
//OpenTicketTable.Columns.RemoveAt(14);
|
|
|
|
}
|
|
else
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(17);
|
|
OpenTicketTable.Columns.RemoveAt(2);
|
|
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(OpenTicketTable);
|
|
|
|
|
|
//----------------------------------- *** changed code ***--------------------------------------
|
|
//ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
//ds.Tables[0].Columns[1].ColumnName = "Ticket Status";
|
|
//ds.Tables[0].Columns[2].ColumnName = "Customer Name";
|
|
//ds.Tables[0].Columns[3].ColumnName = "Customer Contact No.";
|
|
//ds.Tables[0].Columns[4].ColumnName = "Vehicle Registration No.";
|
|
//ds.Tables[0].Columns[5].ColumnName = "Vehicle Type";
|
|
//ds.Tables[0].Columns[6].ColumnName = "Default SLA Time (In Min)";
|
|
//ds.Tables[0].Columns[7].ColumnName = "Response(In min)";
|
|
//ds.Tables[0].Columns[8].ColumnName = "EOS Team Member/Van Reg No.";
|
|
//ds.Tables[0].Columns[9].ColumnName = "Dealer Name";
|
|
//ds.Tables[0].Columns[10].ColumnName = "Dealer Contact No.";
|
|
//ds.Tables[0].Columns[11].ColumnName = "Language";
|
|
//ds.Tables[0].Columns[12].ColumnName = "Pre Closure Time";
|
|
//ds.Tables[0].Columns[16].ColumnName = "Chassis No";
|
|
//ds.Tables[0].Columns[17].ColumnName = "Odometer Reading";
|
|
|
|
//// added van/breakdown lat lng
|
|
//ds.Tables[0].Columns[18].ColumnName = "Van Latitude At Trip Start";
|
|
//ds.Tables[0].Columns[19].ColumnName = "Van Longitude At Trip Start";
|
|
//ds.Tables[0].Columns[20].ColumnName = "Van Latitude At Van Reached";
|
|
//ds.Tables[0].Columns[21].ColumnName = "Van Longitude At Van Reached";
|
|
//ds.Tables[0].Columns[22].ColumnName = "Van Latitude At Trip End";
|
|
//ds.Tables[0].Columns[23].ColumnName = "Van Longitude At Trip End";
|
|
//ds.Tables[0].Columns[24].ColumnName = "Breakdown Location Latitude";
|
|
//ds.Tables[0].Columns[25].ColumnName = "Breakdown Location Longitude";
|
|
//ds.Tables[0].Columns[26].ColumnName = "Ticket Closed Reason"; //change the column name on 25-11-2020
|
|
//ds.Tables[0].Columns[27].ColumnName = "Vehicle Warranty";
|
|
//ds.Tables[0].Columns[28].ColumnName = "Vehicle Amc";
|
|
//ds.Tables[0].Columns[29].ColumnName = "Vehicle Emission Norms";
|
|
//ds.Tables[0].Columns[30].ColumnName = "Vehicle Sales Date";
|
|
//ds.Tables[0].Columns[31].ColumnName = "Ticket Closed Reason"; //change the column name on 25-11-2020 //change the column name on 23-12-2020
|
|
//ds.Tables[0].Columns[32].ColumnName = "Van Reached Punch Time"; //change the column name on 23-12-2020
|
|
|
|
|
|
//----------------------------------- *** changed code ***--------------------------------------
|
|
|
|
|
|
|
|
//----------------------------------- *** changed code ***--------------------------------------
|
|
ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Ticket Status";
|
|
ds.Tables[0].Columns[2].ColumnName = "Customer Name";
|
|
ds.Tables[0].Columns[3].ColumnName = "Customer Contact No.";
|
|
ds.Tables[0].Columns[4].ColumnName = "Vehicle Registration No.";
|
|
ds.Tables[0].Columns[5].ColumnName = "Vehicle Type";
|
|
ds.Tables[0].Columns[6].ColumnName = "Default SLA Time (In Min)";
|
|
ds.Tables[0].Columns[7].ColumnName = "Response(In min)";
|
|
ds.Tables[0].Columns[8].ColumnName = "EOS Team Member/Van Reg No.";
|
|
ds.Tables[0].Columns[9].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[10].ColumnName = "Dealer Contact No.";
|
|
ds.Tables[0].Columns[11].ColumnName = "Language";
|
|
ds.Tables[0].Columns[12].ColumnName = "Pre Closure Time";
|
|
ds.Tables[0].Columns[16].ColumnName = "Chassis No";
|
|
ds.Tables[0].Columns[17].ColumnName = "Odometer Reading";
|
|
ds.Tables[0].Columns[18].ColumnName = "Van Reach By Call Center"; //added on 19-01-2021
|
|
|
|
|
|
// added van/breakdown lat lng
|
|
ds.Tables[0].Columns[19].ColumnName = "Van Latitude At Trip Start";
|
|
ds.Tables[0].Columns[20].ColumnName = "Van Longitude At Trip Start";
|
|
ds.Tables[0].Columns[21].ColumnName = "Van Latitude At Van Reached";
|
|
ds.Tables[0].Columns[22].ColumnName = "Van Longitude At Van Reached";
|
|
ds.Tables[0].Columns[23].ColumnName = "Van Latitude At Trip End";
|
|
ds.Tables[0].Columns[24].ColumnName = "Van Longitude At Trip End";
|
|
ds.Tables[0].Columns[25].ColumnName = "Breakdown Location Latitude";
|
|
ds.Tables[0].Columns[26].ColumnName = "Breakdown Location Longitude";
|
|
|
|
//------------------- added on 23-12-2020 start----------------------------------
|
|
ds.Tables[0].Columns[27].ColumnName = "Vehicle Warranty";
|
|
ds.Tables[0].Columns[28].ColumnName = "Vehicle Amc";
|
|
ds.Tables[0].Columns[29].ColumnName = "Vehicle Emission Norms";
|
|
ds.Tables[0].Columns[30].ColumnName = "Vehicle Sales Date";
|
|
ds.Tables[0].Columns[31].ColumnName = "Ticket Closed Reason"; //change the column name on 25-11-2020
|
|
|
|
//------------------- added on 23-12-2020 end----------------------------------
|
|
|
|
//----------------------------------- *** changed code ***--------------------------------------
|
|
|
|
|
|
|
|
if (ticketStatus == "close")
|
|
{
|
|
ds.Tables[0].Columns.RemoveAt(1);
|
|
//ds.Tables[0].Columns.RemoveAt(25); // added on 13-10-2020
|
|
|
|
}
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ticketStatus == "open")
|
|
{
|
|
filename = "OpenTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Open Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["OpenTicketReportTemplate"].ToString());
|
|
}
|
|
else
|
|
{
|
|
filename = "CloseTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Close Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["CloseTicketReportTemplate"].ToString());
|
|
}
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
|
|
|
|
//commented on 24-07-2020(excel download same as consolidate report)
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
if (isCreated == true) { return _exportLocation + filename; }
|
|
else { return "error"; }
|
|
}
|
|
|
|
else
|
|
{
|
|
for (var count = OpenTicketTableColumnCount; count >= 21; count--) //change the count from 20 from 21 on 23-12-2020
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(count);
|
|
}
|
|
|
|
if (ticketStatus.ToLower().Trim() == "open")
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
OpenTicketTable.Columns.RemoveAt(OpenTicketTable.Columns.Count - 4);
|
|
//OpenTicketTable.Columns.RemoveAt(14);
|
|
|
|
}
|
|
else
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(17);
|
|
OpenTicketTable.Columns.RemoveAt(2);
|
|
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(OpenTicketTable);
|
|
|
|
////Give column names
|
|
|
|
//changes done on 13-10-2020
|
|
//----------------------------------- *** existing code ***--------------------------------------
|
|
ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Ticket Status";
|
|
ds.Tables[0].Columns[2].ColumnName = "Ticket Creation Time";
|
|
ds.Tables[0].Columns[3].ColumnName = "Customer Name";
|
|
ds.Tables[0].Columns[4].ColumnName = "Customer Contact No.";
|
|
ds.Tables[0].Columns[5].ColumnName = "Vehicle Registration No.";
|
|
ds.Tables[0].Columns[6].ColumnName = "Vehicle Type";
|
|
ds.Tables[0].Columns[7].ColumnName = "Default SLA Time (In Min)";
|
|
ds.Tables[0].Columns[8].ColumnName = "Response(In min)";
|
|
ds.Tables[0].Columns[9].ColumnName = "EOS Team Member/Van Reg No.";
|
|
ds.Tables[0].Columns[10].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[11].ColumnName = "Dealer Contact No.";
|
|
ds.Tables[0].Columns[12].ColumnName = "Language";
|
|
ds.Tables[0].Columns[13].ColumnName = "Pre Closure Time";
|
|
ds.Tables[0].Columns[14].ColumnName = "Chassis Number";
|
|
ds.Tables[0].Columns[15].ColumnName = "Odometer Reading";
|
|
ds.Tables[0].Columns[16].ColumnName = "Van Reach By Call Center"; //added on 19-01-2021
|
|
|
|
//----------------------------------- *** existing code ***--------------------------------------
|
|
|
|
if (ticketStatus == "close")
|
|
{
|
|
ds.Tables[0].Columns.RemoveAt(1);
|
|
|
|
}
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ticketStatus == "open")
|
|
{
|
|
filename = "OpenTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Open Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["OpenTicketReportTemplate"].ToString());
|
|
}
|
|
else
|
|
{
|
|
filename = "CloseTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Close Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["CloseTicketReportTemplate"].ToString());
|
|
}
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
|
|
|
|
|
|
//commented on 24-07-2020(excel download same as consolidate report)
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
if (isCreated == true) { return _exportLocation + filename; }
|
|
else { return "error"; }
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_Close_Open_ExportToExcel", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Show Ticket Details, Activities, feedback
|
|
|
|
/// <summary>
|
|
/// Get Full details of ticket
|
|
/// </summary>
|
|
/// <param name="ticketId">selected ticket's id</param>
|
|
/// <param name="ticketStatus">ticket status open or close</param>
|
|
/// <returns>returns list type partial view</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketFullDetails(string ticketId, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketFullDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<TicketModel> oCloseTicketList = new List<TicketModel>();
|
|
ViewBag.CloseTicketHistory = null;
|
|
|
|
if (ticketStatus == "close")
|
|
{
|
|
//Get close ticket list
|
|
oCloseTicketList = objTicketAdministrationRepository.GetCloseTicketHistory("", "", ticketId);
|
|
ViewBag.CloseTicketHistory = oCloseTicketList;
|
|
}
|
|
|
|
//Get ticket details
|
|
List<TicketOpenCloseModel> oTicketDetails = new List<TicketOpenCloseModel>();
|
|
oTicketDetails = objTicketAdministrationRepository.Restful_GetOpenCloseTicketDetails(ticketId, ticketStatus);
|
|
|
|
//Global variables
|
|
int RouteId = 0; string routeName = "";
|
|
|
|
//Getting details of vehicle and customer from ticket details list
|
|
foreach (var item in oTicketDetails)
|
|
{
|
|
RouteId = item.RouteId;
|
|
}
|
|
|
|
//Get route name
|
|
List<RouteModel> oRouteList = objTicketAdministrationRepository.GetRoutesList();
|
|
var oRouteName = oRouteList.Where(w => w.Id.Equals(RouteId));
|
|
foreach (var item11 in oRouteName)
|
|
{
|
|
routeName = item11.Name;
|
|
}
|
|
ViewBag.Route = routeName;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oTicketDetails);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_GetOpencloseTicketFullDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get caller/driver details of ticket
|
|
/// </summary>
|
|
/// <param name="CustomerContactNo">contact no. of caller/driver</param>
|
|
/// <param name="VRegistrationNo">vehicle's registration no. of caller/driver</param>
|
|
/// <returns>return json of list type</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketDriverDetails(string CustomerContactNo, string VRegistrationNo)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketDriverDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get customer details
|
|
List<CustomerModel> oCustomerList = objTicketAdministrationRepository.GetCustomerDetails("", CustomerContactNo, "");
|
|
//List<CustomerModel> itemCustomer = oCustomerList.Where(w => w.CustomerMobile1.Equals(CustomerContactNo)).ToList();
|
|
List<CustomerModel> itemCustomer = oCustomerList.Where(w => w.VehicleRegistrationNumber.Equals(VRegistrationNo)).ToList();
|
|
itemCustomer = itemCustomer.Where(w => w.CustomerVehicleIsOwnwer.Equals(false)).ToList();
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = itemCustomer }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_GetOpencloseTicketDriverDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get details of Vehicle's Owner
|
|
/// </summary>
|
|
/// <param name="VRegistrationNo">Vehicle's registration no.</param>
|
|
/// <returns>return list type json</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketOwnerDetails(string VRegistrationNo)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketOwnerDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get owner details
|
|
List<CustomerOwnerModel> oCustomerOwnerDetailsList = objTicketAdministrationRepository.GetCustomerOwnerDetails(VRegistrationNo);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oCustomerOwnerDetailsList }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_GetOpencloseTicketOwnerDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get caller/driver's Vehicle details
|
|
/// </summary>
|
|
/// <param name="VRegistrationNo">vehicle's registration no.</param>
|
|
/// <returns>return list type json</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketVehicleDetails(string VRegistrationNo)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketVehicleDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
string VModelNo = ""; string VModelTagging = ""; string VModelTaggingName = "";
|
|
|
|
//Get vehicle details
|
|
List<VehicleModel> oVehicleDetailsList = objTicketAdministrationRepository.GetVehicleDetailsRegistrationNoWise(VRegistrationNo);
|
|
|
|
foreach (var item12 in oVehicleDetailsList)
|
|
{
|
|
VModelNo = item12.ModelNumber;
|
|
}
|
|
|
|
//Get vehicle's product varient(model tagging)
|
|
List<VehicleModelModel> oVehicleModelList = objTicketAdministrationRepository.GetVehicleModelList();
|
|
var oVModelTaggingList = oVehicleModelList.Where(w => w.VehicleTypeId.Equals(VModelNo));
|
|
foreach (var item13 in oVModelTaggingList)
|
|
{
|
|
VModelTagging = item13.VehicleTypeTagging;
|
|
VModelTaggingName = item13.VehicleTypeName;
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oVehicleDetailsList, vehicleModelTagging = VModelTagging, vehicleModelTaggingName = VModelTaggingName }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_GetOpencloseTicketVehicleDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
#region get tracking device alias wise for open ticket report
|
|
|
|
/// <summary>
|
|
/// Get tracking list device alias wise for open ticket report
|
|
/// </summary>
|
|
/// <param name="deviceAlias">device alias of van whom to ticket is assigned</param>
|
|
/// <param name="creationTime">ticket creation time</param>
|
|
/// <returns>return tracking list</returns>
|
|
public JsonResult Report_GetTrackingHistoryDeviceAliasWise(string deviceAlias, DateTime creationTime)
|
|
{
|
|
objLog.AddLogFile("Report_GetTrackingHistoryDeviceAliasWise", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get vehicle details
|
|
List<ListTracking> oTrackingDetailsList = objTicketAdministrationRepository.GetTrackingListDeviceAliasWise(deviceAlias, creationTime);
|
|
//.GroupBy(g => g.Latitude).Select(s => s.FirstOrDefault()).ToList();
|
|
List<object> oList = new List<object>();
|
|
|
|
foreach (var item in oTrackingDetailsList)
|
|
{
|
|
oList.Add(new
|
|
{
|
|
lat = Convert.ToDecimal(item.Latitude),
|
|
lng = Convert.ToDecimal(item.Longitude)
|
|
});
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oList }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_GetTrackingHistoryDeviceAliasWise", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Get Escalation Level Membbers
|
|
|
|
/// <summary>
|
|
/// Get escalation level members details
|
|
/// </summary>
|
|
/// <param name="dealer_id">Dealer ID</param>
|
|
/// <param name="vehicle_tagging">Vehicle Tagging</param>
|
|
/// <returns>return partial view</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketEscalationMembersDetails(string dealer_id, string vehicle_tagging)
|
|
{
|
|
objLog.AddLogFile("TicketReport_GetOpencloseTicketEscalationMembersDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get vehicle details
|
|
EscalationMemberLevel oEscalationMemberDetails = objTicketAdministrationRepository.GetEscalationMemberDetailsDealerVehicleTypeWise(dealer_id, vehicle_tagging);
|
|
List<EscalationLevelList> oEscalationMemberDetailsList = oEscalationMemberDetails.EscalationLevelList;
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oEscalationMemberDetailsList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketReport_GetOpencloseTicketEscalationMembersDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Get ticket activities
|
|
/// </summary>
|
|
/// <param name="ticketId">ticket id</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Ticket_GetOpencloseTicketActivities(string ticketId, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketActivities", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string _LoginUserRole = Session["UserRole"].ToString();
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<OpenTicketActivityDetails> oOpenTicketActivityList = null;
|
|
List<CloseTicketActivityDetails> oCloseTicketActivityList = null;
|
|
|
|
List<TicketOpenCloseModel> oTicketDetails = new List<TicketOpenCloseModel>();
|
|
oTicketDetails = objTicketAdministrationRepository.Restful_GetOpenCloseTicketDetails(ticketId, ticketStatus);
|
|
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
|
|
//Get ticket activity
|
|
//Get close tickets activity if ticket status is close
|
|
if (ticketStatus == "close")
|
|
{
|
|
//close ticket api
|
|
oCloseTicketActivityList = objTicketAdministrationRepository.GetCloseTicketActivityDetails(ticketId);
|
|
ViewBag.OpenTicketActivity = null;
|
|
ViewBag.CloseTicketActivity = oCloseTicketActivityList;
|
|
}
|
|
//else get open tickets activity
|
|
else
|
|
{
|
|
//open ticket api
|
|
oOpenTicketActivityList = objTicketAdministrationRepository.GetOpenTicketActivityDetails(ticketId);
|
|
ViewBag.OpenTicketActivity = oOpenTicketActivityList;
|
|
ViewBag.CloseTicketActivity = null;
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oTicketDetails);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_GetOpencloseTicketActivities", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Get partial view of feedback detail page.
|
|
/// </summary>
|
|
/// <param name="selectTicketId">selected ticket id</param>
|
|
/// <param name="ticketCreationTime">creation time of ticket</param>
|
|
/// <param name="isMoreThan24Hrs">time between ticket open and close(in hours)</param>
|
|
/// <returns>return partial view</returns>
|
|
public ActionResult Ticket_Feedback(string selectTicketId, string ticketCreationTime, double isMoreThan24Hrs)
|
|
{
|
|
objLog.AddLogFile("TicketAdministrationDealer_Feedback", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string _LoginUserRole = Session["UserRole"].ToString();
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
FeedBackModel objFeedbackHistory = new FeedBackModel();
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
List<FeedbackHistoryList> oFeedbackHistoryList = new List<FeedbackHistoryList>();
|
|
if (selectTicketId != null)
|
|
{
|
|
ViewBag.TicketId = selectTicketId;
|
|
ViewBag.CreationTime = ticketCreationTime;
|
|
ViewBag.IsMoreThan24Hrs = isMoreThan24Hrs;
|
|
|
|
//Get Feedback questions
|
|
List<FeedbackSuggestionComplaintModel> objFeedbackQuestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("feedback");
|
|
ViewBag.FeedbackQuestions = objFeedbackQuestionsList;
|
|
|
|
|
|
//Get feedback history details
|
|
objFeedbackHistory = objTicketAdministrationRepository.GetFeedBackHistoryDetailsTicketIdWise(selectTicketId);
|
|
oFeedbackHistoryList = objFeedbackHistory.feedbackHistoryList.ToList();
|
|
ViewBag.FeedbackHistory = oFeedbackHistoryList;
|
|
|
|
|
|
//Get feedback details if any
|
|
objFeedbackModel = objTicketAdministrationRepository.GetFeedBackDetailsTicketIdWise(selectTicketId, ticketCreationTime);
|
|
|
|
ViewBag.EaseOfGettingCall = objFeedbackModel.FeedBackEaseOfGettingCall;
|
|
ViewBag.ResponseOfCallCenter = objFeedbackModel.FeedBackResponseOfCallCenter;
|
|
ViewBag.TimelyUpdationByDealer = objFeedbackModel.FeedBackTimelyUpdationByDealer;
|
|
ViewBag.TotalRepairTime = objFeedbackModel.FeedBackTotalRepairTime;
|
|
ViewBag.EosCharges = objFeedbackModel.FeedBackEosCharges;
|
|
ViewBag.OverAllExperience = objFeedbackModel.FeedBackOverAllExperience;
|
|
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(objFeedbackModel);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministrationDealer_Feedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Check if ticket exist in open
|
|
|
|
/// <summary>
|
|
/// Method to check if ticket exist in open ticket table
|
|
/// </summary>
|
|
/// <param name="ticketId">ticket id</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <returns>return json success true or false</returns>
|
|
public JsonResult CheckIfTicketExistInOpen(string ticketId, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Report_CheckIfTicketExistInOpen", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get ticket open list
|
|
List<TicketModel> oOpenTicketList = new List<TicketModel>();
|
|
oOpenTicketList = objTicketAdministrationRepository.GetOpenTicketHistory("", "", ticketId);
|
|
if (oOpenTicketList.Count > 0)
|
|
{
|
|
oOpenTicketList = oOpenTicketList.Where(w => w.TicketId.Equals(ticketId)).ToList();
|
|
if (oOpenTicketList.Count > 0)
|
|
{
|
|
return Json(new { success = true }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_CheckIfTicketExistInOpen", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region REPORTS
|
|
|
|
#region EOS Call Count
|
|
/// <summary>
|
|
/// to show main page of EOS call count, which consists filters
|
|
/// </summary>
|
|
/// <returns>main page of EOS call count</returns>
|
|
public ActionResult getEosCallCount()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// show partial page for EOS call count which consists charts and table
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page for EOS call count</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowEosCallCount(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
EosCallCount model = new EosCallCount();
|
|
model = oReportRepository.GetEosCallCount(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEosCallCount", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exports EOS call count report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportEosCallCount(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
EosCallCount model = new EosCallCount();
|
|
model = oReportRepository.GetEosCallCount(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable EosCallCountTable = new DataTable();
|
|
if (model.EosList != null)
|
|
{
|
|
EosCallCountTable = model.EosList.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(EosCallCountTable);
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "EOS Call Count", StartColumnName = "B", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "EosCallCount_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["eosCellCountTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportEosCallCount", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region HD, BUSES & LMD Contribution
|
|
|
|
/// <summary>
|
|
/// to show main page of Hd Bus Lmd Contribution, which consists filters
|
|
/// </summary>
|
|
/// <returns>main page of Hd Bus Lmd Contribution</returns>
|
|
public ActionResult HdBusLmdContribution()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// to show partial page of Hd Bus Lmd Contribution, which consists charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page of Hd Bus Lmd Contribution</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowHdBusLmdContribution(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
HdLmdBusContribution model = new HdLmdBusContribution();
|
|
model = oReportRepository.GetHdLmdBusContribution(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowHdBusLmdContribution", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exports HD, lmd, bus contribution report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportHdBusLmdContribution(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
HdLmdBusContribution model = new HdLmdBusContribution();
|
|
model = oReportRepository.GetHdLmdBusContribution(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable HdBusLmdContributionTable = new DataTable();
|
|
DataTable HdLmdBusclosedTable = new DataTable();
|
|
if (model.HdLmdBusContributionList != null)
|
|
{
|
|
HdBusLmdContributionTable = model.HdLmdBusContributionList.ToDataTable();
|
|
HdBusLmdContributionTable.Columns.RemoveAt(5);
|
|
HdBusLmdContributionTable.Columns.RemoveAt(5);
|
|
HdBusLmdContributionTable.Columns.RemoveAt(5);
|
|
}
|
|
if (model.HdLmdBusclosedList != null)
|
|
{
|
|
HdLmdBusclosedTable = model.HdLmdBusclosedList.ToDataTable();
|
|
HdLmdBusclosedTable.Columns.RemoveAt(10);
|
|
HdLmdBusclosedTable.Columns.RemoveAt(10);
|
|
HdLmdBusclosedTable.Columns.RemoveAt(10);
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(HdBusLmdContributionTable);
|
|
ds.Tables.Add(HdLmdBusclosedTable);
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "HD BUSES and LMD Contribution", StartColumnName = "C", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[1].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[1].TableName, WorkSheetName = "HD BUSES and LMD Contribution", StartColumnName = "O", StartRowNumber = 6, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "HdBusLmdContribution_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["HdBusLmdContributionTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
// string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportHdBusLmdContribution", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Dealer-Wise Call Details
|
|
|
|
/// <summary>
|
|
/// To show main page of Dealer Wise Call Details, which consists of filters
|
|
/// </summary>
|
|
/// <returns>main page of Dealer Wise Call Details</returns>
|
|
public ActionResult DealerWiseCallDetails()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// To show partial page of Dealer Wise Call Details, which consists of charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page of Dealer Wise Call Details</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowDealerWiseCallDetails(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
DealerWiseCallDetailModel model = new DealerWiseCallDetailModel();
|
|
model.DealerWiseCallDetail = oReportRepository.GetDealerWiseCallDetails(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.DealerWiseReasonCallClosedBeyond24Hrs = oReportRepository.GetReasonCallClosedBeyond24Hrs(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowDealerWiseCallDetails", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exports Dealer Wise Call Details report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportDealerWiseCallDetails(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
DealerWiseCallDetailModel model = new DealerWiseCallDetailModel();
|
|
model.DealerWiseCallDetail = oReportRepository.GetDealerWiseCallDetails(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.DealerWiseReasonCallClosedBeyond24Hrs = oReportRepository.GetReasonCallClosedBeyond24Hrs(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable DealerWiseCallDetailsTable = new DataTable();
|
|
if (model.DealerWiseCallDetail.DealerWiseCallDetailList != null)
|
|
{
|
|
DealerWiseCallDetailsTable = model.DealerWiseCallDetail.DealerWiseCallDetailList.ToDataTable();
|
|
DealerWiseCallDetailsTable.Columns.RemoveAt(9);
|
|
DealerWiseCallDetailsTable.Columns.RemoveAt(9);
|
|
DealerWiseCallDetailsTable.Columns.RemoveAt(9);
|
|
DealerWiseCallDetailsTable.Columns.RemoveAt(9);
|
|
}
|
|
DataTable DealerWiseReasonCallClosedBeyond24HrsTable = new DataTable();
|
|
if (model.DealerWiseReasonCallClosedBeyond24Hrs.ReasonCallClosedBeyond24HrsList != null)
|
|
{
|
|
DealerWiseReasonCallClosedBeyond24HrsTable = model.DealerWiseReasonCallClosedBeyond24Hrs.ReasonCallClosedBeyond24HrsList.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(DealerWiseCallDetailsTable);
|
|
ds.Tables.Add(DealerWiseReasonCallClosedBeyond24HrsTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (DealerWiseCallDetailsTable.Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Dealer Wise Call Details", StartColumnName = "C", StartRowNumber = 7, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (DealerWiseReasonCallClosedBeyond24HrsTable.Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[1].TableName, WorkSheetName = "Dealer Wise Call Details", StartColumnName = "Q", StartRowNumber = 7, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "DealerWiseCallDetails_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["DealerWiseCallDetailsTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportDealerWiseCallDetails", ex.Message, path, errorlogtf);
|
|
return ex.Message;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Timeslot Closure
|
|
|
|
/// <summary>
|
|
/// To show main page Timeslot Closure report which consists of filters
|
|
/// </summary>
|
|
/// <returns>main page Timeslot Closure report</returns>
|
|
public ActionResult TimeslotClosure()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// To show partial page Timeslot Closure report which consists of charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page Timeslot Closure report</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowTimeslotClosure(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
TimeslotClosure model = new TimeslotClosure();
|
|
model = oReportRepository.GetTimeslotClosure(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowTimeslotClosure", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Exports Timeslot Closure report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated report path</returns>
|
|
[HttpPost]
|
|
public string ExportTimeslotClosure(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
TimeslotClosure model = new TimeslotClosure();
|
|
model = oReportRepository.GetTimeslotClosure(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable DealerWiseCallDetailsTable = new DataTable();
|
|
if (model.TimeSlotClouserDetailList != null)
|
|
{
|
|
DealerWiseCallDetailsTable = model.TimeSlotClouserDetailList.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(DealerWiseCallDetailsTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Timeslot Closure", StartColumnName = "B", StartRowNumber = 6, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "TimeslotClosure_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["TimeslotClosureTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportTimeslotClosure", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Toll Free No. & Opportunity Loss
|
|
|
|
/// <summary>
|
|
/// to show main page of Toll Free And Opportunity Loss, which consists filters
|
|
/// </summary>
|
|
/// <returns>main page of Toll Free And Opportunity Loss</returns>
|
|
public ActionResult TollFreeAndOpportunityLoss()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// to show partial page of Toll Free And Opportunity Loss, which consists charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page of Toll Free And Opportunity Loss</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowTollFreeAndOpportunityLoss(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
TollFreeCallAndOpportunityLoss model = new TollFreeCallAndOpportunityLoss();
|
|
model.OpportunityLoss = oReportRepository.GetOpportunityLoss(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.TollFreeCall = oReportRepository.GetTollFreeNo(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowTollFreeAndOpportunityLoss", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exports Toll Free And Opportunity Loss report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportTollFreeAndOpportunityLoss(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
TollFreeCallAndOpportunityLoss model = new TollFreeCallAndOpportunityLoss();
|
|
model.OpportunityLoss = oReportRepository.GetOpportunityLoss(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.TollFreeCall = oReportRepository.GetTollFreeNo(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable EosOpportunityLossTable = new DataTable();
|
|
DataTable EosTollFreeCallSourceTable = new DataTable();
|
|
if (model.OpportunityLoss.EosOpportunityLoss != null)
|
|
{
|
|
EosOpportunityLossTable = model.OpportunityLoss.EosOpportunityLoss.ToDataTable();
|
|
}
|
|
if (model.TollFreeCall.EosTollFreeCallSource != null)
|
|
{
|
|
EosTollFreeCallSourceTable = model.TollFreeCall.EosTollFreeCallSource.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(EosOpportunityLossTable);
|
|
ds.Tables.Add(EosTollFreeCallSourceTable);
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Toll Free No Oppotunity Loss", StartColumnName = "B", StartRowNumber = 27, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[1].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[1].TableName, WorkSheetName = "Toll Free No Oppotunity Loss", StartColumnName = "I", StartRowNumber = 27, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "TollFreeOppLoss_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["TollFreeOpportunityLossTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportTollFreeAndOpportunityLoss", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Call Feedback Rating
|
|
|
|
/// <summary>
|
|
/// to show main page of Call Feedback Rating, which consists filters
|
|
/// </summary>
|
|
/// <returns>main page of Call Feedback Rating</returns>
|
|
public ActionResult CallFeedbackRating()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// to show partial page of Call Feedback Rating, which consists charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page of Call Feedback Rating</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowCallFeedbackRating(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
CallFeedbackRating model = new CallFeedbackRating();
|
|
model = oReportRepository.GetCallFeedbackRating(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowCallFeedbackRating", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Exports Call Feedback Rating report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportCallFeedbackRating(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
CallFeedbackRating model = new CallFeedbackRating();
|
|
model = oReportRepository.GetCallFeedbackRating(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable CurrentYearEosFeedbackTable = new DataTable();
|
|
if (model.CurrentYearEosFeedback != null)
|
|
{
|
|
CurrentYearEosFeedbackTable = model.CurrentYearEosFeedback.ToDataTable();
|
|
}
|
|
DataTable PreviousYearEosFeedbackTable = new DataTable();
|
|
if (model.PreviousYearEosFeedback != null)
|
|
{
|
|
PreviousYearEosFeedbackTable = model.PreviousYearEosFeedback.ToDataTable();
|
|
}
|
|
DataTable CurrentYearEosFeedbackRatingTable = new DataTable();
|
|
if (model.CurrentYearEosFeedbackRating != null)
|
|
{
|
|
CurrentYearEosFeedbackRatingTable = model.CurrentYearEosFeedbackRating.ToDataTable();
|
|
}
|
|
DataTable PreviousYearEosFeedbackRatingTable = new DataTable();
|
|
if (model.PreviousYearEosFeedbackRating != null)
|
|
{
|
|
PreviousYearEosFeedbackRatingTable = model.PreviousYearEosFeedbackRating.ToDataTable();
|
|
}
|
|
|
|
DataTable CurrentYearEosFeedbackRatingTableFinal = new DataTable();
|
|
if (CurrentYearEosFeedbackRatingTable.Rows.Count > 0)
|
|
{
|
|
CurrentYearEosFeedbackRatingTableFinal = GenerateTransposedTable(CurrentYearEosFeedbackRatingTable);
|
|
}
|
|
DataTable PreviousYearEosFeedbackRatingTableFinal = new DataTable();
|
|
if (PreviousYearEosFeedbackRatingTable.Rows.Count > 0)
|
|
{
|
|
PreviousYearEosFeedbackRatingTableFinal = GenerateTransposedTable(PreviousYearEosFeedbackRatingTable);
|
|
}
|
|
|
|
CurrentYearEosFeedbackRatingTableFinal.Columns.RemoveAt(0);
|
|
CurrentYearEosFeedbackRatingTableFinal.AcceptChanges();
|
|
|
|
PreviousYearEosFeedbackRatingTableFinal.Columns.RemoveAt(0);
|
|
PreviousYearEosFeedbackRatingTableFinal.AcceptChanges();
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(CurrentYearEosFeedbackTable);
|
|
ds.Tables.Add(PreviousYearEosFeedbackTable);
|
|
ds.Tables.Add(CurrentYearEosFeedbackRatingTableFinal);
|
|
ds.Tables.Add(PreviousYearEosFeedbackRatingTableFinal);
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Call Feedback Rating", StartColumnName = "B", StartRowNumber = 7, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[1].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[1].TableName, WorkSheetName = "Call Feedback Rating", StartColumnName = "L", StartRowNumber = 6, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[2].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[2].TableName, WorkSheetName = "Call Feedback Rating", StartColumnName = "D", StartRowNumber = 44, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[3].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[3].TableName, WorkSheetName = "Call Feedback Rating", StartColumnName = "S", StartRowNumber = 44, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "CallFeedbackRating_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["CallFeedbackRatingTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportCallFeedbackRating", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Reason for closure (>24)
|
|
|
|
/// <summary>
|
|
/// to show main page of Reason For Closure More Than 24 hrs, which consists filters
|
|
/// </summary>
|
|
/// <returns>main page of Reason For Closure More Than 24 hrs</returns>
|
|
public ActionResult ReasonForClosureMoreThan24()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// to show partial page of Reason For Closure More Than 24 hrs, which consists charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page of Reason For Closure More Than 24 hrs</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowReasonForClosureMoreThan24(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ReasonForClosureMoreThan24HrsHdLmd model = new ReasonForClosureMoreThan24HrsHdLmd();
|
|
model.HdLmdBusCallCLoserModel = oReportRepository.GetHdLmdCallClosure(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.ReasonCallClosedBeyond24Hrs = oReportRepository.GetCallClosureMoreThan24(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.ReasonCallClosedBeyond24HrsForChart = oReportRepository.GetCallClosureMoreThan24(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
if (model != null && model.HdLmdBusCallCLoserModel != null && model.ReasonCallClosedBeyond24Hrs != null && model.ReasonCallClosedBeyond24HrsForChart.ReasonWiseCallClosedBeyond24Hrs != null)
|
|
{
|
|
foreach (ReasonCallClosedBeyond24HrsList item in model.ReasonCallClosedBeyond24HrsForChart.ReasonWiseCallClosedBeyond24Hrs)
|
|
{
|
|
if (item.Reason.ToString().Length > 20)
|
|
{
|
|
string shortReason = item.Reason.ToString().Substring(0, 20);
|
|
item.Reason = shortReason + "..";
|
|
}
|
|
}
|
|
}
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowReasonForClosureMoreThan24", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Exports Reason For Closure More Than 24 hrs report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated file path</returns>
|
|
[HttpPost]
|
|
public string ExportReasonForClosureMoreThan24(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ReasonForClosureMoreThan24HrsHdLmd model = new ReasonForClosureMoreThan24HrsHdLmd();
|
|
model.HdLmdBusCallCLoserModel = oReportRepository.GetHdLmdCallClosure(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
model.ReasonCallClosedBeyond24Hrs = oReportRepository.GetCallClosureMoreThan24(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable HdLmdBusCallCLoserTable = new DataTable();
|
|
DataTable ReasonCallClosedBeyond24HrsTable = new DataTable();
|
|
if (model.HdLmdBusCallCLoserModel.HdLmdBusCallCLoser != null)
|
|
{
|
|
HdLmdBusCallCLoserTable = model.HdLmdBusCallCLoserModel.HdLmdBusCallCLoser.ToDataTable();
|
|
HdLmdBusCallCLoserTable.Columns.RemoveAt(4);
|
|
HdLmdBusCallCLoserTable.Columns.RemoveAt(4);
|
|
}
|
|
if (model.ReasonCallClosedBeyond24Hrs.ReasonWiseCallClosedBeyond24Hrs != null)
|
|
{
|
|
ReasonCallClosedBeyond24HrsTable = model.ReasonCallClosedBeyond24Hrs.ReasonWiseCallClosedBeyond24Hrs.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(HdLmdBusCallCLoserTable);
|
|
ds.Tables.Add(ReasonCallClosedBeyond24HrsTable);
|
|
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Reason for closure (>24)", StartColumnName = "B", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
if (ds.Tables[1].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[1].TableName, WorkSheetName = "Reason for closure (>24)", StartColumnName = "B", StartRowNumber = 35, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "ReasonForClosure_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["ReasonForClosureTemplate"].ToString()); ;
|
|
|
|
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportReasonForClosureMoreThan24", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Declined Calls
|
|
|
|
/// <summary>
|
|
/// To show main page Declined Calls report which consists of filters
|
|
/// </summary>
|
|
/// <returns>main page Declined Calls report</returns>
|
|
public ActionResult DeclinedCalls()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// To show partial page Declined Calls report which consists of charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page Declined Calls report</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowDeclinedCalls(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
DeclinedCalls model = new DeclinedCalls();
|
|
model = oReportRepository.GetDeclinedCalls(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowDeclinedCalls", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Exports Declined Calls report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated report path</returns>
|
|
[HttpPost]
|
|
public string ExportDeclinedCalls(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
DeclinedCalls model = new DeclinedCalls();
|
|
model = oReportRepository.GetDeclinedCalls(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable DeclinedCallsTable = new DataTable();
|
|
if (model.DeclinedReportsDealerWise != null)
|
|
{
|
|
DeclinedCallsTable = model.DeclinedReportsDealerWise.ToDataTable();
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(DeclinedCallsTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Timeslot Closure", StartColumnName = "B", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = false });
|
|
}
|
|
|
|
string filename = "DeclinedCalls_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["DeclinedCallsTemplate"].ToString()); ;
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportDeclinedCalls", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Eicher Promise
|
|
|
|
/// <summary>
|
|
/// To show main page Eicher Promise report which consists of filters
|
|
/// </summary>
|
|
/// <returns>main page Eicher promise report</returns>
|
|
public ActionResult EicherPromise()
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// To show partial page Eicher Promise report which consists of charts and tables
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>partial page Declined Calls report</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowEicherPromise(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
EicherPromiseModel model = new EicherPromiseModel();
|
|
model = oReportRepository.GetEicherPromiseReport(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEicherPromise", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Exports Eicher Promise report
|
|
/// </summary>
|
|
/// <param name="Token">security token</param>
|
|
/// <param name="UtcMinutes">UTC minutes</param>
|
|
/// <param name="UserId">user id</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <param name="state">state name</param>
|
|
/// <param name="city">city name</param>
|
|
/// <param name="dealerId">dealer id</param>
|
|
/// <returns>generated report path</returns>
|
|
[HttpPost]
|
|
public string ExportEicherPromise(int fromDate, int toDate, string state, string city, string dealerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(fromDate, 1, 1);
|
|
DateTime lastDayyear = new DateTime(fromDate, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
EicherPromiseModel model = new EicherPromiseModel();
|
|
model = oReportRepository.GetEicherPromiseReport(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, state, city, dealerId);
|
|
|
|
DataTable EicherPromiseTable = model.PromiseReportsList.ToDataTable();
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(EicherPromiseTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Eicher Promise", StartColumnName = "B", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = false });
|
|
|
|
string filename = "EicherPromise_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["EicherPromiseTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportEicherPromise", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Customer Report
|
|
|
|
/// <summary>
|
|
/// To show main page of Customer Report which consists of filters
|
|
/// </summary>
|
|
/// <returns>main page of Customer Report</returns>
|
|
public ActionResult CustomerReport()
|
|
{
|
|
string _LoginUserId = Session["UserId"].ToString();
|
|
string _timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Pager function which is used to get data for a particular page index
|
|
/// </summary>
|
|
/// <param name="dsr">Page object which contains pagesize and page index</param>
|
|
/// <param name="State">State</param>
|
|
/// <param name="Value">Value</param>
|
|
/// <param name="PageSize">PageSize</param>
|
|
/// <returns>new page which shows records according to current selected page number</returns>
|
|
public ActionResult Customer_Pager([DataSourceRequest] DataSourceRequest dsr, string State, string Value, string PageSize)
|
|
{
|
|
int lTtlRec = 0;
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
List<ManageOwner> oOwnerList = oReportRepository.GetOwnerList(State, Value, lPageSise + 1, (dsr.Page - 1) * lPageSise);
|
|
ViewData["State"] = State;
|
|
ViewData["Value"] = Value;
|
|
|
|
lTtlRec = dsr.Page * oOwnerList.Count();
|
|
|
|
if (oOwnerList.Count > lPageSise)
|
|
lTtlRec = (dsr.Page * lPageSise) + 1;
|
|
|
|
if (Convert.ToInt32(PageSize) > (dsr.Page * lPageSise))
|
|
{
|
|
ViewData["PageSize"] = Convert.ToInt32(PageSize);
|
|
}
|
|
else
|
|
{
|
|
ViewData["PageSize"] = lTtlRec;
|
|
}
|
|
var result = new DataSourceResult()
|
|
{
|
|
Data = oOwnerList, // Process data (paging and sorting applied)
|
|
Total = Convert.ToInt32(ViewData["PageSize"]) // Total number of records
|
|
};
|
|
|
|
return Json(result);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
/// <summary>
|
|
/// Get Owner List
|
|
/// </summary>
|
|
/// <returns>returns partial View oF Owner List</returns>
|
|
public ActionResult CustomerReport_GetOwnerList(string state, string FilterVal)
|
|
{
|
|
objLog.AddLogFile("CustomerReport_GetOwnerList", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
ViewData["State"] = state;
|
|
ViewData["Value"] = FilterVal;
|
|
int lTtlRec = 0;
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
List<ManageOwner> oOwnerList = oReportRepository.GetOwnerList(state, FilterVal, lPageSise + 1, 0);
|
|
lTtlRec = oOwnerList.Count;
|
|
lTtlRec = lTtlRec >= lPageSise ? lTtlRec : lPageSise;
|
|
ViewData["PageSize"] = lTtlRec;
|
|
var result = new DataSourceResult()
|
|
{
|
|
Data = oOwnerList, // Process data (paging and sorting applied)
|
|
Total = lTtlRec // Total number of records
|
|
};
|
|
return PartialView(oOwnerList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("CustomerReport_GetOwnerList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// To show partial page for Customer report which consists of charts and tables
|
|
/// </summary>
|
|
/// <param name="Year">Year</param>
|
|
/// <param name="State">State</param>
|
|
/// <param name="CustomerId">Customer Id</param>
|
|
/// <returns>partial page for Customer report</returns>
|
|
[HttpPost]
|
|
public ActionResult ShowCustomerReport(int Year, string State, string CustomerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(Year, 1, 1);
|
|
DateTime lastDayyear = new DateTime(Year, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
CustomerReportModel model = new CustomerReportModel();
|
|
model = oReportRepository.GetCustomerReport(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, State, CustomerId);
|
|
|
|
return PartialView(model.CustomerReportsList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowCustomerReport", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Exports Customer Report to Excel
|
|
/// </summary>
|
|
/// <param name="Year">Year</param>
|
|
/// <param name="State">State</param>
|
|
/// <param name="CustomerId">Customer Id</param>
|
|
/// <returns>path at which generated excel is stored</returns>
|
|
[HttpPost]
|
|
public string ExportCustomerReport(int Year, string State, string CustomerId)
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
// getting first and last date of a year
|
|
DateTime firstDayyear = new DateTime(Year, 1, 1);
|
|
DateTime lastDayyear = new DateTime(Year, 12, 31);
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
CustomerReportModel model = new CustomerReportModel();
|
|
model = oReportRepository.GetCustomerReport(_securityToken, _UtcMinutes, _LoginUserId, firstDayyear, lastDayyear, State, CustomerId);
|
|
|
|
DataTable CustomerListTable = model.CustomerReportsList.ToDataTable();
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(CustomerListTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Customer Report", StartColumnName = "B", StartRowNumber = 5, WorkSheetNumber = 1, AutoFit = true });
|
|
|
|
string filename = "CustomerReport_" + Convert.ToDateTime(firstDayyear).ToString("ddMMyyyy") + "_" + Convert.ToDateTime(lastDayyear).ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["CustomerReportTemplate"].ToString()); ;
|
|
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ExportCustomerReport", ex.Message, path, errorlogtf);
|
|
return "error";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Consolidated Report
|
|
|
|
/// <summary>
|
|
/// Get Consolidated Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult ConsolidatedReport()
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
|
|
//Getting Organization list user wise
|
|
List<OrganizationModel> oOrganizationList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> oOrganizationNameList = new List<SelectListItem>();
|
|
oOrganizationNameList.Add(new SelectListItem { Text = "All", Value = "" });
|
|
foreach (OrganizationModel items in oOrganizationList)
|
|
{
|
|
oOrganizationNameList.Add(new SelectListItem { Text = items.OrganizationName, Value = items.Id.ToString() });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View(oOrganizationNameList.OrderBy(o => o.Text));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show Consolidated Report grid with chart
|
|
/// </summary>
|
|
/// <param name="userId">User ID</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>return table</returns>
|
|
public ActionResult ConsolidatedReport_Grid(string userId, string startDate, string endDate, string organization, string vehicleTagging, string filterType,string consolidate_type)
|
|
{
|
|
objLog.AddLogFile("Reports_ConsolidatedReport_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Convert date into datetime format
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Get consolidated report data
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, _pageSize, 0, "data", null, organization, vehicleTagging, filterType, consolidate_type);
|
|
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
List<ConsolidatedReportTimeSlot> oCountTicketCloseInTimeSlotList = new List<ConsolidatedReportTimeSlot>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
|
|
foreach (var item in oList)
|
|
{
|
|
item.complaints = (item.complaints == null) ? "" : ("<ol><li>" + item.complaints + "</li></ol>");
|
|
item.suggestion = (item.suggestion == null) ? "" : ("<ol><li>" + item.suggestion + "</li></ol>");
|
|
if (item.complaints.IndexOf(",") != -1)
|
|
{
|
|
item.complaints = item.complaints.Replace(@",", @"</li><li>");
|
|
// item.complaints = "<ol><li>" + item.complaints + "</li></ol>";
|
|
}
|
|
if (item.suggestion.IndexOf(",") != -1)
|
|
{
|
|
item.suggestion = item.suggestion.Replace(@",", @"</li><li>");
|
|
//item.suggestion = "<ol><li>" + item.suggestion + "</li></ol>";
|
|
}
|
|
}
|
|
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType, consolidate_type);
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = totalCount;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
ViewBag.organization = organization;
|
|
ViewBag.vehicleTagging = vehicleTagging;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_ConsolidatedReport_Grid", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Server side paging on consolidated report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>return list of consolidated report</returns>
|
|
public ActionResult ConsolidatedReport_Pager([DataSourceRequest] DataSourceRequest request, string userId, string startDate, string endDate, int total, string organization, string vehicleTagging,string filterType)
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string query = null;
|
|
if (request.Filters.Count > 0)
|
|
{
|
|
// extract filter from request
|
|
var filterData = (System.Web.HttpContext.Current.Request.Params["filter"]);
|
|
// get query from filter object,
|
|
query = FilterKendoGrid.CreateFilterQuery(filterData);
|
|
}
|
|
objReportRepository = new ReportRepository();
|
|
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedData(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), "data", query, organization, vehicleTagging, filterType, "old");
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
|
|
|
|
foreach (var item in oList)
|
|
{
|
|
item.complaints = (item.complaints == null) ? "" : ("<ol><li>" + item.complaints + "</li></ol>");
|
|
item.suggestion = (item.suggestion == null) ? "" : ("<ol><li>" + item.suggestion + "</li></ol>");
|
|
if (item.complaints.IndexOf(",") != -1)
|
|
{
|
|
item.complaints = item.complaints.Replace(@",", @"</li><li>");
|
|
// item.complaints = "<ol><li>" + item.complaints + "</li></ol>";
|
|
}
|
|
if (item.suggestion.IndexOf(",") != -1)
|
|
{
|
|
item.suggestion = item.suggestion.Replace(@",", @"</li><li>");
|
|
//item.suggestion = "<ol><li>" + item.suggestion + "</li></ol>";
|
|
}
|
|
}
|
|
|
|
#region Get Time Slot from controller
|
|
//string ticketCreationDateTime = "", ticketCreationTime = "";
|
|
//foreach (var item in oList)
|
|
//{
|
|
// ticketCreationDateTime = item.creation_time;
|
|
// string[] split_ticketCreationDateTime = ticketCreationDateTime.Split(' ');
|
|
// ticketCreationTime = split_ticketCreationDateTime[3];
|
|
|
|
// for (var count = 0; count < 12; count++)
|
|
// {
|
|
// if ((DateTime.Parse("01/01/0001 " + ticketCreationTime) > DateTime.Parse("01/01/0001 " + (2 * count) + ":00:00")) && (DateTime.Parse("01/01/0001 " + ticketCreationTime) < DateTime.Parse("01/01/0001 " + ((2 * count) + 1) + ":59:59")))
|
|
// {
|
|
// item.time_slot = "Between " + (2 * count) + " and " + ((2 * count) + 2);
|
|
// break;
|
|
// }
|
|
// }
|
|
//}
|
|
#endregion
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(userId, startDate, endDate, _pageSize, 0, "count", query, organization, vehicleTagging, filterType,"old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
DataSourceResult result = oList.ToDataSourceResult(request);
|
|
result.Total = totalCount;
|
|
result.Data = oList;
|
|
return Json(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport_Pager", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Export to excel consolidated Report
|
|
/// </summary>
|
|
/// <param name="UserId">Login user id</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>Returns excel file</returns>
|
|
[HttpPost]
|
|
public string ConsolidatedReport_ExportToExcel(string UserId, string startDate, string endDate, string organization, string vehicleTagging,string filterType)
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport_ExportToExcel", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string filename = null;
|
|
objReportRepository = new ReportRepository();
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(UserId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType, "old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
//Get consolidated report data
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedData(UserId, fromDate, toDate, totalCount, 0, "data", null, organization, vehicleTagging, filterType, "old");
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
string ticketCreationDateTime = "", ticketCreationTime = "";
|
|
foreach (var item in oList)
|
|
{
|
|
ticketCreationDateTime = item.creation_time;
|
|
string[] split_ticketCreationDateTime = ticketCreationDateTime.Split(' ');
|
|
ticketCreationTime = split_ticketCreationDateTime[3];
|
|
|
|
for (var count = 0; count < 12; count++)
|
|
{
|
|
if ((DateTime.Parse("01/01/0001 " + ticketCreationTime) >= DateTime.Parse("01/01/0001 " + (2 * count) + ":00:00")) && (DateTime.Parse("01/01/0001 " + ticketCreationTime) <= DateTime.Parse("01/01/0001 " + ((2 * count) + 1) + ":59:59")))
|
|
{
|
|
item.time_slot = (2 * count) + ":00 - " + ((2 * count) + 2) + ":00";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
DataTable ConsolidatedDataTable = oList.ToDataTable();
|
|
Int32 ConsolidatedDataTableColumnCount = ConsolidatedDataTable.Columns.Count - 1;
|
|
for (var count = ConsolidatedDataTableColumnCount; count >= 55; count--)
|
|
{
|
|
ConsolidatedDataTable.Columns.RemoveAt(count);
|
|
}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(ConsolidatedDataTable);
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
filename = "ConsolidatedReport_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Consolidated Report", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
|
|
string templatePath = Server.MapPath(ConfigurationManager.AppSettings["ConsolidatedReportTemplate"].ToString()); ;
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport_ExportToExcel", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Export to excel consolidated Report
|
|
/// </summary>
|
|
/// <param name="UserId">Login user id</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>Returns excel file</returns>
|
|
[HttpPost]
|
|
public string ConsolidatedReport_ExportToCSV(string UserId, string startDate, string endDate, string organization, string vehicleTagging,string filterType)
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport_ExportToCSV", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string fileName = null;
|
|
objReportRepository = new ReportRepository();
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//List<string> columnNames = new List<string>();
|
|
|
|
//PropertyInfo[] propInfoList = typeof(ConsolidatedReportModel).GetProperties();
|
|
//foreach (PropertyInfo propInfo in propInfoList)
|
|
//{
|
|
// columnNames.Add(Helper.DisplayNameHelper.GetDisplayName(propInfo));
|
|
//}
|
|
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(UserId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType, "old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
//Get consolidated report data
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedData(UserId, fromDate, toDate, totalCount, 0, "data", null, organization, vehicleTagging, filterType, "old");
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
string ticketCreationDateTime = "", ticketCreationTime = "";
|
|
foreach (var item in oList)
|
|
{
|
|
ticketCreationDateTime = item.creation_time;
|
|
string[] split_ticketCreationDateTime = ticketCreationDateTime.Split(' ');
|
|
ticketCreationTime = split_ticketCreationDateTime[3];
|
|
|
|
for (var count = 0; count < 12; count++)
|
|
{
|
|
if ((DateTime.Parse("01/01/0001 " + ticketCreationTime) >= DateTime.Parse("01/01/0001 " + (2 * count) + ":00:00")) && (DateTime.Parse("01/01/0001 " + ticketCreationTime) <= DateTime.Parse("01/01/0001 " + ((2 * count) + 1) + ":59:59")))
|
|
{
|
|
item.time_slot = (2 * count) + ":00 - " + ((2 * count) + 2) + ":00";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
DataTable ConsolidatedDataTable = oList.ToDataTable();
|
|
//Int32 ConsolidatedDataTableColumnCount = ConsolidatedDataTable.Columns.Count;
|
|
|
|
//for (var count = ConsolidatedDataTableColumnCount; count >= 105; count--)
|
|
//{
|
|
// ConsolidatedDataTable.Columns.RemoveAt(count);
|
|
//}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(ConsolidatedDataTable);
|
|
ds.Tables[0].Columns[67].SetOrdinal(14);
|
|
//Give column names
|
|
ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Assigned To";
|
|
ds.Tables[0].Columns[2].ColumnName = "Created By";
|
|
ds.Tables[0].Columns[3].ColumnName = "Creation Time";
|
|
ds.Tables[0].Columns[4].ColumnName = "Time Slot";
|
|
ds.Tables[0].Columns[5].ColumnName = "Customer Name";
|
|
ds.Tables[0].Columns[6].ColumnName = "Customer Contact No.";
|
|
ds.Tables[0].Columns[7].ColumnName = "Organization";
|
|
ds.Tables[0].Columns[8].ColumnName = "State";
|
|
ds.Tables[0].Columns[9].ColumnName = "City";
|
|
ds.Tables[0].Columns[10].ColumnName = "Language";
|
|
ds.Tables[0].Columns[11].ColumnName = "Vehicle Owner Name";
|
|
ds.Tables[0].Columns[12].ColumnName = "Vehicle Owner Contact No.";
|
|
ds.Tables[0].Columns[13].ColumnName = "Vehicle Reg No.";
|
|
ds.Tables[0].Columns[14].ColumnName = "Chassis Number";
|
|
ds.Tables[0].Columns[15].ColumnName = "Vehicle Model";
|
|
ds.Tables[0].Columns[16].ColumnName = "Vehicle Type";
|
|
ds.Tables[0].Columns[17].ColumnName = "Vehicle Chassis No.";
|
|
ds.Tables[0].Columns[18].ColumnName = "Vehicle Installation Date";
|
|
ds.Tables[0].Columns[19].ColumnName = "Vehicle Breakdown Location";
|
|
ds.Tables[0].Columns[20].ColumnName = "Landmark";
|
|
ds.Tables[0].Columns[21].ColumnName = "Warranty";
|
|
ds.Tables[0].Columns[22].ColumnName = "Source of Toll Free No.";
|
|
ds.Tables[0].Columns[23].ColumnName = "Type of Load Carrying";
|
|
ds.Tables[0].Columns[24].ColumnName = "Nature of Problem";
|
|
ds.Tables[0].Columns[25].ColumnName = "Estimated Cost";
|
|
ds.Tables[0].Columns[26].ColumnName = "Estimated Time (In minutes)";
|
|
ds.Tables[0].Columns[27].ColumnName = "Dealer SCode";
|
|
ds.Tables[0].Columns[28].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[29].ColumnName = "WM Name";
|
|
ds.Tables[0].Columns[30].ColumnName = "Dealer Contact No.";
|
|
ds.Tables[0].Columns[31].ColumnName = "EOS VAN Registration Number";
|
|
ds.Tables[0].Columns[32].ColumnName = "Call Open (HH:MM:SS)";
|
|
//ds.Tables[0].Columns[33].ColumnName = "Ticket Accepted"; //commented on 14-12-2020
|
|
ds.Tables[0].Columns[34].ColumnName = "Van Reached";
|
|
ds.Tables[0].Columns[35].ColumnName = "Call Preclosed";
|
|
ds.Tables[0].Columns[36].ColumnName = "Call Closure";
|
|
ds.Tables[0].Columns[37].ColumnName = "Escalation - Van Not Moving";
|
|
ds.Tables[0].Columns[38].ColumnName = "Escalation - Ticket Closure";
|
|
ds.Tables[0].Columns[39].ColumnName = "Call Closed < 24 Hrs";
|
|
ds.Tables[0].Columns[40].ColumnName = "KM Covered Breakdown's Vehicle";
|
|
ds.Tables[0].Columns[41].ColumnName = "Feedback";
|
|
ds.Tables[0].Columns[42].ColumnName = "Feedback Score - Ease of Getting Call Centre";
|
|
ds.Tables[0].Columns[43].ColumnName = "Feedback Score - Response of Call Centre";
|
|
ds.Tables[0].Columns[44].ColumnName = "Feedback Score - Timely Updation by Dealer";
|
|
ds.Tables[0].Columns[45].ColumnName = "Feedback Score - Total Repair Time";
|
|
ds.Tables[0].Columns[46].ColumnName = "Feedback Score - EOS Charges";
|
|
ds.Tables[0].Columns[47].ColumnName = "Feedback Score - Over All Experience";
|
|
ds.Tables[0].Columns[48].ColumnName = "Closure Remarks";
|
|
ds.Tables[0].Columns[49].ColumnName = "Response(In min)";
|
|
ds.Tables[0].Columns[50].ColumnName = "Feedback Count";
|
|
ds.Tables[0].Columns[51].ColumnName = "Feedback Call Status";
|
|
ds.Tables[0].Columns[52].ColumnName = "Feedback Suggestions";
|
|
ds.Tables[0].Columns[53].ColumnName = "Feedback Complaints";
|
|
ds.Tables[0].Columns[54].ColumnName = "Feedback Agent";
|
|
ds.Tables[0].Columns[55].ColumnName = "Reason for Ticket assigned to Dealer";
|
|
ds.Tables[0].Columns[56].ColumnName = "Other Reason for Ticket assigned to Dealer";
|
|
ds.Tables[0].Columns[57].ColumnName = "Estimated Distance (In KM)";
|
|
ds.Tables[0].Columns[58].ColumnName = "EOS Van Actual Distance Traveled (In KM)";
|
|
ds.Tables[0].Columns[59].ColumnName = "EOS Van Trip Start Time";
|
|
ds.Tables[0].Columns[60].ColumnName = "EOS Van Trip End Time";
|
|
ds.Tables[0].Columns[61].ColumnName = "Eicher Promise";
|
|
ds.Tables[0].Columns[62].ColumnName = "Opportunity Loss";
|
|
ds.Tables[0].Columns[63].ColumnName = "Opportunity Loss Reason";
|
|
ds.Tables[0].Columns[64].ColumnName = "Opportunity Loss Remark";
|
|
ds.Tables[0].Columns[65].ColumnName = "Delayed Reason";
|
|
ds.Tables[0].Columns[66].ColumnName = "Delayed Remark";
|
|
ds.Tables[0].Columns[67].ColumnName = "Re Open Count";
|
|
ds.Tables[0].Columns[68].ColumnName = "Odometer Reading";
|
|
ds.Tables[0].Columns[74].ColumnName = "Ticket Accepted";
|
|
ds.Tables[0].Columns[102].ColumnName = "Reassignment Date and Time";
|
|
//commented to hold feedback cr
|
|
//ds.Tables[0].Columns[103].ColumnName = "Overall Customer Satisfied";
|
|
//ds.Tables[0].Columns[104].ColumnName = "Reason for dissatisfaction";
|
|
//ds.Tables[0].Columns[105].ColumnName = "Feedback Comments";
|
|
ds.Tables[0].Columns[106].ColumnName = "Response time(Reassignment)";
|
|
//added on 14-12-2020
|
|
ds.Tables[0].Columns[107].ColumnName = "Vehicle Warranty";
|
|
ds.Tables[0].Columns[108].ColumnName = "Vehicle Amc";
|
|
ds.Tables[0].Columns[109].ColumnName = "Vehicle Emission Norms ";
|
|
ds.Tables[0].Columns[110].ColumnName = "Vehicle Sales Date";
|
|
//ds.Tables[0].Columns[111].ColumnName = "Van Reach By Call Center"; //added on 19-01-2021
|
|
|
|
ds.Tables[0].Columns[111].ColumnName = "Ticket closed reason";
|
|
|
|
|
|
|
|
ds.Tables[0].Columns.Remove("Vehicle Chassis No.");
|
|
ds.Tables[0].Columns.Remove("total_outbound_calls");
|
|
//added on 14-12-2020
|
|
ds.Tables[0].Columns.Remove("time_stamps_status_1");
|
|
//ds.Tables[0].Columns.Remove("time_stamps_status_2");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_2");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_3");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_4");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_5");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_6");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_7");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_8");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_9");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_10");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_2");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_3");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_4");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_5");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_6");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_7");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_8");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_9");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_10");
|
|
ds.Tables[0].Columns.Remove("month_name");
|
|
ds.Tables[0].Columns.Remove("default_sla_time");
|
|
ds.Tables[0].Columns.Remove("region");
|
|
ds.Tables[0].Columns.Remove("vehicle_model");
|
|
ds.Tables[0].Columns.Remove("CloseTicketCountInTimeSlot");
|
|
ds.Tables[0].Columns.Remove("estimated_time");
|
|
ds.Tables[0].Columns.Remove("response");
|
|
ds.Tables[0].Columns.Remove("estimated_cost");
|
|
ds.Tables[0].Columns.Remove("ticket_id");
|
|
//added to hold feedback cr
|
|
ds.Tables[0].Columns.Remove("are_you_satisfied");
|
|
ds.Tables[0].Columns.Remove("not_satisfied_option");
|
|
ds.Tables[0].Columns.Remove("not_satisfied_reason");
|
|
ds.Tables[0].Columns.Remove("Ticket closed reason"); //added on 20-01-2021
|
|
|
|
|
|
//fileName = "ConsolidatedReport_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".csv";
|
|
//string SaveCsEOS = Server.MapPath(_excelExportPathOnServer + fileName);
|
|
//bool isCreated = DataTableToCSV(ds.Tables[0], SaveCsvAs);
|
|
//if (isCreated == true) { return _exportLocation + fileName; }
|
|
//else { return "error"; }
|
|
|
|
fileName = "ConsolidatedReport_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string SaveCsvAs = Server.MapPath(_excelExportPathOnServer + fileName);
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, SaveCsvAs);
|
|
if (isCreated == true) { return _exportLocation + fileName; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport_ExportToCSV", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Created new function on 07-10-2020 to download consolidate report (modified function)
|
|
/// </summary>
|
|
/// <param name="UserId"></param>
|
|
/// <param name="startDate"></param>
|
|
/// <param name="endDate"></param>
|
|
/// <param name="organization"></param>
|
|
/// <param name="vehicleTagging"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public string ConsolidatedReport_ExportToCSV_New(string UserId, string startDate, string endDate, string organization, string vehicleTagging,string filterType)
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport_ExportToCSV", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
|
|
string fileName = null;
|
|
objReportRepository = new ReportRepository();
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//List<string> columnNames = new List<string>();
|
|
|
|
//PropertyInfo[] propInfoList = typeof(ConsolidatedReportModel).GetProperties();
|
|
//foreach (PropertyInfo propInfo in propInfoList)
|
|
//{
|
|
// columnNames.Add(Helper.DisplayNameHelper.GetDisplayName(propInfo));
|
|
//}
|
|
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(UserId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType, "old");
|
|
|
|
Int32 totalCount = 0;
|
|
totalCount = oConsolidatedReportCount.FirstOrDefault().TicketCount;
|
|
//foreach (var item in oConsolidatedReportCount)
|
|
//{
|
|
// totalCount = item.TicketCount;
|
|
//}
|
|
|
|
//consolidate report download changes
|
|
//Get consolidated report data
|
|
ReportOpenTicketModel oConsolidatedReportList = objReportRepository.GetConsolidatedDataForDownloadCSV(UserId, fromDate, toDate, totalCount, 0, "data", null, organization, vehicleTagging);
|
|
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
|
|
oList = oConsolidatedReportList.ConsolidatedReportModelList;
|
|
|
|
//ConsolidatedReportModel ServiceInfo = JsonConvert.DeserializeObject<ConsolidatedReportModel>(oConsolidatedReportList);
|
|
//ConsolidatedReportModel list=JsonConvert.DeserializeObject<List<ConsolidatedReportModel>>(oConsolidatedReportList);
|
|
|
|
|
|
//foreach (var item in oConsolidatedReportList)
|
|
//{
|
|
// oList.Add(item.ToObject<ConsolidatedReportModel>());
|
|
//}
|
|
|
|
|
|
//consolidate report download changes
|
|
string ticketCreationDateTime = "", ticketCreationTime = "";
|
|
foreach (var item in oList)
|
|
{
|
|
ticketCreationDateTime = item.creation_time;
|
|
string[] split_ticketCreationDateTime = ticketCreationDateTime.Split(' ');
|
|
ticketCreationTime = split_ticketCreationDateTime[3];
|
|
|
|
for (var count = 0; count < 12; count++)
|
|
{
|
|
if ((DateTime.Parse("01/01/0001 " + ticketCreationTime) >= DateTime.Parse("01/01/0001 " + (2 * count) + ":00:00")) && (DateTime.Parse("01/01/0001 " + ticketCreationTime) <= DateTime.Parse("01/01/0001 " + ((2 * count) + 1) + ":59:59")))
|
|
{
|
|
item.time_slot = (2 * count) + ":00 - " + ((2 * count) + 2) + ":00";
|
|
break;
|
|
}
|
|
}
|
|
item.ChassisNo = item.chassis_number;
|
|
}
|
|
|
|
DataTable ConsolidatedDataTable = oList.ToDataTable();
|
|
|
|
//Int32 ConsolidatedDataTableColumnCount = ConsolidatedDataTable.Columns.Count;
|
|
|
|
//for (var count = ConsolidatedDataTableColumnCount; count >= 105; count--)
|
|
//{
|
|
// ConsolidatedDataTable.Columns.RemoveAt(count);
|
|
//}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(ConsolidatedDataTable);
|
|
ds.Tables[0].Columns[67].SetOrdinal(14);
|
|
//Give column names
|
|
ds.Tables[0].Columns[0].ColumnName = "Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Assigned To";
|
|
ds.Tables[0].Columns[2].ColumnName = "Created By";
|
|
ds.Tables[0].Columns[3].ColumnName = "Creation Time";
|
|
ds.Tables[0].Columns[4].ColumnName = "Time Slot";
|
|
ds.Tables[0].Columns[5].ColumnName = "Customer Name";
|
|
ds.Tables[0].Columns[6].ColumnName = "Customer Contact No.";
|
|
ds.Tables[0].Columns[7].ColumnName = "Organization";
|
|
ds.Tables[0].Columns[8].ColumnName = "State";
|
|
ds.Tables[0].Columns[9].ColumnName = "City";
|
|
ds.Tables[0].Columns[10].ColumnName = "Language";
|
|
ds.Tables[0].Columns[11].ColumnName = "Vehicle Owner Name";
|
|
ds.Tables[0].Columns[12].ColumnName = "Vehicle Owner Contact No.";
|
|
ds.Tables[0].Columns[13].ColumnName = "Vehicle Reg No.";
|
|
ds.Tables[0].Columns[14].ColumnName = "Chassis Number";
|
|
ds.Tables[0].Columns[15].ColumnName = "Vehicle Model";
|
|
ds.Tables[0].Columns[16].ColumnName = "Vehicle Type";
|
|
ds.Tables[0].Columns[17].ColumnName = "Vehicle Chassis No.";
|
|
ds.Tables[0].Columns[18].ColumnName = "Vehicle Installation Date";
|
|
ds.Tables[0].Columns[19].ColumnName = "Vehicle Breakdown Location";
|
|
ds.Tables[0].Columns[20].ColumnName = "Landmark";
|
|
ds.Tables[0].Columns[21].ColumnName = "Warranty";
|
|
ds.Tables[0].Columns[22].ColumnName = "Source of Toll Free No.";
|
|
ds.Tables[0].Columns[23].ColumnName = "Type of Load Carrying";
|
|
ds.Tables[0].Columns[24].ColumnName = "Nature of Problem";
|
|
ds.Tables[0].Columns[25].ColumnName = "Estimated Cost";
|
|
ds.Tables[0].Columns[26].ColumnName = "Estimated Time (In minutes)";
|
|
ds.Tables[0].Columns[27].ColumnName = "Dealer SCode";
|
|
ds.Tables[0].Columns[28].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[29].ColumnName = "WM Name";
|
|
ds.Tables[0].Columns[30].ColumnName = "Dealer Contact No.";
|
|
ds.Tables[0].Columns[31].ColumnName = "EOS VAN Registration Number";
|
|
ds.Tables[0].Columns[32].ColumnName = "Call Open (HH:MM:SS)";
|
|
//ds.Tables[0].Columns[33].ColumnName = "Ticket Accepted";
|
|
//ds.Tables[0].Columns[34].ColumnName = "Van Reached";
|
|
//ds.Tables[0].Columns[35].ColumnName = "Call Preclosed";
|
|
//ds.Tables[0].Columns[36].ColumnName = "Call Closure";
|
|
//ds.Tables[0].Columns[37].ColumnName = "Escalation - Van Not Moving";
|
|
//ds.Tables[0].Columns[38].ColumnName = "Escalation - Ticket Closure";
|
|
//ds.Tables[0].Columns[39].ColumnName = "Call Closed < 24 Hrs";
|
|
//ds.Tables[0].Columns[40].ColumnName = "KM Covered Breakdown's Vehicle";
|
|
//ds.Tables[0].Columns[41].ColumnName = "Feedback";
|
|
//ds.Tables[0].Columns[42].ColumnName = "Feedback Score - Ease of Getting Call Centre";
|
|
//ds.Tables[0].Columns[43].ColumnName = "Feedback Score - Response of Call Centre";
|
|
//ds.Tables[0].Columns[44].ColumnName = "Feedback Score - Timely Updation by Dealer";
|
|
//ds.Tables[0].Columns[45].ColumnName = "Feedback Score - Total Repair Time";
|
|
//ds.Tables[0].Columns[46].ColumnName = "Feedback Score - EOS Charges";
|
|
//ds.Tables[0].Columns[47].ColumnName = "Feedback Score - Over All Experience";
|
|
//ds.Tables[0].Columns[48].ColumnName = "Closure Remarks";
|
|
//ds.Tables[0].Columns[49].ColumnName = "Response(In min)";
|
|
//ds.Tables[0].Columns[50].ColumnName = "Feedback Count";
|
|
//ds.Tables[0].Columns[51].ColumnName = "Feedback Call Status";
|
|
//ds.Tables[0].Columns[52].ColumnName = "Feedback Suggestions";
|
|
//ds.Tables[0].Columns[53].ColumnName = "Feedback Complaints";
|
|
//ds.Tables[0].Columns[54].ColumnName = "Feedback Agent";
|
|
//ds.Tables[0].Columns[55].ColumnName = "Reason for Ticket assigned to Dealer";
|
|
//ds.Tables[0].Columns[56].ColumnName = "Other Reason for Ticket assigned to Dealer";
|
|
//ds.Tables[0].Columns[57].ColumnName = "Estimated Distance (In KM)";
|
|
//ds.Tables[0].Columns[58].ColumnName = "EOS Van Actual Distance Traveled (In KM)";
|
|
//ds.Tables[0].Columns[59].ColumnName = "EOS Van Trip Start Time";
|
|
//ds.Tables[0].Columns[60].ColumnName = "EOS Van Trip End Time";
|
|
//ds.Tables[0].Columns[61].ColumnName = "Eicher Promise";
|
|
//ds.Tables[0].Columns[62].ColumnName = "Opportunity Loss";
|
|
//ds.Tables[0].Columns[63].ColumnName = "Opportunity Loss Reason";
|
|
//ds.Tables[0].Columns[64].ColumnName = "Opportunity Loss Remark";
|
|
//ds.Tables[0].Columns[65].ColumnName = "Delayed Reason";
|
|
//ds.Tables[0].Columns[66].ColumnName = "Delayed Remark";
|
|
//ds.Tables[0].Columns[67].ColumnName = "Re Open Count";
|
|
//ds.Tables[0].Columns[68].ColumnName = "Odometer Reading";
|
|
//ds.Tables[0].Columns[102].ColumnName = "Reassignment Date and Time";
|
|
////commented to hold feedback cr
|
|
////ds.Tables[0].Columns[103].ColumnName = "Overall Customer Satisfied";
|
|
////ds.Tables[0].Columns[104].ColumnName = "Reason for dissatisfaction";
|
|
////ds.Tables[0].Columns[105].ColumnName = "Feedback Comments";
|
|
//ds.Tables[0].Columns[106].ColumnName = "Response time(Reassignment)";
|
|
////added on 14-12-2020
|
|
//ds.Tables[0].Columns[107].ColumnName = "Vehicle Warranty";
|
|
//ds.Tables[0].Columns[108].ColumnName = "Vehicle Amc";
|
|
//ds.Tables[0].Columns[109].ColumnName = "Vehicle Emission Norms ";
|
|
//ds.Tables[0].Columns[110].ColumnName = "Vehicle Sales Date";
|
|
//ds.Tables[0].Columns[111].ColumnName = "Ticket closed reason";
|
|
|
|
//ds.Tables[0].Columns[34].ColumnName = "Ticket Accepted";
|
|
//ds.Tables[0].Columns[35].ColumnName = "Van Reached";
|
|
//ds.Tables[0].Columns[36].ColumnName = "Call Preclosed";
|
|
//ds.Tables[0].Columns[37].ColumnName = "Call Closure";
|
|
//ds.Tables[0].Columns[38].ColumnName = "Escalation - Van Not Moving";
|
|
//ds.Tables[0].Columns[39].ColumnName = "Escalation - Ticket Closure";
|
|
//ds.Tables[0].Columns[40].ColumnName = "Call Closed < 24 Hrs";
|
|
//ds.Tables[0].Columns[41].ColumnName = "KM Covered Breakdown's Vehicle";
|
|
//ds.Tables[0].Columns[42].ColumnName = "Feedback";
|
|
//ds.Tables[0].Columns[43].ColumnName = "Feedback Score - Ease of Getting Call Centre";
|
|
//ds.Tables[0].Columns[44].ColumnName = "Feedback Score - Response of Call Centre";
|
|
//ds.Tables[0].Columns[45].ColumnName = "Feedback Score - Timely Updation by Dealer";
|
|
//ds.Tables[0].Columns[46].ColumnName = "Feedback Score - Total Repair Time";
|
|
//ds.Tables[0].Columns[47].ColumnName = "Feedback Score - EOS Charges";
|
|
//ds.Tables[0].Columns[48].ColumnName = "Feedback Score - Over All Experience";
|
|
//ds.Tables[0].Columns[49].ColumnName = "Closure Remarks";
|
|
//ds.Tables[0].Columns[50].ColumnName = "Response(In min)";
|
|
//ds.Tables[0].Columns[51].ColumnName = "Feedback Count";
|
|
//ds.Tables[0].Columns[52].ColumnName = "Feedback Call Status";
|
|
//ds.Tables[0].Columns[53].ColumnName = "Feedback Suggestions";
|
|
//ds.Tables[0].Columns[54].ColumnName = "Feedback Complaints";
|
|
//ds.Tables[0].Columns[55].ColumnName = "Feedback Agent";
|
|
//ds.Tables[0].Columns[56].ColumnName = "Reason for Ticket assigned to Dealer";
|
|
//ds.Tables[0].Columns[57].ColumnName = "Other Reason for Ticket assigned to Dealer";
|
|
//ds.Tables[0].Columns[58].ColumnName = "Estimated Distance (In KM)";
|
|
//ds.Tables[0].Columns[59].ColumnName = "EOS Van Actual Distance Traveled (In KM)";
|
|
//ds.Tables[0].Columns[60].ColumnName = "EOS Van Trip Start Time";
|
|
//ds.Tables[0].Columns[61].ColumnName = "EOS Van Trip End Time";
|
|
//ds.Tables[0].Columns[62].ColumnName = "Eicher Promise";
|
|
//ds.Tables[0].Columns[63].ColumnName = "Opportunity Loss";
|
|
//ds.Tables[0].Columns[64].ColumnName = "Opportunity Loss Reason";
|
|
//ds.Tables[0].Columns[65].ColumnName = "Opportunity Loss Remark";
|
|
//ds.Tables[0].Columns[66].ColumnName = "Delayed Reason";
|
|
//ds.Tables[0].Columns[67].ColumnName = "Delayed Remark";
|
|
//ds.Tables[0].Columns[68].ColumnName = "Re Open Count";
|
|
//ds.Tables[0].Columns[69].ColumnName = "Odometer Reading";
|
|
//ds.Tables[0].Columns[102].ColumnName = "Reassignment Date and Time";
|
|
////commented to hold fedback cr
|
|
////ds.Tables[0].Columns103].ColumnName = "Overall Customer Satisfied";
|
|
////ds.Tables[0].Columns104].ColumnName = "Reason for dissatisfaction";
|
|
////ds.Tables[0].Columns105].ColumnName = "Feedback Comments";
|
|
//ds.Tables[0].Columns[106].ColumnName = "Response time(Reassignment)";
|
|
////added on 14-12-2020
|
|
//ds.Tables[0].Columns[107].ColumnName = "Vehicle Warranty";
|
|
//ds.Tables[0].Columns[108].ColumnName = "Vehicle Amc";
|
|
//ds.Tables[0].Columns[109].ColumnName = "Vehicle Emission Norms ";
|
|
//ds.Tables[0].Columns[110].ColumnName = "Vehicle Sales Date";
|
|
|
|
////ds.Tables[0].Columns[111].ColumnName = "Van Reached Punch In Time"; //added on 23-12-2020
|
|
|
|
//ds.Tables[0].Columns[111].ColumnName = "Ticket closed reason"; //change column number on 20-01-2021
|
|
|
|
|
|
//ds.Tables[0].Columns.Remove("Vehicle Chassis No.");
|
|
//ds.Tables[0].Columns.Remove("total_outbound_calls");
|
|
////added on 14-12-2020
|
|
//ds.Tables[0].Columns.Remove("time_stamps_status_1");
|
|
////ds.Tables[0].Columns.Remove("time_stamps_status_2");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_2");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_3");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_4");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_5");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_6");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_7");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_8");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_9");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_van_not_move_10");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_2");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_3");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_4");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_5");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_6");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_7");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_8");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_9");
|
|
//ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_10");
|
|
//ds.Tables[0].Columns.Remove("month_name");
|
|
//ds.Tables[0].Columns.Remove("default_sla_time");
|
|
//ds.Tables[0].Columns.Remove("region");
|
|
//ds.Tables[0].Columns.Remove("vehicle_model");
|
|
//ds.Tables[0].Columns.Remove("CloseTicketCountInTimeSlot");
|
|
//ds.Tables[0].Columns.Remove("estimated_time");
|
|
//ds.Tables[0].Columns.Remove("response");
|
|
//ds.Tables[0].Columns.Remove("estimated_cost");
|
|
//ds.Tables[0].Columns.Remove("ticket_id");
|
|
////added to hold feedback cr
|
|
//ds.Tables[0].Columns.Remove("are_you_satisfied");
|
|
//ds.Tables[0].Columns.Remove("not_satisfied_option");
|
|
//ds.Tables[0].Columns.Remove("not_satisfied_reason");
|
|
//ds.Tables[0].Columns.Remove("Ticket closed reason"); //added on 20-01-2021
|
|
|
|
ds.Tables[0].Columns[34].ColumnName = "Van Reached";
|
|
ds.Tables[0].Columns[35].ColumnName = "Call Preclosed";
|
|
ds.Tables[0].Columns[36].ColumnName = "Call Closure";
|
|
ds.Tables[0].Columns[37].ColumnName = "Escalation - Van Not Moving";
|
|
ds.Tables[0].Columns[38].ColumnName = "Escalation - Ticket Closure";
|
|
ds.Tables[0].Columns[39].ColumnName = "Call Closed < 24 Hrs";
|
|
ds.Tables[0].Columns[40].ColumnName = "KM Covered Breakdown's Vehicle";
|
|
ds.Tables[0].Columns[41].ColumnName = "Feedback";
|
|
ds.Tables[0].Columns[42].ColumnName = "Feedback Score - Ease of Getting Call Centre";
|
|
ds.Tables[0].Columns[43].ColumnName = "Feedback Score - Response of Call Centre";
|
|
ds.Tables[0].Columns[44].ColumnName = "Feedback Score - Timely Updation by Dealer";
|
|
ds.Tables[0].Columns[45].ColumnName = "Feedback Score - Total Repair Time";
|
|
ds.Tables[0].Columns[46].ColumnName = "Feedback Score - EOS Charges";
|
|
ds.Tables[0].Columns[47].ColumnName = "Feedback Score - Over All Experience";
|
|
ds.Tables[0].Columns[48].ColumnName = "Closure Remarks";
|
|
ds.Tables[0].Columns[49].ColumnName = "Response(In min)";
|
|
ds.Tables[0].Columns[50].ColumnName = "Feedback Count";
|
|
ds.Tables[0].Columns[51].ColumnName = "Feedback Call Status";
|
|
ds.Tables[0].Columns[52].ColumnName = "Feedback Suggestions";
|
|
ds.Tables[0].Columns[53].ColumnName = "Feedback Complaints";
|
|
ds.Tables[0].Columns[54].ColumnName = "Feedback Agent";
|
|
ds.Tables[0].Columns[55].ColumnName = "Reason for Ticket assigned to Dealer";
|
|
ds.Tables[0].Columns[56].ColumnName = "Other Reason for Ticket assigned to Dealer";
|
|
ds.Tables[0].Columns[57].ColumnName = "Estimated Distance (In KM)";
|
|
ds.Tables[0].Columns[58].ColumnName = "EOS Van Actual Distance Traveled (In KM)";
|
|
ds.Tables[0].Columns[59].ColumnName = "EOS Van Trip Start Time";
|
|
ds.Tables[0].Columns[60].ColumnName = "EOS Van Trip End Time";
|
|
ds.Tables[0].Columns[61].ColumnName = "Eicher Promise";
|
|
ds.Tables[0].Columns[62].ColumnName = "Opportunity Loss";
|
|
ds.Tables[0].Columns[63].ColumnName = "Opportunity Loss Reason";
|
|
ds.Tables[0].Columns[64].ColumnName = "Opportunity Loss Remark";
|
|
ds.Tables[0].Columns[65].ColumnName = "Delayed Reason";
|
|
ds.Tables[0].Columns[66].ColumnName = "Delayed Remark";
|
|
ds.Tables[0].Columns[67].ColumnName = "Re Open Count";
|
|
ds.Tables[0].Columns[68].ColumnName = "Odometer Reading";
|
|
ds.Tables[0].Columns[74].ColumnName = "Ticket Accepted";
|
|
ds.Tables[0].Columns[102].ColumnName = "Reassignment Date and Time";
|
|
ds.Tables[0].Columns[106].ColumnName = "Response time(Reassignment)";
|
|
//added on 14-12-2020
|
|
ds.Tables[0].Columns[107].ColumnName = "Vehicle Warranty";
|
|
ds.Tables[0].Columns[108].ColumnName = "Vehicle Amc";
|
|
ds.Tables[0].Columns[109].ColumnName = "Vehicle Emission Norms ";
|
|
ds.Tables[0].Columns[110].ColumnName = "Vehicle Sales Date";
|
|
ds.Tables[0].Columns[111].ColumnName = "Ticket closed reason";
|
|
|
|
|
|
|
|
//Remove columns
|
|
ds.Tables[0].Columns.Remove("Vehicle Chassis No.");
|
|
ds.Tables[0].Columns.Remove("total_outbound_calls");
|
|
//added on 14-12-2020
|
|
ds.Tables[0].Columns.Remove("time_stamps_status_1");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_2");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_3");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_4");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_5");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_6");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_7");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_8");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_9");
|
|
ds.Tables[0].Columns.Remove("escalation_level_van_not_move_10");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_2");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_3");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_4");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_5");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_6");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_7");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_8");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_9");
|
|
ds.Tables[0].Columns.Remove("escalation_level_ticket_closer_10");
|
|
ds.Tables[0].Columns.Remove("month_name");
|
|
ds.Tables[0].Columns.Remove("default_sla_time");
|
|
ds.Tables[0].Columns.Remove("region");
|
|
ds.Tables[0].Columns.Remove("vehicle_model");
|
|
ds.Tables[0].Columns.Remove("CloseTicketCountInTimeSlot");
|
|
ds.Tables[0].Columns.Remove("estimated_time");
|
|
ds.Tables[0].Columns.Remove("response");
|
|
ds.Tables[0].Columns.Remove("estimated_cost");
|
|
ds.Tables[0].Columns.Remove("ticket_id");
|
|
ds.Tables[0].Columns.Remove("are_you_satisfied");
|
|
ds.Tables[0].Columns.Remove("not_satisfied_option");
|
|
ds.Tables[0].Columns.Remove("not_satisfied_reason");
|
|
ds.Tables[0].Columns.Remove("Ticket closed reason"); //added on 20-01-2021
|
|
ds.Tables[0].Columns.Remove("_call_closed_within_24_hours");
|
|
|
|
|
|
//fileName = "ConsolidatedReport_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".csv";
|
|
//string SaveCsEOS = Server.MapPath(_excelExportPathOnServer + fileName);
|
|
//bool isCreated = DataTableToCSV(ds.Tables[0], SaveCsvAs);
|
|
//if (isCreated == true) { return _exportLocation + fileName; }
|
|
//else { return "error"; }
|
|
|
|
fileName = "ConsolidatedReport_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string SaveCsvAs = Server.MapPath(_excelExportPathOnServer + fileName);
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, SaveCsvAs);
|
|
if (isCreated == true) { return _exportLocation + fileName; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport_ExportToCSV", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Show Consolidated Report grid with chart
|
|
/// </summary>
|
|
/// <param name="userId">User ID</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>return table</returns>
|
|
public ActionResult ConsolidatedReport_Chart(string userId, string startDate, string endDate, string organization, string vehicleTagging,string filterType)
|
|
{
|
|
objLog.AddLogFile("ConsolidatedReport_Chart", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Convert date into datetime format
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
|
|
#region Get Consolidated Graph Data
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType, "old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
//Get consolidated report data
|
|
List<ReportOpenTicketModel> oConsolidatedReportGraph = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, totalCount, 0, "data", null, organization, vehicleTagging, filterType, "old");
|
|
|
|
List<ConsolidatedReportModel> oGraphList = new List<ConsolidatedReportModel>();
|
|
foreach (var item2 in oConsolidatedReportGraph)
|
|
{
|
|
oGraphList.AddRange(item2.ConsolidatedReportModelList);
|
|
}
|
|
|
|
|
|
//var llll = oGraphList.Where(w => w.creation_time == "" || w.creation_time == null);
|
|
|
|
#region Get Time Slot
|
|
// Get Time Slot in which ticket is closed
|
|
string ticketCreationDateTime = "", ticketCreationTime = "";
|
|
foreach (var item in oGraphList)
|
|
{
|
|
ticketCreationDateTime = item.creation_time;
|
|
string[] split_ticketCreationDateTime = ticketCreationDateTime.Split(' ');
|
|
ticketCreationTime = split_ticketCreationDateTime[3];
|
|
|
|
for (var count = 0; count < 12; count++)
|
|
{
|
|
if ((DateTime.Parse("01/01/0001 " + ticketCreationTime) >= DateTime.Parse("01/01/0001 " + (2 * count) + ":00:00")) && (DateTime.Parse("01/01/0001 " + ticketCreationTime) <= DateTime.Parse("01/01/0001 " + ((2 * count) + 1) + ":59:59")))
|
|
{
|
|
item.time_slot = (2 * count) + ":00 to " + ((2 * count) + 2) + ":00";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
// Get time slots and no. of breakdowns
|
|
var listTimeSlotCount = oGraphList.GroupBy(g => g.time_slot).Select(s => new { Key = (string)s.Key, Count = s.Count() }).ToList();
|
|
List<kendoChartModel> oListTemp = new List<kendoChartModel>(); // Temp List for chart
|
|
foreach (var itemTimeSlot in listTimeSlotCount)
|
|
{
|
|
oListTemp.Add(new kendoChartModel { xAxis = itemTimeSlot.Key, yAxis = itemTimeSlot.Count });
|
|
}
|
|
|
|
List<kendoChartModel> oListTimeSlotChart = new List<kendoChartModel>
|
|
{
|
|
new kendoChartModel { Id=1, xAxis = "0:00 to 2:00", yAxis = 0 },
|
|
new kendoChartModel { Id=2, xAxis = "2:00 to 4:00", yAxis = 0 },
|
|
new kendoChartModel { Id=3, xAxis = "4:00 to 6:00", yAxis = 0 },
|
|
new kendoChartModel { Id=4, xAxis = "6:00 to 8:00", yAxis = 0 },
|
|
new kendoChartModel { Id=5, xAxis = "8:00 to 10:00", yAxis = 0 },
|
|
new kendoChartModel { Id=6, xAxis = "10:00 to 12:00", yAxis = 0 },
|
|
new kendoChartModel { Id=7, xAxis = "12:00 to 14:00", yAxis = 0 },
|
|
new kendoChartModel { Id=8, xAxis = "14:00 to 16:00", yAxis = 0 },
|
|
new kendoChartModel { Id=9, xAxis = "16:00 to 18:00", yAxis = 0 },
|
|
new kendoChartModel { Id=10, xAxis = "18:00 to 20:00", yAxis = 0 },
|
|
new kendoChartModel { Id=11, xAxis = "20:00 to 22:00", yAxis = 0 },
|
|
new kendoChartModel { Id=12, xAxis = "22:00 to 24:00", yAxis = 0 }
|
|
|
|
};
|
|
|
|
var listTimeSlot = oListTimeSlotChart.Concat(oListTemp).GroupBy(r => r.xAxis).Select(s => s.LastOrDefault()).ToList();
|
|
ViewBag.ChartModel = listTimeSlot;
|
|
|
|
#endregion
|
|
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_ConsolidatedReport_Grid", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Positioning Tool + Geo-Analysis Report
|
|
|
|
/// <summary>
|
|
/// to load main page of of positioning tool
|
|
/// </summary>
|
|
/// <returns>main page of of positioning tool</returns>
|
|
public ActionResult PositioningTool()
|
|
{
|
|
// globally storing userid from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
// globally storing UtcMinute from session
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
// storing security token to viewbag
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
// storing UtcMinutes to viewbag
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
// storing Userid to viewbag
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// to load main page of of positioning tool
|
|
/// </summary>
|
|
/// <returns>main page of of positioning tool</returns>
|
|
public ActionResult Positioning()
|
|
{
|
|
// globally storing userid from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
// globally storing UtcMinute from session
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
// storing security token to viewbag
|
|
ViewBag.SecurityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
// storing UtcMinutes to viewbag
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
// storing Userid to viewbag
|
|
ViewBag.Userid = _LoginUserId;
|
|
return View();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region pending(saved) tickets report
|
|
|
|
/// <summary>
|
|
/// Get Open Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_TicketPending()
|
|
{
|
|
objLog.AddLogFile("Report_TicketPending", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole.ToLower();
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_TicketPending", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of open tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <returns>return partial view of open tickets</returns>
|
|
public ActionResult Report_TicketPending_Grid(string userId)
|
|
{
|
|
objLog.AddLogFile("Report_TicketPending_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
|
|
//Get list of open ticket
|
|
TicketRequestModel oDummyTicketList = objReportRepository.GetDummyTicketsList(userId);
|
|
List<Models.Report.DummyOpenTicketDetail> oList = oDummyTicketList.DummyTicketList;
|
|
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.UserRole = _LoginUserRole.ToLower();
|
|
//ViewBag.total = totalCount;
|
|
//ViewBag.ticketStatus = ticketStatus;
|
|
//ViewBag.userId = userId;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_TicketPending_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region kam tickets close report
|
|
|
|
/// <summary>
|
|
/// Get Close Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_KamTickets_Close()
|
|
{
|
|
objLog.AddLogFile("Report_KamTickets_Close", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_KamTickets_Close", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of close tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <param name="startDate">String representation of start date</param>
|
|
/// <param name="endDate">String representation of end date</param>
|
|
/// <param name="ticketStatus">String representation of ticket status</param>
|
|
/// <returns>return partial view of close tickets</returns>
|
|
public ActionResult Report_KamTickets_Close_Grid(string userId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Report_KamTickets_Close_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Adding time to start date and end date
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Getting list of close ticket list
|
|
TicketRequestModel oTicketKamFullList = objReportRepository.GetKamTicketsList(userId, fromDate, toDate, _pageSize, 0, ticketStatus, null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketOpenModel> oList = oTicketKamFullList.TicketList;
|
|
|
|
|
|
//Server side paging, Get total count of tickets
|
|
TicketRequestModel oTicketKamCount = objReportRepository.GetKamTicketsList(userId, fromDate, toDate, _pageSize, 0, "count", null);
|
|
|
|
Int32 totalCount = Convert.ToInt32(oTicketKamCount.TicketCount);
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = totalCount;
|
|
ViewBag.ticketStatus = ticketStatus;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_KamTickets_Close_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Server side paging on close ticket report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <returns>return list of close tickets</returns>
|
|
public ActionResult Report_KamTickets_Close_Pager([DataSourceRequest] DataSourceRequest request, string userId, string startDate, string endDate, string ticketStatus, int total)
|
|
{
|
|
objLog.AddLogFile("Report_KamTickets_Close_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string query = null;
|
|
if (request.Filters.Count > 0)
|
|
{
|
|
// extract filter from request
|
|
var filterData = (System.Web.HttpContext.Current.Request.Params[9]);
|
|
// get query from filter object,
|
|
query = FilterKendoGrid.CreateFilterQuery(filterData);
|
|
}
|
|
objReportRepository = new ReportRepository();
|
|
|
|
//Getting list of close ticket list
|
|
TicketRequestModel oTicketKamFullList = objReportRepository.GetKamTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), ticketStatus, query);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketOpenModel> oList = oTicketKamFullList.TicketList;
|
|
|
|
|
|
//Server side paging, Get total count of tickets
|
|
TicketRequestModel oTicketKamCount = objReportRepository.GetKamTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), "count", query);
|
|
|
|
Int32 totalCount = Convert.ToInt32(oTicketKamCount.TicketCount);
|
|
|
|
DataSourceResult result = oList.ToDataSourceResult(request);
|
|
//check if filters are applied than total count fetched from server
|
|
if (query == null) { result.Total = total; } else { result.Total = totalCount; }
|
|
|
|
//send data to kendo grid
|
|
result.Data = oList;
|
|
return Json(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_KamTickets_Close_Pager", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Export to excel Open and Close Ticket Report
|
|
/// </summary>
|
|
/// <param name="UserId">Login user id</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="ticketStatus">Ticket Status(Open or Close)</param>
|
|
/// <returns>Returns excel file</returns>
|
|
[HttpPost]
|
|
public string Report_KamTickets_Close_ExportToExcel(string userId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_Close_Open_ExportToExcel", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string filename = null;
|
|
string templatePath = null;
|
|
objReportRepository = new ReportRepository();
|
|
|
|
string fromDate = "01 jan 1900";
|
|
string toDate = DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]);
|
|
if (startDate != "" && endDate != "")
|
|
{
|
|
fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
}
|
|
|
|
//string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
//string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Getting list of close ticket list
|
|
TicketRequestModel oTicketKamFullList = objReportRepository.GetKamTicketsList(userId, fromDate, toDate, 1000000, 0, ticketStatus, null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketOpenModel> oList = oTicketKamFullList.TicketList;
|
|
|
|
DataTable OpenTicketTable = oList.ToDataTable();
|
|
|
|
//Server side paging, Get total count of tickets
|
|
Int32 OpenTicketTableColumnCount = OpenTicketTable.Columns.Count - 1;
|
|
for (var count = OpenTicketTableColumnCount; count >= 11; count--)
|
|
{
|
|
OpenTicketTable.Columns.RemoveAt(count);
|
|
}
|
|
|
|
//if (ticketStatus.ToLower().Trim() == "open")
|
|
//{
|
|
// OpenTicketTable.Columns.RemoveAt(13);
|
|
// OpenTicketTable.Columns.RemoveAt(12);
|
|
//}
|
|
//else
|
|
//{
|
|
// OpenTicketTable.Columns.RemoveAt(14);
|
|
//}
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(OpenTicketTable);
|
|
|
|
//if (ticketStatus == "close")
|
|
//{
|
|
// ds.Tables[0].Columns.RemoveAt(1);
|
|
//}
|
|
//else if (ticketStatus == "open")
|
|
//{
|
|
// ds.Tables[0].Columns.RemoveAt(ds.Tables[0].Columns.Count - 1);
|
|
//}
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
ExcelUtility objExcelUtility = new ExcelHelper.ExcelUtility();
|
|
List<WorkbookMappingModel> workbokkMapping = new List<WorkbookMappingModel>();
|
|
if (ticketStatus == "open")
|
|
{
|
|
filename = "OpenTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Open Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["OpenTicketReportTemplate"].ToString());
|
|
}
|
|
else
|
|
{
|
|
filename = "FleetManagerCloseTicket_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
workbokkMapping.Add(new WorkbookMappingModel { DataTableName = ds.Tables[0].TableName, WorkSheetName = "Fleet Manager Close Ticket", StartColumnName = "A", StartRowNumber = 2, WorkSheetNumber = 1, AutoFit = false });
|
|
templatePath = Server.MapPath(ConfigurationManager.AppSettings["CloseTicketReportTemplate"].ToString());
|
|
}
|
|
string pathToExcelFile = _exportLocation + filename;
|
|
string saveAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, saveAs);
|
|
// ExcelHelper.StatusModel result = objExcelUtility.ExportToExcel(ds, templatePath, workbokkMapping, saveAs, false);
|
|
//================================ Excel Functionality End ===================================//
|
|
if (isCreated == true) { return pathToExcelFile; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Ticket_Close_Open_ExportToExcel", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region kam tickets open report
|
|
|
|
/// <summary>
|
|
/// Get Open Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_KamTickets_Open()
|
|
{
|
|
objLog.AddLogFile("Report_KamTickets_Open", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_KamTickets_Open", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of open tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <param name="startDate">String representation of start date</param>
|
|
/// <param name="endDate">String representation of end date</param>
|
|
/// <param name="limit">String representation of limit of pages</param>
|
|
/// <param name="offset">String representation of offset</param>
|
|
/// <param name="ticketStatus">String representation of ticket status</param>
|
|
/// <returns>return partial view of open tickets</returns>
|
|
public ActionResult Report_KamTickets_Open_Grid(string userId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Report_KamTickets_Open_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
|
|
string fromDate = null;
|
|
string toDate = null;
|
|
|
|
//string fromDate = "01 jan 1900";
|
|
//string toDate = DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]);
|
|
//if (startDate != "" && endDate != "")
|
|
//{
|
|
// fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
// toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
//}
|
|
|
|
//Get list of open ticket
|
|
TicketRequestModel oTicketKamFullList = objReportRepository.GetKamTicketsList(userId, fromDate, toDate, _pageSize, 0, ticketStatus, null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketOpenModel> oList = oTicketKamFullList.TicketList;
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
//ViewBag.total = totalCount;
|
|
ViewBag.ticketStatus = ticketStatus;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_KamTickets_Open_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Consolidated Report New
|
|
|
|
/// <summary>
|
|
/// Get Consolidated Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult ConsolidatedReportNew()
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
|
|
//Getting Organization list user wise
|
|
List<OrganizationModel> oOrganizationList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> oOrganizationNameList = new List<SelectListItem>();
|
|
oOrganizationNameList.Add(new SelectListItem { Text = "All", Value = "" });
|
|
foreach (OrganizationModel items in oOrganizationList)
|
|
{
|
|
oOrganizationNameList.Add(new SelectListItem { Text = items.OrganizationName, Value = items.Id.ToString() });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View(oOrganizationNameList.OrderBy(o => o.Text));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show Consolidated Report grid with chart
|
|
/// </summary>
|
|
/// <param name="userId">User ID</param>
|
|
/// <param name="startDate">From Date</param>
|
|
/// <param name="endDate">To Date</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>return table</returns>
|
|
public ActionResult ConsolidatedReport_Grid_New(string userId, string startDate, string endDate, string organization, string vehicleTagging, string filterType)
|
|
{
|
|
objLog.AddLogFile("Reports_ConsolidatedReport_Grid", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Convert date into datetime format
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Get consolidated report data
|
|
// List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedDataNew(userId, fromDate, toDate, _pageSize, 0, "data", null, organization, vehicleTagging, filterType); List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedDataNew(userId, fromDate, toDate, _pageSize, 0, "data", null, organization, vehicleTagging, filterType);
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, _pageSize, 0, "data", null, organization, vehicleTagging, filterType,"new");
|
|
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
List<ConsolidatedReportTimeSlot> oCountTicketCloseInTimeSlotList = new List<ConsolidatedReportTimeSlot>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
|
|
foreach (var item in oList)
|
|
{
|
|
item.complaints = (item.complaints == null) ? "" : ("<ol><li>" + item.complaints + "</li></ol>");
|
|
item.suggestion = (item.suggestion == null) ? "" : ("<ol><li>" + item.suggestion + "</li></ol>");
|
|
if (item.complaints.IndexOf(",") != -1)
|
|
{
|
|
item.complaints = item.complaints.Replace(@",", @"</li><li>");
|
|
// item.complaints = "<ol><li>" + item.complaints + "</li></ol>";
|
|
}
|
|
if (item.suggestion.IndexOf(",") != -1)
|
|
{
|
|
item.suggestion = item.suggestion.Replace(@",", @"</li><li>");
|
|
//item.suggestion = "<ol><li>" + item.suggestion + "</li></ol>";
|
|
}
|
|
}
|
|
|
|
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(userId, fromDate, toDate, _pageSize, 0, "count", null, organization, vehicleTagging, filterType,"old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = totalCount;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
ViewBag.organization = organization;
|
|
ViewBag.vehicleTagging = vehicleTagging;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_ConsolidatedReport_Grid", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Server side paging on consolidated report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <param name="organization">organization</param>
|
|
/// <param name="vehicleTagging">vehicle tagging</param>
|
|
/// <returns>return list of consolidated report</returns>
|
|
public ActionResult ConsolidatedReport_Pager_New([DataSourceRequest] DataSourceRequest request, string userId, string startDate, string endDate, int total, string organization, string vehicleTagging, string filterType)
|
|
{
|
|
objLog.AddLogFile("Report_ConsolidatedReport_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string query = null;
|
|
if (request.Filters.Count > 0)
|
|
{
|
|
// extract filter from request
|
|
var filterData = (System.Web.HttpContext.Current.Request.Params["filter"]);
|
|
// get query from filter object,
|
|
query = FilterKendoGrid.CreateFilterQuery(filterData);
|
|
}
|
|
objReportRepository = new ReportRepository();
|
|
|
|
List<ReportOpenTicketModel> oConsolidatedReportList = objReportRepository.GetConsolidatedDataNew(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), "data", query, organization, vehicleTagging, filterType);
|
|
List<ConsolidatedReportModel> oList = new List<ConsolidatedReportModel>();
|
|
foreach (var item in oConsolidatedReportList)
|
|
{
|
|
oList.AddRange(item.ConsolidatedReportModelList);
|
|
}
|
|
|
|
|
|
foreach (var item in oList)
|
|
{
|
|
item.complaints = (item.complaints == null) ? "" : ("<ol><li>" + item.complaints + "</li></ol>");
|
|
item.suggestion = (item.suggestion == null) ? "" : ("<ol><li>" + item.suggestion + "</li></ol>");
|
|
if (item.complaints.IndexOf(",") != -1)
|
|
{
|
|
item.complaints = item.complaints.Replace(@",", @"</li><li>");
|
|
// item.complaints = "<ol><li>" + item.complaints + "</li></ol>";
|
|
}
|
|
if (item.suggestion.IndexOf(",") != -1)
|
|
{
|
|
item.suggestion = item.suggestion.Replace(@",", @"</li><li>");
|
|
//item.suggestion = "<ol><li>" + item.suggestion + "</li></ol>";
|
|
}
|
|
}
|
|
//Get count of consolidated report
|
|
List<ReportOpenTicketModel> oConsolidatedReportCount = objReportRepository.GetConsolidatedData(userId, startDate, endDate, _pageSize, 0, "count", query, organization, vehicleTagging, filterType, "old");
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oConsolidatedReportCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
DataSourceResult result = oList.ToDataSourceResult(request);
|
|
result.Total = totalCount;
|
|
result.Data = oList;
|
|
return Json(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ConsolidatedReport_Pager", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Reassignment report
|
|
public ActionResult ReassignmentReport()
|
|
{
|
|
objLog.AddLogFile("Report_ReassignmentReport", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
|
|
//Getting Organization list user wise
|
|
List<OrganizationModel> oOrganizationList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> oOrganizationNameList = new List<SelectListItem>();
|
|
oOrganizationNameList.Add(new SelectListItem { Text = "All", Value = "" });
|
|
foreach (OrganizationModel items in oOrganizationList)
|
|
{
|
|
oOrganizationNameList.Add(new SelectListItem { Text = items.OrganizationName, Value = items.Id.ToString() });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View(oOrganizationNameList.OrderBy(o => o.Text));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ReassignmentReport", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region DTC report
|
|
public ActionResult DTCReport()
|
|
{
|
|
objLog.AddLogFile("Report_DTCReport", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
|
|
//Getting Organization list user wise
|
|
List<OrganizationModel> oOrganizationList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> oOrganizationNameList = new List<SelectListItem>();
|
|
oOrganizationNameList.Add(new SelectListItem { Text = "All", Value = "" });
|
|
foreach (OrganizationModel items in oOrganizationList)
|
|
{
|
|
oOrganizationNameList.Add(new SelectListItem { Text = items.OrganizationName, Value = items.Id.ToString() });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View(oOrganizationNameList.OrderBy(o => o.Text));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ReassignmentReport", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
#region Driver Score Report
|
|
|
|
/// <summary>
|
|
/// Get Open Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_DriverScore()
|
|
{
|
|
objLog.AddLogFile("Report_DriverScore", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return View();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_DriverScore", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
#region Van score
|
|
|
|
/// <summary>
|
|
/// get all van score
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_GetAllVansScore()
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ScoreRequestModel model = new ScoreRequestModel();
|
|
model = oReportRepository.GetVanScoreList();
|
|
ViewBag.pageSize = _pageSize;
|
|
|
|
return PartialView(model.ClosedTicketList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEosCallCount", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// get score report of a van or compare report of more than two vans
|
|
/// </summary>
|
|
/// <param name="vans">van/vans string</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <returns>compare report of two or more van</returns>
|
|
public ActionResult Report_CompareVansScore(string vans, string fromDate, string toDate)
|
|
{
|
|
try
|
|
{
|
|
fromDate = DateTime.Now.AddMonths(-1).ToString("dd MMM yyyy");
|
|
toDate = DateTime.Now.ToString("dd MMM yyyy");
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
ViewBag.pageSize = _pageSize;
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ScoreRequestModel model = new ScoreRequestModel();
|
|
model = oReportRepository.GetVansScoresCompareReport(vans, fromDate, toDate);
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEosCallCount", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region dealer score
|
|
|
|
/// <summary>
|
|
/// Get all dealer score report
|
|
/// </summary>
|
|
/// <returns>partial view</returns>
|
|
public ActionResult Report_GetAllDealersScore()
|
|
{
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ScoreRequestModel model = new ScoreRequestModel();
|
|
model = oReportRepository.GetDealerScoreList();
|
|
ViewBag.pageSize = _pageSize;
|
|
|
|
return PartialView(model.ClosedTicketList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEosCallCount", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// get score report of a dealer or compare report of more than two dealers
|
|
/// </summary>
|
|
/// <param name="dealers">dealer/dealers string</param>
|
|
/// <param name="fromDate">start date</param>
|
|
/// <param name="toDate">end date</param>
|
|
/// <returns>compare report of two or more dealers</returns>
|
|
public ActionResult Report_CompareDealersScore(string dealers, string fromDate, string toDate)
|
|
{
|
|
try
|
|
{
|
|
fromDate = DateTime.Now.AddMonths(-1).ToString("dd MMM yyyy");
|
|
toDate = DateTime.Now.ToString("dd MMM yyyy");
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_UtcMinutes = Convert.ToInt16(Session["UtcMinute"].ToString());
|
|
ViewBag.pageSize = _pageSize;
|
|
|
|
dealerScoreCardScore dealerScoreScore = new dealerScoreCardScore();
|
|
dealerScoreScore.Score = "";
|
|
|
|
dealerScoreCardDate dealerScoreCardDate = new dealerScoreCardDate();
|
|
dealerScoreCardDate.RecordDate = "";
|
|
|
|
ReportRepository oReportRepository = new ReportRepository();
|
|
ScoreRequestModel model = new ScoreRequestModel();
|
|
dealerScoreCard modelScoreCard = new dealerScoreCard();
|
|
List<dealerScoreCard> listScoreCard = new List<dealerScoreCard>();
|
|
EosScoreCardModel modelDealerScore = new EosScoreCardModel();
|
|
model = oReportRepository.GetDealersScoresCompareReport(dealers, fromDate, toDate);
|
|
|
|
|
|
//for (var count = 0; count < model.ClosedTicketList.Count; count++)
|
|
//{
|
|
// if (count == 0)
|
|
// {
|
|
// dealerScoreScore.Score += model.ClosedTicketList[count].Score;
|
|
// dealerScoreCardDate.RecordDate += model.ClosedTicketList[count].RecordDate;
|
|
// }
|
|
// else
|
|
// {
|
|
// dealerScoreScore.Score += " ," + model.ClosedTicketList[count].Score;
|
|
// dealerScoreCardDate.RecordDate += " ," + model.ClosedTicketList[count].RecordDate;
|
|
// }
|
|
|
|
//}
|
|
//var ss = dealerScoreScore.Score.Split(new string[] { ", " }, StringSplitOptions.None);
|
|
|
|
//modelScoreCard.Score = dealerScoreScore.Score.Split(new string[] { ", " }, StringSplitOptions.None);
|
|
//modelScoreCard.RecordDate = dealerScoreCardDate.RecordDate.Split(new string[] { ", " }, StringSplitOptions.None);
|
|
|
|
//listScoreCard.Add(new dealerScoreCard
|
|
// {
|
|
// Score = modelScoreCard.Score,
|
|
// RecordDate = modelScoreCard.RecordDate
|
|
// });
|
|
|
|
//modelDealerScore.dealerScoreCard = listScoreCard;
|
|
|
|
return PartialView(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_ShowEosCallCount", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ticket score
|
|
|
|
|
|
/// <summary>
|
|
/// Get Close Ticket Report view
|
|
/// </summary>
|
|
/// <returns>return view</returns>
|
|
public ActionResult Report_GetAllTicketScore()
|
|
{
|
|
objLog.AddLogFile("Report_GetAllTicketScore", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
_LoginUserRole = Session["UserRole"].ToString();
|
|
|
|
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.UserRole = _LoginUserRole;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Close", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show grid of close tickets
|
|
/// </summary>
|
|
/// <param name="userId">String representation of login user id</param>
|
|
/// <param name="startDate">String representation of start date</param>
|
|
/// <param name="endDate">String representation of end date</param>
|
|
/// <param name="ticketStatus">String representation of ticket status</param>
|
|
/// <returns>return partial view of close tickets</returns>
|
|
public ActionResult Report_GetAllTicketScoreGrid(string userId, string startDate, string endDate, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Report_GetAllTicketScore", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objReportRepository = new ReportRepository();
|
|
//Adding time to start date and end date
|
|
string fromDate = startDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["startTimeFormat"]);
|
|
string toDate = endDate + " " + DateTime.Now.ToString(ConfigurationManager.AppSettings["endTimeFormat"]);
|
|
|
|
//Getting list of close ticket list
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetTicketScoreList(userId, fromDate, toDate, _pageSize, 0, ticketStatus, null);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketListForScore> oList = new List<TicketListForScore>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketScoreList);
|
|
}
|
|
|
|
//Server side paging, Get total count of tickets
|
|
List<ReportOpenTicketModel> oTicketCloseCount = objReportRepository.GetOpenTicketsList(userId, fromDate, toDate, _pageSize, 0, "count", null,null);
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oTicketCloseCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = totalCount;
|
|
ViewBag.ticketStatus = ticketStatus;
|
|
ViewBag.startDate = fromDate;
|
|
ViewBag.endDate = toDate;
|
|
ViewBag.userId = userId;
|
|
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Reports_Ticket_Close_Grid", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Server side paging on close ticket report
|
|
/// </summary>
|
|
/// <param name="request">data source request</param>
|
|
/// <param name="userId">login user id</param>
|
|
/// <param name="startDate">from data</param>
|
|
/// <param name="endDate">to date</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <param name="total">total rows to be get</param>
|
|
/// <returns>return list of close tickets</returns>
|
|
public ActionResult Report_GetAllTicketScoreeGrid_Pager([DataSourceRequest] DataSourceRequest request, string userId, string startDate, string endDate, string ticketStatus, int total)
|
|
{
|
|
objLog.AddLogFile("Report_GetAllTicketScoreeGrid_Pager", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string query = null;
|
|
if (request.Filters.Count > 0)
|
|
{
|
|
// extract filter from request
|
|
var filterData = (System.Web.HttpContext.Current.Request.Params[9]);
|
|
// get query from filter object,
|
|
query = FilterKendoGrid.CreateFilterQuery(filterData);
|
|
}
|
|
objReportRepository = new ReportRepository();
|
|
|
|
//Getting list of close ticket list
|
|
List<ReportOpenTicketModel> oTicketOpenFullList = objReportRepository.GetTicketScoreList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), ticketStatus, query);
|
|
|
|
//Fetching ticket list from close ticket list
|
|
List<TicketListForScore> oList = new List<TicketListForScore>();
|
|
foreach (var item in oTicketOpenFullList)
|
|
{
|
|
oList.AddRange(item.TicketScoreList);
|
|
}
|
|
|
|
//Server side paging, Get total count of tickets
|
|
List<ReportOpenTicketModel> oTicketCloseCount = objReportRepository.GetOpenTicketsList(userId, startDate, endDate, request.PageSize, request.PageSize * (request.Page - 1), "count", query,null);
|
|
|
|
Int32 totalCount = 0;
|
|
foreach (var item in oTicketCloseCount)
|
|
{
|
|
totalCount = item.TicketCount;
|
|
}
|
|
|
|
DataSourceResult result = oList.ToDataSourceResult(request);
|
|
//check if filters are applied than total count fetched from server
|
|
if (query == null) { result.Total = total; } else { result.Total = totalCount; }
|
|
|
|
//send data to kendo grid
|
|
result.Data = oList;
|
|
return Json(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_GetAllTicketScoreeGrid_Pager", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
//------------------------------ added on 09-03-2021 start---------------------------------------------
|
|
[HttpPost]
|
|
public string DummyCancelledTicketsExportToExcel()
|
|
{
|
|
|
|
objLog.AddLogFile("Report_CancelledDummyTickets_ExportToCSV", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string fileName = null;
|
|
objReportRepository = new ReportRepository();
|
|
//Get cancelled dummy report data
|
|
List<CancelledDraftTicketReportModel> oCancelledDraftTicketReport = objReportRepository.GetCancelledDummyList();
|
|
|
|
List<GODATA.Models.Report.CancelledDraftTicketModel> oList = new List<GODATA.Models.Report.CancelledDraftTicketModel>();
|
|
foreach (var item in oCancelledDraftTicketReport)
|
|
{
|
|
oList.AddRange(item.CancelledDraftTicketList);
|
|
}
|
|
|
|
DataTable CancelledDummyDataTable = oList.ToDataTable();
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(CancelledDummyDataTable);
|
|
ds.Tables[0].Columns[11].SetOrdinal(11);
|
|
|
|
//Remove columns
|
|
ds.Tables[0].Columns.Remove("Token");
|
|
ds.Tables[0].Columns.Remove("Message");
|
|
ds.Tables[0].Columns.Remove("UtcMinute");
|
|
|
|
|
|
//Give column names
|
|
ds.Tables[0].Columns[0].ColumnName = "Draft Ticket Id";
|
|
ds.Tables[0].Columns[1].ColumnName = "Vehicle Registration Number";
|
|
ds.Tables[0].Columns[2].ColumnName = "Chassis Number";
|
|
ds.Tables[0].Columns[3].ColumnName = "Comments";
|
|
ds.Tables[0].Columns[4].ColumnName = "Contact Number";
|
|
ds.Tables[0].Columns[5].ColumnName = "Driver Name";
|
|
ds.Tables[0].Columns[6].ColumnName = "Kam User";
|
|
ds.Tables[0].Columns[7].ColumnName = "Creation Time";
|
|
ds.Tables[0].Columns[8].ColumnName = "Toll Free No Source";
|
|
ds.Tables[0].Columns[9].ColumnName = "Ticket Cancel Reason";
|
|
ds.Tables[0].Columns[10].ColumnName = "Ticket Cancel Remark";
|
|
|
|
fileName = "DummyCancelReport" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string SaveCsvAs = Server.MapPath(_excelExportPathOnServer + fileName);
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, SaveCsvAs);
|
|
if (isCreated == true) { return _exportLocation + fileName; }
|
|
else { return "error"; }
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("Report_DummyCancelReport_ExportToCSV", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
//------------------------------ added on 09-03-2021 end ---------------------------------------------
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|