namespace VECV_WebApi.Controllers.Ticket { #region Namespaces using LoggingHelper; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Mvc; using VECV_WebApi.Models.Ticket; #endregion /// /// This controller contain api releted ticket status /// public class TicketStatusController : ApiController { #region Global Variable /// /// making object of LoggingUtility class available to this class /// LoggingUtility objLog = new LoggingUtility(); /// /// making the data-log file path available to this class /// string path = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]); /// /// making data log file path available to this class /// string logtf = (ConfigurationManager.AppSettings["Log"]); /// /// making error log file path available to this class /// string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]); /// /// making Ticket Repository object available to this class /// TicketRepository objTicketRepository; /// /// making the Database connection string available to this class /// private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString(); #endregion #region APIs /// /// To get ticket status list. /// /// ticket status list public List Get() { try { objTicketRepository = new TicketRepository(_connStr); List objModel = new List(); objModel = objTicketRepository.GetTicketStatusList(); return objModel; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetTicketStatusList_Controller", Ex.Message, path, errorlogtf); throw Ex; } } /// /// To get ticket status list. /// /// ticket status list public List Get(string prevstatus, string userrole) { try { objTicketRepository = new TicketRepository(_connStr); List objModel = new List(); objModel = objTicketRepository.GetTicketStatusListbyticketstaus(prevstatus, userrole); return objModel; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetTicketStatusList_Controller", Ex.Message, path, errorlogtf); throw Ex; } } /// /// To get /// /// /// of ticket /// /// ticket info /// notification of ticket public List Post([FromBody] TicketNotificationModel model) { List objList = new List(); try { objTicketRepository = new TicketRepository(_connStr); objList = objTicketRepository.GetTicketNotification(model); return objList; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetTicketNotification_Controller", Ex.Message, path, errorlogtf); return objList; } } /// /// To get notification of open and close ticket, ticket status wise /// /// extra param to identify the api /// ticket info /// notification of open and close ticket, ticket status wise public CloseOpenNotification Post([FromUri] string Notification, [FromBody] CloseOpenNotification model) { CloseOpenNotification objModel = new CloseOpenNotification(); try { objModel.Status = "1"; objTicketRepository = new TicketRepository(_connStr); objModel = objTicketRepository.CloseOpenNotificationInt(model); return objModel; } catch (Exception Ex) { // write error log into file objModel.Status = "0"; objLog.ErrorLogFile("CloseOpenNotificationInt_Controller", Ex.Message, path, errorlogtf); return objModel; } } /// /// To get notification of open and close ticket with, ticket id wise /// /// extra param to identify the api /// extra param to identify the api /// ticket info /// notification of open and close ticket with, ticket id wise public CloseOpenNotification Post([FromUri] string Notification, string Notification1, [FromBody] CloseOpenNotification model) { CloseOpenNotification objModel = new CloseOpenNotification(); try { objModel.Status = "1"; objTicketRepository = new TicketRepository(_connStr); objModel = objTicketRepository.CloseOpenNotificationStr(model); return objModel; } catch (Exception Ex) { // write error log into file objModel.Status = "0"; objLog.ErrorLogFile("CloseOpenNotificationStr_Controller", Ex.Message, path, errorlogtf); return objModel; } } /// /// To get close dealer open ticket notification /// /// extra param to identify the api /// ticket info /// close dealer open ticket notification and status public CloseOpenNotification Post([FromUri]int DealerNotification, [FromBody]CloseOpenNotification model) { CloseOpenNotification objModel = new CloseOpenNotification(); try { objModel.Status = "0"; objTicketRepository = new TicketRepository(_connStr); objModel = objTicketRepository.CloseTODealerOpenNotificationStr(model); return objModel; } catch (Exception Ex) { // write error log into file objModel.Status = "0"; objLog.ErrorLogFile("CloseOpenNotificationStr_Controller", Ex.Message, path, errorlogtf); return objModel; } } /// /// To get Ticket notification detail ticket id wise /// /// extra param to identify the api /// extra param to identify the api /// extra param to identify the api /// ticket info /// Ticket notification detail ticket id wise public List Post([FromUri] string Notification, string Notification1, string Notification2, [FromBody] TicketNotificationsWithTicketId model) { // write data log into file List objList = new List(); try { objTicketRepository = new TicketRepository(_connStr); objList = objTicketRepository.GetTicketNotificationsWithTicketId(model); return objList; } catch (Exception Ex) { // write error log into file objLog.ErrorLogFile("GetTicketNotificationsWithTicketId_Controller", Ex.Message, path, errorlogtf); return objList; } } //added by priya on 09 jan 2023 rabiot mq data savw public string Post([FromUri] string RabbitMqdata, [FromBody] RabittMqDataModel model) { string strsave = ""; objTicketRepository = new TicketRepository(_connStr); strsave = objTicketRepository.InsertRabbitMqdata(model); // objDraftTicketResponseModel.TicketId = objModel.TicketId; return strsave; } #endregion } }