2651 lines
131 KiB
C#
2651 lines
131 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.UserInventory;
|
|
using GODATA.Models.DropDownData;
|
|
using GODATA.Models.Inventory;
|
|
using GODATA.Models.Ticket;
|
|
using System.Data;
|
|
using ExcelHelper;
|
|
using ExportToExcel;
|
|
using GODATA.Models.FilterKendoGrid;
|
|
using GODATA.Models.Notifications;
|
|
using ClosedXML.Excel;
|
|
using System.IO;
|
|
|
|
|
|
namespace GODATA.Controllers
|
|
{
|
|
[GODATA.MvcApplication.SessionExpire]
|
|
public class TicketController : Controller
|
|
{
|
|
#region Global Variables
|
|
|
|
/// <summary>
|
|
/// Global variable for User management crud repository.
|
|
/// </summary>
|
|
private UserInventoryRepository objUserInventoryRepository = null;
|
|
|
|
/// <summary>
|
|
/// Global variable for CRUD repository.
|
|
/// </summary>
|
|
private InventoryModelRepository objInventoryRepository = null;
|
|
|
|
/// <summary>
|
|
/// Global variable for Ticket administration CCE portal repository.
|
|
/// </summary>
|
|
private TicketAdministrationRepository objTicketAdministrationRepository = null;
|
|
|
|
|
|
private NotificationsRepository objNotificationsRepository = null;
|
|
|
|
|
|
/// <summary>
|
|
/// Global variable for Drop Down List data bind repository.
|
|
/// </summary>
|
|
private DropDownDataRepository objDropDownDataRepository = 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 user's utc minutes from session
|
|
/// </summary>
|
|
private static string _timeOffSetMinutes = null;
|
|
|
|
/// <summary>
|
|
/// getting login user's id
|
|
/// </summary>
|
|
private static string _LoginUserId = null;
|
|
|
|
/// <summary>
|
|
/// getting login user's name
|
|
/// </summary>
|
|
private static string _LoginUserName = 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>
|
|
/// 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 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"]);
|
|
|
|
#endregion
|
|
|
|
#region Ticket History
|
|
|
|
/// <summary>
|
|
/// Get ticket administartion view
|
|
/// </summary>
|
|
/// <returns>returns view</returns>
|
|
public ActionResult TicketAdministration(string complaintNo, bool? isKamUser, string dummyTicketId,string Chassis_Number)
|
|
|
|
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
//Storing login user's id, name and utc minutes in viewbag to pass in view
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.ComplaintNo = complaintNo;
|
|
ViewBag.RegistrationNo = complaintNo;
|
|
ViewBag.KamUser = isKamUser;
|
|
ViewBag.DummyTicketId = dummyTicketId;
|
|
ViewBag.Chassis_Number = Chassis_Number;
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get check ticket history form view
|
|
/// </summary>
|
|
/// <returns>return partial view</returns>
|
|
[HttpGet]
|
|
public ActionResult TicketAdministration_CheckHistory()
|
|
{
|
|
return PartialView();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get ticket history based on vehicle's registration no. or mobile no. or complaint no.(ticket id)
|
|
/// </summary>
|
|
/// <param name="registrationNo">vehicle's registration no.</param>
|
|
/// <param name="mobileNo">mobile no of customer or owner</param>
|
|
/// <param name="complaintNo">complaint no or ticket id</param>
|
|
/// <returns>return view of ticket history</returns>
|
|
public ActionResult TicketAdministration_GetTicketHistory(string registrationNo, string mobileNo, string complaintNo, string chassis_number,string isload)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetTicketHistory", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository(); //Ticket administration functions repository of CCE portal
|
|
List<CustomerModel> oCustomerList = null; //List of customer data
|
|
List<TicketModel> oOpenTicketList = null; //List of open tickets for a customer
|
|
List<TicketModel> oCloseTicketList = null; //List of close tickets for a customer
|
|
|
|
List<DummyOpenTicketDetail> oSaveTicketList = null; //List of save tickets for a customer
|
|
|
|
List<string> oCustomerName = new List<string>(); //dummy list of string type to store customer name
|
|
oCustomerName.Add("-Select-"); //added dummy data in dummy list
|
|
string VRegistrationNo = string.Empty; //string for vehicle registration no.
|
|
string customerContactNo = string.Empty; //string for customer contact no.
|
|
string ticketId = string.Empty; //string for ticket id or complaint no.
|
|
|
|
//Check if vehicle registration no. is given to get ticket history
|
|
if (registrationNo != null && registrationNo != "")
|
|
{
|
|
//replace "-" to blank space and than replace blank space to empty string in registration no.
|
|
registrationNo = registrationNo.Replace("-", " ").Replace(" ", String.Empty);
|
|
}
|
|
//Check atleast one field is filled otherwise show message.
|
|
if ((registrationNo != null && registrationNo != "") || (mobileNo != null && mobileNo != "") || (complaintNo != null && complaintNo != ""))
|
|
{
|
|
//check whether complaint no. is filled
|
|
if (complaintNo != null && complaintNo != "")
|
|
{
|
|
//check if complaint no. contains 'TICKETID' or not
|
|
if (complaintNo.ToLower().IndexOf("ticketid") == -1)
|
|
{
|
|
ticketId = ConfigurationManager.AppSettings["ticketId"] + "-" + complaintNo;
|
|
}
|
|
else
|
|
{
|
|
ticketId = complaintNo;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ticketId = "";
|
|
}
|
|
//Get customer details if exist
|
|
// oCustomerList = objTicketAdministrationRepository.GetCustomerDetails(registrationNo, mobileNo, ticketId);
|
|
|
|
var Id = string.Empty;
|
|
//if (oCustomerList.Count > 0)
|
|
//{
|
|
// //fetching data from customer details list
|
|
// foreach (var item in oCustomerList)
|
|
// {
|
|
// VRegistrationNo = item.VehicleRegistrationNumber;
|
|
|
|
// //Creating customer names list if not an owner of vehicle
|
|
// if (item.CustomerVehicleIsOwnwer != true)
|
|
// {
|
|
// oCustomerName.Add(item.CustomerName);
|
|
// }
|
|
// customerContactNo = item.CustomerMobile1;
|
|
|
|
// //added on 22-12-2020
|
|
// if (item.CustomerVehicleIsOwnwer == true)
|
|
// {
|
|
// Id = item.CustomerId;
|
|
// }
|
|
|
|
// }
|
|
//}
|
|
|
|
//Get vehicle's registration no.
|
|
if (registrationNo == null || registrationNo == "")
|
|
{
|
|
registrationNo = VRegistrationNo;
|
|
}
|
|
|
|
ViewBag.VRegistrationNo = registrationNo;
|
|
ViewBag.ComplaintNo = ticketId;
|
|
ViewBag.ChassisNumber = chassis_number;
|
|
|
|
//Get customer's contact no.
|
|
if (mobileNo != null && mobileNo != "")
|
|
{
|
|
ViewBag.CustomerContactNo = mobileNo;
|
|
}
|
|
else
|
|
{
|
|
ViewBag.CustomerContactNo = customerContactNo;
|
|
}
|
|
// List <CustomerModel> oCustomerModelsList = new List<CustomerModel>();
|
|
//CustomerModel obcust = new CustomerModel();
|
|
//obcust.VehicleModelNumber = "PRO 6031";
|
|
//obcust.VehicleNumberPlate = "Ac234";
|
|
//obcust.vw = "Ac234";
|
|
//oCustomerList.Add(obcust);
|
|
|
|
List<CustomerModel> obcust = new List<CustomerModel>()
|
|
{
|
|
new CustomerModel() {VehicleModelNumber="PRO 6031",VehicleNumberPlate="up24" },
|
|
new CustomerModel() {VehicleModelNumber="PRO 6031",VehicleNumberPlate="up24" }
|
|
//........................ and so on
|
|
};
|
|
oCustomerList = obcust;
|
|
// oCustomerList.FirstOrDefault(obcust);
|
|
//added on 22-12-2020 Dbm calling to get customerID and customer type
|
|
//List<CustomerModel> oCustomerModelsList = new List<CustomerModel>();
|
|
//oCustomerModelsList = objTicketAdministrationRepository.GetVehicleDetailsRegistrationNoWiseByThirdParty(registrationNo);
|
|
|
|
// if (oCustomerModelsList.Count > 0)
|
|
//{
|
|
// //fetching data from customer details list
|
|
// foreach (var item in oCustomerModelsList)
|
|
// {
|
|
// VRegistrationNo = item.VehicleRegistrationNumber;
|
|
|
|
// string CustomerId = string.Empty; //string for vehicle registration no.
|
|
// string CustomerType= string.Empty; //string for customer contact no.
|
|
// string Customer_Id = string.Empty;
|
|
// string CustomerMobileNumber = string.Empty;
|
|
// string ChassisNumber = string.Empty;
|
|
// string VehicleRegistrationNo=string.Empty;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
// string VehicleModelNumber = string.Empty;
|
|
// string VehicleType = string.Empty;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
|
|
|
|
// Customer_Id = Id;
|
|
// CustomerId = item.CustomerId;
|
|
// CustomerType=item.CustomerType;
|
|
// CustomerMobileNumber=item.CustomerMobileNumber1;
|
|
// ChassisNumber = item.VehicleRegistrationNumber;
|
|
// VehicleRegistrationNo = registrationNo;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
// VehicleModelNumber = item.VehicleModelNumber;
|
|
// VehicleType = item.VehicleType;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
|
|
// //added on 22-12-2020 update customer
|
|
// CustomerModel oCustomerModel = new CustomerModel();
|
|
// oCustomerModel.Id = Customer_Id;
|
|
// oCustomerModel.CustomerId=CustomerId;
|
|
// oCustomerModel.CustomerType=CustomerType;
|
|
// oCustomerModel.CustomerMobileNumber1 = CustomerMobileNumber;
|
|
// oCustomerModel.VehicleRegistrationNumber = ChassisNumber;
|
|
// oCustomerModel.RegistrationNumber = VehicleRegistrationNo;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
// oCustomerModel.VehicleModelNumber = VehicleModelNumber;
|
|
// oCustomerModel.VehicleType = VehicleType;
|
|
// //----------- added on 01-03-2021 start ---------------------------
|
|
// //oCustomerModel.VehicleRegistrationNumber = registrationNo;
|
|
// //calling create customer web api
|
|
// objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
// oCustomerModel = objTicketAdministrationRepository.Restful_UpdateCustomer(oCustomerModel);
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//Get open tickets list
|
|
oOpenTicketList = new List<TicketModel>();
|
|
oOpenTicketList = objTicketAdministrationRepository.GetOpenTicketHistory(registrationNo, mobileNo, ticketId);
|
|
|
|
//Get close ticket list
|
|
oCloseTicketList = new List<TicketModel>();
|
|
if (isload == "Yes")
|
|
{
|
|
}
|
|
else
|
|
{
|
|
oCloseTicketList = objTicketAdministrationRepository.GetCloseTicketHistory(registrationNo, mobileNo, ticketId);
|
|
|
|
}//oCloseTicketList.o = 10;
|
|
//Get Save tickets list
|
|
oSaveTicketList = new List<DummyOpenTicketDetail>();
|
|
oSaveTicketList = objTicketAdministrationRepository.GetSaveTicketHistory(registrationNo, mobileNo, ticketId);
|
|
|
|
List<TicketModel> obclose = new List<TicketModel>()
|
|
{
|
|
new TicketModel() {VehicleRegisterNumber="PRO 6031",ChassisNo="up24" },
|
|
new TicketModel() {VehicleRegisterNumber="PRO 6031",ChassisNo="up24" }
|
|
//........................ and so on
|
|
};
|
|
oCustomerList = obcust;
|
|
//Store data in viewbag
|
|
ViewBag.CountOpenTicket = oOpenTicketList.Count;
|
|
ViewBag.mobileNo = mobileNo;
|
|
ViewBag.CustomerName = oCustomerName;
|
|
ViewBag.CustomerDetailsList = oCustomerList;
|
|
ViewBag.CloseTicketList = oCloseTicketList;
|
|
ViewBag.CloseTicketList1 = obclose;
|
|
ViewBag.SaveTicketList = oSaveTicketList;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oOpenTicketList);
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
//return Json(new { success = true, fillFieldMesseage = "Please fill atleast one field for search!!" });
|
|
return Json(new { success = true, fillFieldMesseage = Convert.ToString(ConfigurationManager.AppSettings["required_field_to_fill"]) }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetTicketHistory", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Data for assign ticket
|
|
|
|
/// <summary>
|
|
/// Get contact no. customer name wise
|
|
/// </summary>
|
|
/// <param name="VRegistrationNo">vehicle registration no.</param>
|
|
/// <param name="customerName">customer name</param>
|
|
/// <returns>return contact no.</returns>
|
|
public ActionResult GetCustomerContactNo(string VRegistrationNo, string customerName)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetCustomerContactNo", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
string contactNo = "";
|
|
|
|
//Get customer details
|
|
List<CustomerModel> oCustomerList = objTicketAdministrationRepository.GetCustomerDetails(VRegistrationNo, "", "").Where(w => w.CustomerName != null && w.CustomerName != "").ToList();
|
|
|
|
//bind customer contact no. of selected customer
|
|
var oCustomerContactNo = oCustomerList.Where(w => w.CustomerName.Equals(customerName));
|
|
foreach (var item11 in oCustomerContactNo)
|
|
{
|
|
contactNo = item11.CustomerMobile1;
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, contactNo = contactNo }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetCustomerContactNo", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get all states list
|
|
/// </summary>
|
|
/// <returns>returns json of state list</returns>
|
|
public ActionResult GetAllStateList()
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetAllStateList", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get states List
|
|
List<StateModel> oStateList = objTicketAdministrationRepository.GetStateList();
|
|
//Bind state list to state drop down list
|
|
List<SelectListItem> oStateNameList = new List<SelectListItem>();
|
|
|
|
foreach (StateModel items in oStateList)
|
|
{
|
|
oStateNameList.Add(new SelectListItem { Text = items.StateAlias, Value = items.StateId });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oStateNameList.OrderBy(o => o.Text) }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetAllStateList", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get all routes list
|
|
/// </summary>
|
|
/// <returns>returns json of routes list</returns>
|
|
public ActionResult GetAllRoutesList()
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetAllRoutesList", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get route List
|
|
List<RouteModel> oRouteList = objTicketAdministrationRepository.GetRoutesList();
|
|
|
|
//Bind route list to route drop down list
|
|
List<SelectListItem> oRouteNameList = new List<SelectListItem>();
|
|
|
|
foreach (RouteModel items in oRouteList)
|
|
{
|
|
oRouteNameList.Add(new SelectListItem { Text = items.Name, Value = items.Id.ToString() });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oRouteNameList.OrderBy(o => o.Text) }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetAllRoutesList", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get route id wise sla time
|
|
/// </summary>
|
|
/// <param name="RouteId">route id</param>
|
|
/// <returns>returns json of route wise sla time</returns>
|
|
public JsonResult GetRouteWiseSlaTime(int RouteId)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetRouteWiseSlaTime", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get all routes list
|
|
List<RouteModel> oRouteList = objTicketAdministrationRepository.GetRoutesList();
|
|
//Get sla time route wise
|
|
List<RouteModel> routeWiseSlaTime = oRouteList.Where(w => w.Id.Equals(RouteId)).ToList();
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { RouteWiseSlaTime = routeWiseSlaTime }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetRouteWiseSlaTime", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Full Ticket Details
|
|
|
|
/// <summary>
|
|
/// Get open and close ticket details
|
|
/// </summary>
|
|
/// <param name="ticketId">ticket id</param>
|
|
/// <param name="ticketStatus">ticket status</param>
|
|
/// <returns>return ticket full details list</returns>
|
|
public ActionResult TicketAdministration_GetTicketDetails_old(string ticketId, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetTicketDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get open and close ticket details list
|
|
List<TicketOpenCloseModel> oTicketOpenCloseModel = objTicketAdministrationRepository.Restful_GetOpenCloseTicketDetails(ticketId, ticketStatus);
|
|
|
|
//store in temp data
|
|
TempData["TicketDetailsForUpdate"] = oTicketOpenCloseModel;
|
|
|
|
//Global variables
|
|
string VRegistrationNo = ""; string CustomerContactNo = ""; int RouteId = 0; string routeName = ""; string VModelNo = ""; string VModelTagging = "";
|
|
|
|
//Getting details of vehicle and customer from ticket details list
|
|
foreach (var item in oTicketOpenCloseModel)
|
|
{
|
|
VRegistrationNo = item.VehicleRegisterNumber.ToString();
|
|
CustomerContactNo = item.CustomerContactNo;
|
|
RouteId = item.RouteId;
|
|
}
|
|
|
|
//Get owner details
|
|
List<CustomerOwnerModel> oCustomerOwnerDetailsList = objTicketAdministrationRepository.GetCustomerOwnerDetails(VRegistrationNo);
|
|
ViewBag.OwnerDetails = oCustomerOwnerDetailsList;
|
|
|
|
//Get vehicle details
|
|
List<VehicleModel> oVehicleDetailsList = objTicketAdministrationRepository.GetVehicleDetailsRegistrationNoWise(VRegistrationNo);
|
|
ViewBag.VehicleDetails = oVehicleDetailsList;
|
|
|
|
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;
|
|
}
|
|
ViewBag.ModelTagging = VModelTagging;
|
|
|
|
//Get customer details
|
|
List<CustomerModel> oCustomerList = objTicketAdministrationRepository.GetCustomerDetails("", CustomerContactNo, "");
|
|
oCustomerList.Where(w => w.CustomerMobile1.Equals(CustomerContactNo));
|
|
List<CustomerModel> itemCustomer = oCustomerList.Where(w => w.CustomerMobile1.Equals(CustomerContactNo)).ToList();
|
|
itemCustomer = itemCustomer.Where(w => w.VehicleRegistrationNumber.Equals(VRegistrationNo)).ToList();
|
|
itemCustomer = itemCustomer.Where(w => w.CustomerVehicleIsOwnwer.Equals(false)).ToList();
|
|
ViewBag.CustomerDetails = itemCustomer;
|
|
|
|
//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(oTicketOpenCloseModel);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetTicketDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <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 partia view</returns>
|
|
public ActionResult TicketAdministration_GetTicketDetails(string ticketId, string ticketStatus)
|
|
{
|
|
objLog.AddLogFile("Ticket_GetOpencloseTicketActivities", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get ticket full details list
|
|
List<TicketOpenCloseModel> oTicketDetails = new List<TicketOpenCloseModel>();
|
|
oTicketDetails = objTicketAdministrationRepository.Restful_GetOpenCloseTicketDetails(ticketId, ticketStatus).ToList();
|
|
var ticketDetails = oTicketDetails.GroupBy(g => g.TicketId).Select(s => s.FirstOrDefault()).ToList();
|
|
|
|
//store in temp data
|
|
TempData["TicketDetailsForUpdate"] = ticketDetails;
|
|
|
|
//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(ticketDetails);
|
|
}
|
|
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 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();
|
|
List<CustomerModel> itemCustomer = new List<CustomerModel>();
|
|
|
|
List<CustomerModel> oCustomerList = objTicketAdministrationRepository.GetCustomerDetails("", CustomerContactNo, ""); //Get customer details
|
|
|
|
//List<CustomerModel> itemCustomer = oCustomerList.Where(w => w.CustomerMobile1.Equals(CustomerContactNo)).ToList(); //Get those customers who has given contact no.
|
|
|
|
itemCustomer = oCustomerList.Where(w => w.VehicleRegistrationNumber.Equals(VRegistrationNo)).ToList(); //Get customer list who has vehicle of given vehicle registration no.
|
|
|
|
itemCustomer = itemCustomer.Where(w => w.CustomerVehicleIsOwnwer.Equals(false)).ToList(); //remove vehicle owner from customer's list
|
|
|
|
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 variant(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 Escalation Level Membbers
|
|
|
|
/// <summary>
|
|
/// Method to get escalation level members name and contact no.
|
|
/// </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("Ticket_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("Ticket_GetOpencloseTicketEscalationMembersDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region Create New Ticket
|
|
|
|
/// <summary>
|
|
/// Create new ticket
|
|
/// </summary>
|
|
/// <param name="model">TicketModel</param>
|
|
/// <returns>json</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_CreateTicket(TicketModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_CreateTicket", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objNotificationsRepository = new NotificationsRepository();
|
|
|
|
TicketModel oCreateTicketModel = new TicketModel();
|
|
oCreateTicketModel = objTicketAdministrationRepository.CreateTicket(model);
|
|
objLog.AddLogFile("TicketAdministration_CreateTicket", model, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model to web api
|
|
objLog.AddLogFile("TicketAdministration_CreateTicket", oCreateTicketModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model from web api
|
|
|
|
if (oCreateTicketModel.Status.ToString() == "1")
|
|
{
|
|
if (model.CreatedBy != "" && model.CreatedBy != null)
|
|
{
|
|
//Getting model of removed notification in case of KAM ticket
|
|
KamNotificationOutputModel objNotificationRemoveModel = objNotificationsRepository.RemoveSeenNotificationKam(model.CreatedBy);
|
|
objLog.AddLogFile("TicketAdministration_RemoveSeenNotificationsKam", objNotificationRemoveModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
if (objNotificationRemoveModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oCreateTicketModel.TicketId });
|
|
}
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oCreateTicketModel.TicketId });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = Convert.ToString(ConfigurationManager.AppSettings["create_ticket_failed"]) });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CreateTicket", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Ticket Activities and update Ticket status
|
|
|
|
/// <summary>
|
|
/// Get open and close ticket activity view
|
|
/// </summary>
|
|
/// <param name="ticketId">open or close ticket id</param>
|
|
/// <param name="ticketStatus">open or close ticket status</param>
|
|
/// <returns>return view</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_ShowTicketActivityOpenClose(string ticketId, string ticketStatus)
|
|
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_ShowTicketActivityOpenClose", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objDropDownDataRepository = new DropDownDataRepository();
|
|
List<OpenTicketActivityDetails> oOpenTicketActivityList = null;
|
|
List<CloseTicketActivityDetails> oCloseTicketActivityList = null;
|
|
TicketModel oUpdateTicketModel = new TicketModel();
|
|
|
|
string description = "";
|
|
string splitDescription = "";
|
|
int ticketStatusId = 0;
|
|
|
|
//Get open and close ticket details list
|
|
List<TicketOpenCloseModel> ticketDetailsList = objTicketAdministrationRepository.Restful_GetOpenCloseTicketDetails(ticketId, ticketStatus);
|
|
var ticketDetails = ticketDetailsList.GroupBy(g => g.TicketId).Select(s => s.FirstOrDefault()).ToList();
|
|
ViewBag.TicketDetailsUpdate = ticketDetails;
|
|
|
|
//Bind ticket details in view bag
|
|
foreach (var item in ticketDetails)
|
|
{
|
|
ViewBag.VRegistrationNo = item.VehicleRegisterNumber;
|
|
ViewBag.ticketDefaultSla = item.DefaultSlaTime;
|
|
ViewBag.TicketStatus = item.TicketStatus;
|
|
ViewBag.OpportunityLossReason = item.OpportunityLossReason;
|
|
ViewBag.RemarkTicketNotClosed24Hours = item.RemarkTicketNotClosed24Hours;
|
|
|
|
//----------------added on 25-11-2020 (start)-----------------------------
|
|
ViewBag.RemarkForTicketClosed = item.TicketClosedReason;
|
|
//----------------added on 25-11-2020 (end)-----------------------------
|
|
|
|
ViewBag.EstimatedRepairCost = item.RepairCost;
|
|
ViewBag.EstimatedRepairTime = item.EstimatedTimeForJobCompletion;
|
|
ViewBag.AssignTo = item.AssignedTo;
|
|
|
|
ViewBag.ChassisNo = item.ChassisNumber;
|
|
if ((item.VehicleRegisterNumber == "" || item.VehicleRegisterNumber == null) && item.ChassisNumber != "")
|
|
{
|
|
ViewBag.VRegistrationNo = item.ChassisNumber;
|
|
}
|
|
if ((item.VehicleType == "" || item.VehicleType == null) && item.ChassisNumber != "")
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<CHASSIS_SRCH_Model> oChassisList = new List<CHASSIS_SRCH_Model>();
|
|
oChassisList = objTicketAdministrationRepository.GetChassisNoByEOSApiSearch(item.ChassisNumber);
|
|
ViewBag.VehicleType = oChassisList.Select(s => s.VehicleType).FirstOrDefault();
|
|
//ViewBag.VehicleType = a.Data
|
|
}
|
|
else {
|
|
ViewBag.VehicleType = item.VehicleType;
|
|
}
|
|
|
|
|
|
ViewBag.OdometerReading = item.OdoMeter;
|
|
|
|
ViewBag.PreviousOdometerReading = item.PreviousOdometerReading;
|
|
ticketStatusId = item.TicketStatus;
|
|
if (item.SuggestionComment == null)
|
|
{
|
|
description = "";
|
|
}
|
|
else
|
|
{
|
|
description = item.SuggestionComment.ToString();
|
|
}
|
|
|
|
//remove new line or new row tags from string
|
|
string[] splitDescriptionArr = description.Split('\r', '\n');
|
|
|
|
foreach (string descriptionString in splitDescriptionArr)
|
|
{
|
|
splitDescription += descriptionString;
|
|
}
|
|
ViewBag.DescriptionMultiline = splitDescription;
|
|
oUpdateTicketModel.SuggestionComment = splitDescription;
|
|
|
|
}
|
|
|
|
//Get ticket status list
|
|
List<TicketStatus> oTicketStatusList = objTicketAdministrationRepository.GetTicketStatusList();
|
|
if (ticketDetails[0].AssignedTo == "dealer") {
|
|
var tripStartObj = oTicketStatusList.Where(w => w.Id == 9).FirstOrDefault();
|
|
if (tripStartObj != null)
|
|
{
|
|
oTicketStatusList.Remove(tripStartObj);
|
|
}
|
|
|
|
var tripEndObj = oTicketStatusList.Where(w => w.Id == 8).FirstOrDefault();
|
|
if (tripEndObj != null)
|
|
{
|
|
oTicketStatusList.Remove(tripEndObj);
|
|
}
|
|
|
|
}
|
|
//if (ticketStatusId > 1)
|
|
if (ticketStatusId > Convert.ToInt32(ConfigurationManager.AppSettings["New"]))
|
|
{
|
|
oTicketStatusList.RemoveAt(0);
|
|
ViewBag.TicketStatusList = oTicketStatusList;
|
|
}
|
|
else
|
|
{
|
|
ViewBag.TicketStatusList = oTicketStatusList;
|
|
}
|
|
|
|
//Get opportunity lost reason
|
|
List<OpportunityLostReasonsModel> oOpportunityLostReasonList = objDropDownDataRepository.GetOpprtunityLostReasonsList();
|
|
ViewBag.OpportunityLostReasonList = oOpportunityLostReasonList;
|
|
|
|
//----------***Get ticket closed reason list*** added on 25-11-2020 (start)-------------------------------
|
|
List<TicketClosedReason> oTicketClosedReason = objDropDownDataRepository.GetTicketClosedReason();
|
|
ViewBag.ReasonForTicketClosed = oTicketClosedReason;
|
|
//----------***Get ticket closed reason list*** added on 25-11-2020 (end)-------------------------------
|
|
|
|
oOpportunityLostReasonList = objDropDownDataRepository.GetAllDelayedReasonMorethan24Hrs();
|
|
ViewBag.ReasonForcloseTicketmorethan24Hrs = oOpportunityLostReasonList;
|
|
//Get opportunity lost reason
|
|
List<EstimateCostModel> oEstimatedRepairCostList = objDropDownDataRepository.GetEstimatedRepairCostList();
|
|
ViewBag.EstimatedRepairCostList = oEstimatedRepairCostList;
|
|
|
|
|
|
|
|
//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;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView();
|
|
}
|
|
//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();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_ShowTicketActivityOpenClose", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update ticket status
|
|
/// </summary>
|
|
/// <param name="model">Ticket model</param>
|
|
/// <returns>returns json success true or false</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_UpdateTicketOpenClose(TicketModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_UpdateTicketOpenClose", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
TicketModel oUpdateTicketModel = new TicketModel();
|
|
if (model.OpportunityLost == "--Select--")
|
|
{
|
|
model.OpportunityLost = "";
|
|
}
|
|
|
|
if (model.TicketStatus != 3)
|
|
{
|
|
model.RepairCost = "";
|
|
model.EstimatedTimeForJobCompletion = "";
|
|
}
|
|
|
|
//if (model.TicketStatus == 4) {
|
|
// if (model.VehicleType == "Tipper") {
|
|
// model.PreviousOdometerReading = model.PreviousOdometerReading;
|
|
// }
|
|
// else{
|
|
// model.PreviousOdometerReading = model.PreviousOdometerReadingHaulage;
|
|
// }
|
|
//}
|
|
oUpdateTicketModel = objTicketAdministrationRepository.UpdateTicketDetails(model);
|
|
objLog.AddLogFile("TicketAdministration_UpdateTicketOpenClose", model, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
objLog.AddLogFile("TicketAdministration_UpdateTicketOpenClose", oUpdateTicketModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
if (oUpdateTicketModel.Status.ToString() == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = model.TicketId, ticketStatus = model.TicketStatus ,message= oUpdateTicketModel.Message });
|
|
}
|
|
else if (oUpdateTicketModel.Status.ToString() == "2")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = oUpdateTicketModel.Message });
|
|
}
|
|
else if (oUpdateTicketModel.Status.ToString() == "5")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = oUpdateTicketModel.Message });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
//return Json(new { success = false, message = "Update ticket failed !!" });
|
|
return Json(new { success = false, message = Convert.ToString(ConfigurationManager.AppSettings["update_ticket_failed"]) });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_UpdateTicketOpenClose", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetAllVans
|
|
|
|
/// <summary>
|
|
/// Get all vans and dealers list for ticket assignment
|
|
/// </summary>
|
|
/// <param name="StateName">selected state name</param>
|
|
/// <param name="limit">vans and dealers limit</param>
|
|
/// <returns>returns json list of vans and dealers</returns>
|
|
public JsonResult GetAllNearestVansDealers(string StateName, string limit)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetAllNearestVansDealers", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<VanDealerModel> oNearestVansDealersList = new List<VanDealerModel>();
|
|
oNearestVansDealersList = objTicketAdministrationRepository.GetAllNearestVansDealersList(StateName, limit);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { NearestVansDealers = oNearestVansDealersList }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetAllNearestVansDealers", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
// by multiple state (2)
|
|
public JsonResult GetVansDealersbyStates(string StateName, string limit, string StateName2)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetAllNearestVansDealers", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<VanDealerModel> oNearestVansDealersList = new List<VanDealerModel>();
|
|
List<VanDealerModel> oNearestVansDealersList2 = new List<VanDealerModel>();
|
|
oNearestVansDealersList = objTicketAdministrationRepository.GetAllNearestVansDealersList(StateName, limit);
|
|
if (StateName2 != "") {
|
|
oNearestVansDealersList2 = objTicketAdministrationRepository.GetAllNearestVansDealersList(StateName2, limit);
|
|
}
|
|
oNearestVansDealersList= oNearestVansDealersList.Concat(oNearestVansDealersList2).ToList();
|
|
|
|
//oNearestVansDealersList.AddRange(oNearestVansDealersList2);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { NearestVansDealers = oNearestVansDealersList }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetAllNearestVansDealers", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Reassign Ticket
|
|
|
|
/// <summary>
|
|
/// Get partial view as popup window for reassign ticket
|
|
/// </summary>
|
|
/// <returns>return partial view</returns>
|
|
public ActionResult TicketAdministration_ReassignTicket()
|
|
{
|
|
return PartialView();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region feedback
|
|
|
|
/// <summary>
|
|
/// Get partial view of feedback detail page.
|
|
/// </summary>
|
|
/// <param name="selectTicketId">selected ticket id</param>
|
|
/// <param name="ticketCreationTime">creation
|
|
///
|
|
///
|
|
/// of ticket</param>
|
|
/// <param name="isMoreThan24Hrs">time between ticket open and close(in hours)</param>
|
|
/// <returns>return partial view</returns>
|
|
public ActionResult TicketAdministration_Feedback(string selectTicketId, string ticketCreationTime, double isMoreThan24Hrs)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_Feedback", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
FeedBackModel objFeedbackHistory = new FeedBackModel();
|
|
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 Suggestion list
|
|
List<FeedbackSuggestionComplaintModel> objSuggestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("suggestion");
|
|
List<SelectListItem> item2 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objSuggestionsList)
|
|
{
|
|
item2.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.Suggestions = item2.OrderBy(o => o.Text);
|
|
|
|
//Get complaints list
|
|
List<FeedbackSuggestionComplaintModel> objComplaintsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("reason_list");
|
|
List<SelectListItem> item3 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objComplaintsList)
|
|
{
|
|
item3.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.Complaint = item3.OrderBy(o => o.Text);
|
|
|
|
//Get call status list
|
|
List<FeedbackSuggestionComplaintModel> objCallStatusList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("callstatus");
|
|
List<SelectListItem> item5 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objCallStatusList)
|
|
{
|
|
item5.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.CallStatus = item5.OrderBy(o => o.Text);
|
|
|
|
//Get 24 hrs reasons list
|
|
List<FeedbackSuggestionComplaintModel> obj24HrsReasonsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("24hrs");
|
|
List<SelectListItem> item4 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in obj24HrsReasonsList)
|
|
{
|
|
item4.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.Reason24Hrs = item4.OrderBy(o => o.Text);
|
|
|
|
|
|
//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);
|
|
//objFeedbackModel = objTicketAdministrationRepository.GetFeedBackDetailsTicketIdWise(selectTicketId, "20 Sep 2023 09:45:41");
|
|
// List<FeedbackSuggestionComplaintModel> objReasonList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("reason_list");
|
|
// ViewBag.FeedBackReasons = objReasonList;
|
|
|
|
//Get Suggestion list
|
|
/* List<FeedbackSuggestionComplaintModel> objSuggestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("reason_list"); ;
|
|
List<SelectListItem> item2 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objSuggestionsList)
|
|
{
|
|
item2.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.Suggestions = item2.OrderBy(o => o.Text);*/
|
|
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("TicketAdministration_Feedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Submit Feedback
|
|
/// </summary>
|
|
/// <param name="model">FeedBackModel</param>
|
|
/// <returns>return json success true or false</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_CreateFeedback(FeedBackModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_CreateFeedback", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
string suggestionComplaint = null;
|
|
string Complaint = null;
|
|
|
|
//Get multiple suggestions
|
|
if (model.SuggestionComplaintList != null)
|
|
{
|
|
foreach (var item in model.SuggestionComplaintList)
|
|
{
|
|
suggestionComplaint += item + ",";
|
|
}
|
|
suggestionComplaint = suggestionComplaint.Remove(suggestionComplaint.Length - 1);
|
|
model.SuggestionComplaint = suggestionComplaint;
|
|
|
|
}
|
|
|
|
//Get multiple complaints
|
|
if (model.ComplaintList != null)
|
|
{
|
|
foreach (var item in model.ComplaintList)
|
|
{
|
|
Complaint += item + ",";
|
|
}
|
|
Complaint = Complaint.Remove(Complaint.Length - 1);
|
|
model.Complaint = Complaint;
|
|
|
|
}
|
|
|
|
objFeedbackModel = objTicketAdministrationRepository.CreateFeedbackReason(model, "feedback");
|
|
if (objFeedbackModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = model.TicketId });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CreateFeedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Submit Reason for closure ticket after 24 or more than 24 hours of ticket open
|
|
/// </summary>
|
|
/// <param name="model">FeedBackModel</param>
|
|
/// <returns>return json success true or false</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_SubmitReason(FeedBackModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_SubmitReason", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
|
|
objFeedbackModel = objTicketAdministrationRepository.CreateFeedbackReason(model, "reason");
|
|
if (objFeedbackModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = model.TicketId });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_SubmitReason", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Edit feedback details
|
|
/// </summary>
|
|
/// <param name="selectTicketId">selected ticket id</param>
|
|
/// <param name="ticketCreationTime">creation time of ticket</param>
|
|
/// <param name="isMoreThan24Hrs">open hrs of ticket</param>
|
|
/// <returns>return partial view</returns>
|
|
public ActionResult TicketAdministration_EditFeedback(string selectTicketId, string ticketCreationTime, double isMoreThan24Hrs)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_EditFeedback", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
|
|
if (selectTicketId != null)
|
|
{
|
|
ViewBag.TicketId = selectTicketId;
|
|
ViewBag.CreationTime = ticketCreationTime;
|
|
ViewBag.IsMoreThan24Hrs = isMoreThan24Hrs;
|
|
|
|
//Get feedback details
|
|
objFeedbackModel = objTicketAdministrationRepository.GetFeedBackDetailsTicketIdWise(selectTicketId, ticketCreationTime);
|
|
|
|
//Get Feedback questions
|
|
List<FeedbackSuggestionComplaintModel> objFeedbackQuestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("feedback");
|
|
ViewBag.FeedbackQuestions = objFeedbackQuestionsList;
|
|
|
|
//Get Suggestion list
|
|
List<FeedbackSuggestionComplaintModel> objSuggestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("suggestion");
|
|
List<SelectListItem> item2 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objSuggestionsList)
|
|
{
|
|
item2.Add(new SelectListItem { Selected = ((items.ReasonName).Trim().ToLower() == (objFeedbackModel.SuggestionComplaint).Trim().ToLower()), Text = (items.ReasonName).Trim(), Value = (items.ReasonName).Trim() });
|
|
}
|
|
ViewBag.Suggestions = item2.OrderBy(o => o.Text);
|
|
|
|
/* List<FeedbackSuggestionComplaintModel> objSuggestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("reason_list"); ;
|
|
List<SelectListItem> item2 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objSuggestionsList)
|
|
{
|
|
item2.Add(new SelectListItem { Text = items.ReasonName, Value = items.ReasonName });
|
|
}
|
|
ViewBag.Suggestions = item2.OrderBy(o => o.Text);*/
|
|
|
|
//Temp list of suggestions
|
|
List<string> suggestionList = new List<string>();//1st list
|
|
foreach (var suggestion in item2)
|
|
{
|
|
suggestionList.Add(suggestion.Value);
|
|
}
|
|
|
|
//Get Selected suggestions list
|
|
string[] selectedSuggestionWithOther = null;
|
|
string[] arrSuggestion = null;
|
|
List<string> selectedSuggestionsList = null;
|
|
|
|
if (objFeedbackModel.SuggestionComplaint.Trim() != "")
|
|
{
|
|
arrSuggestion = objFeedbackModel.SuggestionComplaint.Trim().Split(',');
|
|
selectedSuggestionsList = arrSuggestion.ToList();//2nd list
|
|
|
|
//Compare 1 and 2 list
|
|
var resultSet = selectedSuggestionsList.Except(suggestionList);
|
|
if (resultSet != null)
|
|
{
|
|
foreach (var otherSuggestion in resultSet.ToList())
|
|
{
|
|
objFeedbackModel.otherSuggestion = otherSuggestion;
|
|
selectedSuggestionsList.Remove(otherSuggestion);
|
|
selectedSuggestionsList.Add("Other");
|
|
}
|
|
}
|
|
// Get final selected suggestions
|
|
selectedSuggestionWithOther = selectedSuggestionsList.ToArray();
|
|
}
|
|
|
|
//Get complaints list
|
|
List<FeedbackSuggestionComplaintModel> objComplaintsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("reason_list");
|
|
List<SelectListItem> item3 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objComplaintsList)
|
|
{
|
|
item3.Add(new SelectListItem { Text = (items.ReasonName).Trim(), Value = (items.ReasonName).Trim() });
|
|
}
|
|
ViewBag.Complaint = item3.OrderBy(o => o.Text);
|
|
|
|
//Temp list of complaints
|
|
List<string> complaintList = new List<string>();//1st list
|
|
foreach (var complaint in item3)
|
|
{
|
|
complaintList.Add(complaint.Value);
|
|
}
|
|
|
|
//Get Selected complaints list
|
|
string[] selectedComplaintWithOther = null;
|
|
string[] arrComplaint = null;
|
|
List<string> selectedComplaintsList = new List<string>();
|
|
|
|
if (objFeedbackModel.Complaint.Trim() != "")
|
|
{
|
|
arrComplaint = objFeedbackModel.Complaint.Trim().Split(',');
|
|
selectedComplaintsList = arrComplaint.ToList();//2nd list
|
|
|
|
//Compare 1 and 2 list
|
|
var resultComplaint = selectedComplaintsList.Except(complaintList);
|
|
if (resultComplaint != null)
|
|
{
|
|
foreach (var otherComplaint in resultComplaint.ToList())
|
|
{
|
|
objFeedbackModel.otherComplaint = otherComplaint;
|
|
selectedComplaintsList.Remove(otherComplaint);
|
|
selectedComplaintsList.Add("Other");
|
|
}
|
|
}
|
|
// Get final selected complaints
|
|
selectedComplaintWithOther = selectedComplaintsList.ToArray();
|
|
}
|
|
|
|
//Get call status list
|
|
List<FeedbackSuggestionComplaintModel> objCallStatusList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("callstatus");
|
|
List<SelectListItem> item5 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objCallStatusList)
|
|
{
|
|
item5.Add(new SelectListItem { Selected = ((items.ReasonName).Trim().ToLower() == (objFeedbackModel.CallStatus).Trim().ToLower()), Text = (items.ReasonName).Trim(), Value = (items.ReasonName) });
|
|
}
|
|
ViewBag.CallStatus = item5.OrderBy(o => o.Text);
|
|
|
|
string CallStatus = (objFeedbackModel.CallStatus).Trim();
|
|
if (CallStatus != null && CallStatus != "")
|
|
{
|
|
var otherCallStatus = objCallStatusList.Where(w => w.ReasonName.Equals(CallStatus)).FirstOrDefault();
|
|
if (otherCallStatus == null)
|
|
{
|
|
objFeedbackModel.otherCallStatus = CallStatus;
|
|
objFeedbackModel.CallStatus = "Other";
|
|
}
|
|
}
|
|
ViewBag.CallStatusValue = (objFeedbackModel.CallStatus).Trim();
|
|
|
|
// Send suggestion list and complaint list
|
|
if (selectedSuggestionWithOther != null)
|
|
{
|
|
ViewBag.SuggestionArray = selectedSuggestionWithOther.ToArray();
|
|
}
|
|
else
|
|
{
|
|
selectedSuggestionWithOther = new string[] { " " };
|
|
ViewBag.SuggestionArray = selectedSuggestionWithOther;
|
|
}
|
|
if (selectedComplaintWithOther != null)
|
|
{
|
|
ViewBag.ComplaintArray = selectedComplaintWithOther.ToArray();
|
|
}
|
|
else
|
|
{
|
|
selectedComplaintWithOther = new string[] { " " };
|
|
ViewBag.ComplaintArray = selectedComplaintWithOther;
|
|
}
|
|
|
|
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("TicketAdministration_EditFeedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Manage Escallation New
|
|
|
|
/// <summary>
|
|
/// Show page of Escalation.
|
|
/// </summary>
|
|
/// <returns>Escalation view</returns>
|
|
public ActionResult ManageEscalation()
|
|
{
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
objInventoryRepository = new InventoryModelRepository();
|
|
_LoginUserId = Session["UserName"].ToString();
|
|
//Getting non-vecv users list
|
|
List<OrganizationModel> oRegionList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> item11 = new List<SelectListItem>();
|
|
|
|
foreach (OrganizationModel items in oRegionList)
|
|
{
|
|
item11.Add(new SelectListItem { Text = items.Region, Value = items.Id.ToString() });
|
|
}
|
|
|
|
return View(item11.OrderBy(o => o.Text));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Show Escalation to web page
|
|
/// </summary>
|
|
/// <param name="dealerId">selected dealer id</param>
|
|
/// <param name="stateId">selected region's organization id</param>
|
|
/// <returns>Escalation matrix partial view</returns>
|
|
public ActionResult ManageEscalation_Details(string dealerId, int stateId)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_Details", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get List
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(null, ConfigurationManager.AppSettings["GetAll"], null, null, _pageSize, 0, null, stateId);
|
|
List<EscalationMatrix> oList = oModel.EscalationMatrixList;
|
|
|
|
//Get count
|
|
EscalationModel oModelCount = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(null, ConfigurationManager.AppSettings["Count"], null, null, _pageSize, 0, null, stateId);
|
|
int total = oModelCount.TicketCount;
|
|
|
|
ViewBag.pageSize = _pageSize;
|
|
ViewBag.total = total;
|
|
ViewBag.OrganizationId = stateId;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oList);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_Details", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get data with kendo grid paging and filtering server side
|
|
/// </summary>
|
|
/// <param name="request">data source requset from kendo grid</param>
|
|
/// <param name="stateId">selected region's organization id</param>
|
|
/// <param name="total">total no. of rows in each page of kendo grid</param>
|
|
/// <returns>returns filtered and fixed size data</returns>
|
|
public ActionResult ManageEscalation_Details_Pager([DataSourceRequest]DataSourceRequest request, int stateId, int total)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_Details_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[6]);
|
|
// get query from filter object,
|
|
query = FilterKendoGrid.CreateFilterQueryEscalation(filterData);
|
|
}
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get List
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(null, ConfigurationManager.AppSettings["GetAll"], null, null, request.PageSize, request.PageSize * (request.Page - 1), query, stateId);
|
|
List<EscalationMatrix> oList = oModel.EscalationMatrixList;
|
|
|
|
//Get count
|
|
EscalationModel oModelCount = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(null, ConfigurationManager.AppSettings["Count"], null, null, request.PageSize, request.PageSize * (request.Page - 1), query, stateId);
|
|
int totalCount = oModelCount.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;
|
|
}
|
|
}
|
|
//private void ModifyFilters(IEnumerable<IFilterDescriptor> filters)
|
|
//{
|
|
// if (filters.Any())
|
|
// {
|
|
// foreach (var filter in filters)
|
|
// {
|
|
// var descriptor = filter as FilterDescriptor;
|
|
// if (descriptor != null && descriptor.Member == "SomeField")
|
|
// {
|
|
// descriptor.Member = "SomeOtherField";
|
|
// }
|
|
// else if (filter is CompositeFilterDescriptor)
|
|
// {
|
|
// ModifyFilters(((CompositeFilterDescriptor)filter).FilterDescriptors);
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
/// <summary>
|
|
/// Returns Create Escalation view.
|
|
/// </summary>
|
|
/// <returns>ActionResult</returns>
|
|
[HttpGet]
|
|
public ActionResult CreateEscalation()
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_CreateEscalation", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
objInventoryRepository = new InventoryModelRepository();
|
|
|
|
//Getting Organization list user wise
|
|
List<OrganizationModel> oOrganizationList = objUserInventoryRepository.GetOrganizationList();
|
|
List<SelectListItem> oOrganizationNameList = new List<SelectListItem>();
|
|
|
|
foreach (OrganizationModel items in oOrganizationList)
|
|
{
|
|
oOrganizationNameList.Add(new SelectListItem { Text = items.OrganizationName, Value = items.Id.ToString() });
|
|
}
|
|
ViewBag.OrganizationList = oOrganizationNameList.OrderBy(o => o.Text);
|
|
|
|
//Getting State list
|
|
List<StateModel> oStateList = objUserInventoryRepository.GetStateList();
|
|
List<SelectListItem> oStateNameList = new List<SelectListItem>();
|
|
|
|
foreach (StateModel items in oStateList)
|
|
{
|
|
oStateNameList.Add(new SelectListItem { Text = items.StateAlias, Value = items.StateId });
|
|
}
|
|
ViewBag.StateList = oStateNameList.OrderBy(o => o.Text);
|
|
|
|
// dummy list for City/Van Type
|
|
List<SelectListItem> serviceList1 = new List<SelectListItem>();
|
|
ViewBag.Service = serviceList1;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_CreateEscalation", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns list for services based on the device id.
|
|
/// </summary>
|
|
/// <param name="organizationId">Selected Organization id</param>
|
|
/// <returns>json</returns>
|
|
public ActionResult GetDealerListOrganizationWise(int organizationId)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_GetDealerListOrganizationWise", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objInventoryRepository = new InventoryModelRepository();
|
|
string _LoginUserId = Session["UserId"].ToString();
|
|
|
|
//Get dealer list
|
|
List<DealerListOrganizationWise> oDealerListOrganizationWise = objTicketAdministrationRepository.GetDealerListOrganizationWise(organizationId).Where(p => p.IsDeleted == false).ToList();
|
|
List<SelectListItem> oDealerNameList = new List<SelectListItem>();
|
|
|
|
foreach (DealerListOrganizationWise items in oDealerListOrganizationWise)
|
|
{
|
|
oDealerNameList.Add(new SelectListItem { Text = items.sDlrNamewithDealerId, Value = items.DealerId });
|
|
}
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, list = oDealerNameList }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_GetDealerListOrganizationWise", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// save escalation details.
|
|
/// post/CreateEscalation
|
|
/// </summary>
|
|
/// <param name="model">EscalationMatrix model</param>
|
|
/// <returns>json, true for success otherwise false</returns>
|
|
[HttpPost]
|
|
public ActionResult CreateEscalation(EscalationMatrix model)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_CreateEscalation", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
model.dealer_name_id = model.dealer_name;
|
|
string vehicleTagging = null;
|
|
|
|
//Send request to App DB to insert new user data
|
|
if (model.VehicleTaggingList != null)
|
|
{
|
|
foreach (var item in model.VehicleTaggingList)
|
|
{
|
|
vehicleTagging += item + ",";
|
|
}
|
|
vehicleTagging = vehicleTagging.Remove(vehicleTagging.Length - 1);
|
|
model.van_type = vehicleTagging;
|
|
|
|
}
|
|
|
|
// Notificatiopn Type
|
|
if ((model.EmailType != null || model.emails != null) && (model.SMSType != null || model.phones != null))
|
|
{
|
|
model.notification_type = model.EmailType + "," + model.SMSType;
|
|
}
|
|
else if ((model.EmailType != null || model.emails != null))
|
|
{
|
|
model.notification_type = model.EmailType;
|
|
}
|
|
else
|
|
{
|
|
model.notification_type = model.SMSType;
|
|
}
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(model.id, ConfigurationManager.AppSettings["Insert"], null, model, 0, 0, null, model.organization_id);
|
|
if (oModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, dealerId = model.dealer_name_id, stateId = model.organization_id }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_CreateEscalation", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Delete the Escalation based on escalation id.
|
|
/// </summary>
|
|
/// <param name="escalationId">Id of Escalation</param>
|
|
/// <returns>json</returns>
|
|
[HttpPost]
|
|
public ActionResult DeleteEscalation(string escalationId)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_DeleteEscalation", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(escalationId, ConfigurationManager.AppSettings["Delete"], null, null, 0, 0, null, 0);
|
|
if (oModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_DeleteEscalation", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns Edit Escalation View.
|
|
/// </summary>
|
|
/// <param name="escalationId">Escalation Id</param>
|
|
/// <returns>Partial view.</returns>
|
|
public ActionResult EditEscalation(string escalationId)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_EditEscalation", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objUserInventoryRepository = new UserInventoryRepository();
|
|
|
|
List<string> productVariantArray = new List<string>();
|
|
//Getting State list
|
|
List<StateModel> oStateList = objUserInventoryRepository.GetStateList();
|
|
List<SelectListItem> oStateNameList = new List<SelectListItem>();
|
|
|
|
foreach (StateModel items in oStateList)
|
|
{
|
|
oStateNameList.Add(new SelectListItem { Text = items.StateAlias, Value = items.StateId });
|
|
}
|
|
ViewBag.StateList = oStateNameList.OrderBy(o => o.Text);
|
|
|
|
// dummy list for City/Van Type
|
|
List<SelectListItem> serviceList1 = new List<SelectListItem>();
|
|
ViewBag.Service = serviceList1;
|
|
|
|
//Get details of escalation to be edited
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(escalationId, ConfigurationManager.AppSettings["Get"], null, null, 0, 0, null, 0);
|
|
List<EscalationMatrix> oList = oModel.EscalationMatrixList;
|
|
|
|
var oListEscalationDetails = oList.GroupBy(g => g.id).Select(s => s.FirstOrDefault()).ToList();
|
|
|
|
foreach (var item in oListEscalationDetails)
|
|
{
|
|
|
|
ViewBag.ManagerLevel = item.manager_level;
|
|
ViewBag.State = item.state;
|
|
ViewBag.City = item.city;
|
|
//if (item.van_type.Contains(","))
|
|
//{
|
|
// string tempType = "";
|
|
// tempType = item.van_type.Replace(@",", @"','");
|
|
|
|
// tempType = tempType.Replace("\"", "'");
|
|
// item.van_type = tempType;
|
|
//}
|
|
ViewBag.ProductVariant = item.van_type;
|
|
productVariantArray.AddRange(item.van_type.Split(','));
|
|
//productVariantArray[0] = item.van_type;
|
|
|
|
ViewBag.OldContacts = item.phones; //old contact nos
|
|
}
|
|
productVariantArray.TrimExcess();
|
|
ViewBag.ProductVariant = productVariantArray;
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(oListEscalationDetails);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_EditEscalation", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Post/UpdateDeviceConnection.
|
|
/// Update Escalation
|
|
/// </summary>
|
|
/// <param name="model">EscalationMatrix Model</param>
|
|
/// <returns>Json</returns>
|
|
[HttpPost]
|
|
public ActionResult UpdateEscalation(EscalationMatrix model)
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_UpdateEscalation", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
|
|
//var dd = model.oldContactNo;
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
model.dealer_name_id = model.dealer_name;
|
|
string vehicleTagging = null;
|
|
|
|
//Send request to App DB to insert new user data
|
|
if (model.VehicleTaggingList != null)
|
|
{
|
|
foreach (var item in model.VehicleTaggingList)
|
|
{
|
|
vehicleTagging += item + ",";
|
|
}
|
|
vehicleTagging = vehicleTagging.Remove(vehicleTagging.Length - 1);
|
|
model.van_type = vehicleTagging;
|
|
|
|
}
|
|
|
|
// Notificatiopn Type
|
|
if (model.EmailType != null && model.SMSType != null)
|
|
{
|
|
model.notification_type = model.EmailType + "," + model.SMSType;
|
|
}
|
|
else if (model.EmailType != null)
|
|
{
|
|
model.notification_type = model.EmailType;
|
|
}
|
|
else
|
|
{
|
|
model.notification_type = model.SMSType;
|
|
}
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(model.id, ConfigurationManager.AppSettings["Update"], null, model, 0, 0, null, model.organization_id);
|
|
if (oModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
//update contact nos in whole application
|
|
EscalationModel oModelContactUpadte = objTicketAdministrationRepository.UpdateContactNo(model.oldContactNo, model.phones, model.manager_name);
|
|
if (oModelContactUpadte.Status != "0")
|
|
{
|
|
return Json(new { success = true, dealerId = model.dealer_name_id, stateId = model.organization_id }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
}
|
|
else if (oModel.Status == "2")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = oModel.Message }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_UpdateEscalation", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To export Escalation details.
|
|
/// </summary>
|
|
/// <returns>generated excel file path</returns>
|
|
[HttpPost]
|
|
public string ManageEscalation_ExportToExcel()
|
|
{
|
|
objLog.AddLogFile("ManageEscalation_ExportToExcel", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
string filename = null;
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
|
|
//Get list of escalation
|
|
EscalationModel oModel = objTicketAdministrationRepository.GetSetEditDeleteEscalationLevel(null, ConfigurationManager.AppSettings["Get"], null, null, 0, 0, null, 0);
|
|
List<EscalationMatrix> oList = new List<EscalationMatrix>();
|
|
|
|
oList.AddRange(oModel.EscalationMatrixList);
|
|
DataTable escalationTable = oList.ToDataTable();
|
|
|
|
// getting required dataset
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(escalationTable);
|
|
|
|
//==================== Data table Manipulations =====================
|
|
|
|
//Remove columns
|
|
ds.Tables[0].Columns.Remove("id");
|
|
ds.Tables[0].Columns.Remove("region_name");
|
|
ds.Tables[0].Columns.Remove("organization_id");
|
|
ds.Tables[0].Columns.Remove("StateName");
|
|
//ds.Tables[0].Columns.Remove("DealerId");
|
|
ds.Tables[0].Columns.Remove("EmailType");
|
|
ds.Tables[0].Columns.Remove("SMSType");
|
|
ds.Tables[0].Columns.Remove("sDlrNamewithDealerId");
|
|
|
|
//Change Order of columns
|
|
ds.Tables[0].Columns["organization_name"].SetOrdinal(0);
|
|
ds.Tables[0].Columns["manager_name"].SetOrdinal(1);
|
|
ds.Tables[0].Columns["manager_level"].SetOrdinal(2);
|
|
ds.Tables[0].Columns["dealer_name"].SetOrdinal(3);
|
|
ds.Tables[0].Columns["dealer_name_id"].SetOrdinal(4);
|
|
ds.Tables[0].Columns["state"].SetOrdinal(5);
|
|
ds.Tables[0].Columns["city"].SetOrdinal(6);
|
|
ds.Tables[0].Columns["blind_spot"].SetOrdinal(7);
|
|
ds.Tables[0].Columns["van_type"].SetOrdinal(8);
|
|
ds.Tables[0].Columns["notification_type"].SetOrdinal(9);
|
|
ds.Tables[0].Columns["emails"].SetOrdinal(10);
|
|
ds.Tables[0].Columns["phones"].SetOrdinal(11);
|
|
ds.Tables[0].Columns["alarm_age"].SetOrdinal(12);
|
|
ds.Tables[0].Columns["alarm_age_sla_not_met"].SetOrdinal(13);
|
|
ds.Tables[0].Columns["alarm_age_ticket_not_closed"].SetOrdinal(14);
|
|
ds.Tables[0].Columns["alarm_age_van_not_live"].SetOrdinal(15);
|
|
ds.Tables[0].Columns["alarm_age_eicher_promise_48hrs"].SetOrdinal(16);
|
|
|
|
//Set column name
|
|
ds.Tables[0].Columns[0].ColumnName = "Organization";
|
|
ds.Tables[0].Columns[1].ColumnName = "Manager Name";
|
|
ds.Tables[0].Columns[2].ColumnName = "Manager Level";
|
|
ds.Tables[0].Columns[3].ColumnName = "Dealer Name";
|
|
ds.Tables[0].Columns[4].ColumnName = "SCode";
|
|
ds.Tables[0].Columns[5].ColumnName = "State";
|
|
ds.Tables[0].Columns[6].ColumnName = "City";
|
|
ds.Tables[0].Columns[7].ColumnName = "Blind Spot";
|
|
ds.Tables[0].Columns[8].ColumnName = "Product Variant";
|
|
ds.Tables[0].Columns[9].ColumnName = "Notification Type";
|
|
ds.Tables[0].Columns[10].ColumnName = "Email Address";
|
|
ds.Tables[0].Columns[11].ColumnName = "Contact No.";
|
|
ds.Tables[0].Columns[12].ColumnName = "Van Not Move(In Min)";
|
|
ds.Tables[0].Columns[13].ColumnName = "SLA Not Met(In Min)";
|
|
ds.Tables[0].Columns[14].ColumnName = "Ticket Not Closed(In Min)";
|
|
ds.Tables[0].Columns[15].ColumnName = "Van Not Live(In Min)";
|
|
ds.Tables[0].Columns[16].ColumnName = "Eicher Promise(In Min)";
|
|
//==================== Data table Manipulation End =====================
|
|
|
|
//================================ Excel Functionality ===================================//
|
|
|
|
filename = "EscalationMatrix_" + DateTime.Now.ToString("ddMMMyyyyhhmmss") + ".xlsx";
|
|
string SaveCsvAs = Server.MapPath(_excelExportPathOnServer + filename);
|
|
|
|
bool isCreated = CreateExcelFile.CreateExcelDocument(ds, SaveCsvAs);
|
|
if (isCreated == true)
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return _exportLocation + filename;
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return "error";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("ManageEscalation_ExportToExcel", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region get kam ticket details
|
|
|
|
/// <summary>
|
|
/// Get KAM ticket details list for ticket assignment by CCE
|
|
/// </summary>
|
|
/// <param name="kamTicketId">selected KAM ticket id</param>
|
|
/// <returns>returns json list of KAM ticket details</returns>
|
|
public JsonResult GetKamTicketDetails(Int32 kamTicketId)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetKamTicketDetails", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<KamTicketModel> objModel = new List<KamTicketModel>();
|
|
objModel = objTicketAdministrationRepository.GetKamTicketDetails(kamTicketId);
|
|
|
|
if (objModel.Count() > 0)
|
|
{
|
|
if (objModel[0].KamTicketId != null || objModel[0].KamTicketId != "")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, kamTicketDetails = objModel[0] }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetKamTicketDetails", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region ticket dealer reason view
|
|
|
|
/// <summary>
|
|
/// Get view of Kendo window to fill Reason for dealer ticket assignment
|
|
/// </summary>
|
|
/// <returns>partial view</returns>
|
|
public ActionResult Ticket_GetDealerTicketReasonView()
|
|
{
|
|
return PartialView();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get view of Kendo window to fill Reason for dealer ticket re-assignment
|
|
/// </summary>
|
|
/// <returns>partial view</returns>
|
|
public ActionResult Ticket_GetDealerTicketReassignReasonView()
|
|
{
|
|
return PartialView();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region Save Ticket Details
|
|
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_SaveTicket(TicketModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_SaveTicket", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objNotificationsRepository = new NotificationsRepository();
|
|
|
|
TicketModel oSaveTicketModel = new TicketModel();
|
|
oSaveTicketModel = objTicketAdministrationRepository.SaveTicketDetails(model);
|
|
objLog.AddLogFile("TicketAdministration_CreateTicket", model, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model to web api
|
|
objLog.AddLogFile("TicketAdministration_CreateTicket", oSaveTicketModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model from web api
|
|
|
|
if (oSaveTicketModel.Status.ToString() == "1")
|
|
{
|
|
if (model.CreatedBy != "" && model.CreatedBy != null)
|
|
{
|
|
//Getting model of removed notification in case of KAM ticket
|
|
KamNotificationOutputModel objNotificationRemoveModel = objNotificationsRepository.RemoveSeenNotificationKam(model.CreatedBy);
|
|
objLog.AddLogFile("TicketAdministration_RemoveSeenNotificationsKam", objNotificationRemoveModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
if (objNotificationRemoveModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oSaveTicketModel.TicketId, successMessage = Convert.ToString(ConfigurationManager.AppSettings["save_ticket_success"]) });
|
|
}
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oSaveTicketModel.TicketId, successMessage = Convert.ToString(ConfigurationManager.AppSettings["save_ticket_success"]) });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = Convert.ToString(ConfigurationManager.AppSettings["save_ticket_failed"]) });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CreateTicket", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
/// <summary>
|
|
/// GEt engine number by search.
|
|
/// </summary>
|
|
/// <param name="engineBySearch">enginenumber</param>
|
|
|
|
/// <returns>return list</returns>
|
|
public JsonResult GetEngineNoByEOSApiSearch(string chassisBySearch)
|
|
{
|
|
objLog.AddLogFile("GetEngineNoByEOSApiSearch", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<Engine_SRCH_Model> oChassisList = new List<Engine_SRCH_Model>();
|
|
oChassisList = objTicketAdministrationRepository.GetEngineNoByEOSApiSearch(chassisBySearch);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(oChassisList, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("GetEngineNoByEOSApiSearch", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
// get chassis number by search
|
|
/// <summary>
|
|
/// Get all vans and dealers list for ticket assignment
|
|
/// </summary>
|
|
/// <param name="chassisBySearch">selected state name</param>
|
|
/// <param name="ticketID">vans and dealers limit</param>
|
|
/// <returns>returns json list of vans and dealers</returns>
|
|
public JsonResult GetChassisNoByEOSApiSearch(string chassisBySearch, string ticketID)
|
|
{
|
|
objLog.AddLogFile("GetChassisNoByEOSpiSearch", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
if (ticketID.Contains("P"))
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<Engine_SRCH_Model> oChassisList = new List<Engine_SRCH_Model>();
|
|
oChassisList = objTicketAdministrationRepository.GetEngineNoByEOSApiSearch(chassisBySearch);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(oChassisList, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<CHASSIS_SRCH_Model> oChassisList = new List<CHASSIS_SRCH_Model>();
|
|
oChassisList = objTicketAdministrationRepository.GetChassisNoByEOSApiSearch(chassisBySearch);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(oChassisList, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("GetChassisNoByEOSpiSearch", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
// get Odometer by chassis number
|
|
/// <summary>
|
|
/// Get all vans and dealers list for ticket assignment
|
|
/// </summary>
|
|
/// <param name="chassisBySearch">selected state name</param>
|
|
/// <param name="ticketID">vans and dealers limit</param>
|
|
/// <returns>returns json list of vans and dealers</returns>
|
|
public JsonResult GetOdoMeterBYChassisNo(string chassisNumber, string ticketIDAlias)
|
|
{
|
|
objLog.AddLogFile("GetOdoMeterBYChassisNo", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
CHASSIS_ODOMETER_Model oOdoMeterModel = new CHASSIS_ODOMETER_Model();
|
|
oOdoMeterModel = objTicketAdministrationRepository.GetOdoMeterBYChassisNumber(chassisNumber, ticketIDAlias);
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(oOdoMeterModel, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("GetChassisNoByEOSpiSearch", 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 TicketAdministration_FeedbackNew(string selectTicketId, string ticketCreationTime, double isMoreThan24Hrs, string isFeedBackDetails)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_FeedbackNew", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
FeedBackModel objFeedbackHistory = new FeedBackModel();
|
|
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("customer_feedback");
|
|
ViewBag.FeedbackQuestions = objFeedbackQuestionsList;
|
|
|
|
//Get Customer Not satisfied questions list
|
|
List<FeedbackSuggestionComplaintModel> objCustomerNotSatisfiedQuestionsList = objTicketAdministrationRepository.GetFeedbackDropDownDataList("customer_not_satisfied_questions");
|
|
List<SelectListItem> item2 = new List<SelectListItem>();
|
|
|
|
foreach (FeedbackSuggestionComplaintModel items in objCustomerNotSatisfiedQuestionsList)
|
|
{
|
|
item2.Add(new SelectListItem { Text =items.ReasonName, Value = Convert.ToString(items.Id) });
|
|
}
|
|
ViewBag.NotSatisfiedQuestions = item2.OrderBy(o => o.Text);
|
|
|
|
|
|
if (!string.IsNullOrEmpty(isFeedBackDetails))
|
|
{
|
|
//Get feedback history details
|
|
objFeedbackHistory = objTicketAdministrationRepository.GetCustomerFeedBackHistoryDetailsTicketIdWise(selectTicketId);
|
|
oFeedbackHistoryList = objFeedbackHistory.feedbackHistoryList.ToList();
|
|
ViewBag.FeedbackHistory = oFeedbackHistoryList;
|
|
ViewBag.SelectedOption = objFeedbackHistory.SelectedOption;
|
|
foreach (var item in oFeedbackHistoryList)
|
|
{
|
|
objFeedbackModel.FeedBackagent = item.FeedbackAgent;
|
|
};
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(objFeedbackModel);
|
|
}
|
|
|
|
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return PartialView(objFeedbackModel);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_Feedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Submit Customer Feedback
|
|
/// </summary>
|
|
/// <param name="model">FeedBackModel</param>
|
|
/// <returns>return json success true or false</returns>
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_CreateCustomerFeedback(FeedBackModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_CreateCustomerFeedback", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
FeedBackModel objFeedbackModel = new FeedBackModel();
|
|
|
|
|
|
objFeedbackModel = objTicketAdministrationRepository.CreateCustomerFeedbackReason(model, "customer_feedback");
|
|
if (objFeedbackModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = model.TicketId });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CreateCustomerFeedback", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
//------------------------added on 23-12-2020 (start)----------------------------------
|
|
[HttpPost]
|
|
public ActionResult VanPunchedTime(VanReachedTimeModel model)
|
|
{
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
VanReachedTimeModel oVanReachedTimeModel = new VanReachedTimeModel();
|
|
oVanReachedTimeModel = objTicketAdministrationRepository.DateTimeOfVanReached(model);
|
|
return Json(new { success = true, data = model.VanReachedTime, message = "Van reached punched time save successfully" });
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Json(new { success = false, data = "", message = "Van reached punched time not save successfully" });
|
|
}
|
|
}
|
|
//------------------------added on 23-12-2020 (end)------------------------------------
|
|
|
|
#region Get All Mobile tickets
|
|
/// <summary>
|
|
/// Get all dummy tickets list
|
|
/// </summary>
|
|
/// <returns>returns json of dummy tickets list</returns>
|
|
public ActionResult DraftTickets()
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_GetAllMobileDummyTickets", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
//Get states List
|
|
List<GetDummyTicket> oGetDummyTicketList = objTicketAdministrationRepository.GetDummyTicketsByMobileList();
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
return View(oGetDummyTicketList);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_GetAllMobileDummyTickets", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
//---------------added on 19-01-2021 start----------------------------
|
|
public ActionResult DeleteDraftTicket(DraftTicketDetailModel objDraftTicketDetailModel)
|
|
{
|
|
//Getting login user's id, name and utc minutes from session
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<DraftTicketDetailModel> lstCancelReason = objTicketAdministrationRepository.GetReasonForCancelDraftTicket();
|
|
List<SelectListItem> oCancelReason = new List<SelectListItem>();
|
|
foreach (DraftTicketDetailModel items in lstCancelReason)
|
|
{
|
|
oCancelReason.Add(new SelectListItem { Value = Convert.ToString(items.DraftTicketCancelReason), Text = Convert.ToString(items.DraftTicketCancelReason) });
|
|
}
|
|
ViewBag.CancelDraftTicketReason = oCancelReason;
|
|
ViewBag.SecurityToken = _securityToken;
|
|
ViewBag.Userid = _LoginUserId;
|
|
ViewBag.UserName = _LoginUserName;
|
|
ViewBag.UtcMinutes = _timeOffSetMinutes;
|
|
ViewBag.DraftTicketId = objDraftTicketDetailModel.DraftTicketId;
|
|
ViewBag.TollFreeNoSource = objDraftTicketDetailModel.TollFreeNoSource;
|
|
ViewBag.RegistrationNumber = objDraftTicketDetailModel.RegistrationNumber;
|
|
ViewBag.ChassisNumber = objDraftTicketDetailModel.ChassisNumber;
|
|
|
|
return PartialView(objDraftTicketDetailModel);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DraftTicket", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
public ActionResult DraftTicketCancelReason(DraftTicketDetailModel objDraftTicketDetailModel)
|
|
{
|
|
_LoginUserId = Session["UserId"].ToString();
|
|
_LoginUserName = Session["UserName"].ToString();
|
|
_timeOffSetMinutes = Session["UtcMinute"].ToString();
|
|
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
DraftTicketDetailModel oSaveDraftTicketCancelReason = new DraftTicketDetailModel();
|
|
oSaveDraftTicketCancelReason = objTicketAdministrationRepository.SaveDraftTicketCancelReason(objDraftTicketDetailModel);
|
|
if (oSaveDraftTicketCancelReason.Status == "1")
|
|
{
|
|
return Json(new { success = true, data = oSaveDraftTicketCancelReason });
|
|
}
|
|
else
|
|
{
|
|
return Json(new { success = false, data = oSaveDraftTicketCancelReason });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DraftTicket", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
//---------------added on 19-01-2021 end----------------------------
|
|
//-----------------------added on 09-03-2021 start -------------------------------------
|
|
|
|
public ActionResult CancelledDraftTicket()
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_CancelledDummyTickets", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
List<CancelledDraftTicketModel> oGetCancelledDummyTicketList = objTicketAdministrationRepository.GetCancelledDraftTicketsList();
|
|
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
return View(oGetCancelledDummyTicketList);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CancelledDummyTickets", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
//-----------------------added on 09-03-2021 end -------------------------------------
|
|
|
|
|
|
#endregion
|
|
|
|
//Added By Mayuri on 17-07-2025
|
|
[HttpPost]
|
|
public ActionResult TicketAdministration_CreateTicketEPSNonHarvester(TicketModel model)
|
|
{
|
|
objLog.AddLogFile("TicketAdministration_CreateTicketEPSNonHarvester", DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
try
|
|
{
|
|
objTicketAdministrationRepository = new TicketAdministrationRepository();
|
|
objNotificationsRepository = new NotificationsRepository();
|
|
|
|
TicketModel oCreateTicketModel = new TicketModel();
|
|
oCreateTicketModel = objTicketAdministrationRepository.CreateTicketEPSNonHarvester(model);
|
|
objLog.AddLogFile("TicketAdministration_CreateTicketEPSNonHarvester", model, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model to web api
|
|
objLog.AddLogFile("TicketAdministration_CreateTicketEPSNonHarvester", oCreateTicketModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf); //Creating log file of passed model from web api
|
|
|
|
if (oCreateTicketModel.Status.ToString() == "1")
|
|
{
|
|
if (model.CreatedBy != "" && model.CreatedBy != null)
|
|
{
|
|
//Getting model of removed notification in case of KAM ticket
|
|
KamNotificationOutputModel objNotificationRemoveModel = objNotificationsRepository.RemoveSeenNotificationKam(model.CreatedBy);
|
|
objLog.AddLogFile("TicketAdministration_RemoveSeenNotificationsKam", objNotificationRemoveModel, DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
|
|
if (objNotificationRemoveModel.Status == "1")
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oCreateTicketModel.TicketId });
|
|
}
|
|
}
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = true, ticketId = oCreateTicketModel.TicketId });
|
|
}
|
|
else
|
|
{
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
return Json(new { success = false, message = Convert.ToString(ConfigurationManager.AppSettings["create_ticket_failed"]) });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("TicketAdministration_CreateTicketEPSNonHarvester", ex.Message, path, errorlogtf);
|
|
objLog.AddLogFile(DateTime.Now.ToString(ConfigurationManager.AppSettings["dateTimeFormat"]), path, logtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
//Added by mayuri on 23/07/25
|
|
[HttpPost]
|
|
public string BulkUploadPreClosure()
|
|
{
|
|
if (Request.Files.Count == 0)
|
|
//return Json(new { Status = "0", Message = "No file selected." });
|
|
return "No Selected File";
|
|
|
|
try
|
|
{
|
|
HttpPostedFileBase file = Request.Files[0];
|
|
string filePath = Path.Combine(Server.MapPath("~/Uploads/"), Path.GetFileName(file.FileName));
|
|
file.SaveAs(filePath);
|
|
|
|
List<PreClosureModel> PreClosureList = new List<PreClosureModel>();
|
|
|
|
using (var workbook = new XLWorkbook(filePath))
|
|
{
|
|
var worksheet = workbook.Worksheet(1);
|
|
var headerRow = worksheet.FirstRowUsed();
|
|
var headers = headerRow.Cells().Select(c => c.GetString().Trim()).ToList();
|
|
|
|
// Required columns
|
|
var requiredHeaders = new List<string> { "Chassis No", "Reg No","VECV KAM Manager","Contact No.","Fleet Manager Name","Fleet Manager Number" };
|
|
|
|
// Validate column names
|
|
bool allHeadersExist = requiredHeaders.All(rh =>
|
|
headers.Any(h => string.Equals(h, rh, StringComparison.OrdinalIgnoreCase)));
|
|
|
|
if (!allHeadersExist)
|
|
{
|
|
return "Missing required column(s): Chassis_No, Reg_No, VECV_KAM_Manager,VECV_KAM_Manager_Contact_No,Fleet_Manager_Name,Fleet_Manager_Number";
|
|
}
|
|
|
|
//
|
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1);
|
|
|
|
foreach (var row in rows)
|
|
{
|
|
|
|
PreClosureList.Add(new PreClosureModel
|
|
{
|
|
|
|
Chassis_No = row.Cell(1).GetString().Trim(),
|
|
Reg_No = row.Cell(2).GetString().Trim(),
|
|
VECV_KAM_Manager = row.Cell(3).GetString().Trim(),
|
|
VECV_KAM_Manager_Contact_No = row.Cell(4).GetString().Trim(),
|
|
Fleet_Manager_Name = row.Cell(5).GetString(),
|
|
Fleet_Manager_Number = row.Cell(6).GetString(),
|
|
});
|
|
|
|
}
|
|
}
|
|
TicketAdministrationRepository obj = new TicketAdministrationRepository();
|
|
// string strresult = "";
|
|
string strresult = obj.BulkUploadPreclosure(PreClosureList).GetAwaiter().GetResult();
|
|
|
|
return "successfull uploaded";
|
|
//return Json(new { Status = "1", Message = "Successfully Fetched " +PreClosureList });
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return "error occure";
|
|
//return Json(new { Status = "0", Message = "An unexpected error occurred: " + ex.Message });
|
|
}
|
|
}
|
|
}
|
|
}
|