EOS-WebAPI/Controllers/Ticket/TicketStatusController.cs
Nidhi Bhargava d0ac8a7790 Code Commit
2025-09-04 17:30:22 +05:30

248 lines
9.1 KiB
C#

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
/// <summary>
/// This controller contain api releted ticket status
/// </summary>
public class TicketStatusController : ApiController
{
#region Global Variable
/// <summary>
/// making object of LoggingUtility class available to this class
/// </summary>
LoggingUtility objLog = new LoggingUtility();
/// <summary>
/// making the data-log file path available to this class
/// </summary>
string path = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]);
/// <summary>
/// making data log file path available to this class
/// </summary>
string logtf = (ConfigurationManager.AppSettings["Log"]);
/// <summary>
/// making error log file path available to this class
/// </summary>
string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]);
/// <summary>
/// making Ticket Repository object available to this class
/// </summary>
TicketRepository objTicketRepository;
/// <summary>
/// making the Database connection string available to this class
/// </summary>
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
#endregion
#region APIs
/// <summary>
/// To get ticket status list.
/// </summary>
/// <returns>ticket status list</returns>
public List<TicketStatus> Get()
{
try
{
objTicketRepository = new TicketRepository(_connStr);
List<TicketStatus> objModel = new List<TicketStatus>();
objModel = objTicketRepository.GetTicketStatusList();
return objModel;
}
catch (Exception Ex)
{
// write error log into file
objLog.ErrorLogFile("GetTicketStatusList_Controller", Ex.Message, path, errorlogtf);
throw Ex;
}
}
/// <summary>
/// To get ticket status list.
/// </summary>
/// <returns>ticket status list</returns>
public List<TicketStatus> Get(string prevstatus, string userrole)
{
try
{
objTicketRepository = new TicketRepository(_connStr);
List<TicketStatus> objModel = new List<TicketStatus>();
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;
}
}
/// <summary>
/// To get
///
///
/// of ticket
/// </summary>
/// <param name="model">ticket info</param>
/// <returns>notification of ticket</returns>
public List<TicketNotificationModel> Post([FromBody] TicketNotificationModel model)
{
List<TicketNotificationModel> objList = new List<TicketNotificationModel>();
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;
}
}
/// <summary>
/// To get notification of open and close ticket, ticket status wise
/// </summary>
/// <param name="Notification">extra param to identify the api</param>
/// <param name="model">ticket info</param>
/// <returns>notification of open and close ticket, ticket status wise</returns>
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;
}
}
/// <summary>
/// To get notification of open and close ticket with, ticket id wise
/// </summary>
/// <param name="Notification">extra param to identify the api</param>
/// <param name="Notification1">extra param to identify the api</param>
/// <param name="model">ticket info</param>
/// <returns>notification of open and close ticket with, ticket id wise</returns>
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;
}
}
/// <summary>
/// To get close dealer open ticket notification
/// </summary>
/// <param name="DealerNotification">extra param to identify the api</param>
/// <param name="model">ticket info</param>
/// <returns>close dealer open ticket notification and status</returns>
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;
}
}
/// <summary>
/// To get Ticket notification detail ticket id wise
/// </summary>
/// <param name="Notification">extra param to identify the api</param>
/// <param name="Notification1">extra param to identify the api</param>
/// <param name="">extra param to identify the api</param>
/// <param name="model">ticket info</param>
/// <returns>Ticket notification detail ticket id wise</returns>
public List<TicketNotificationsWithTicketId> Post([FromUri] string Notification, string Notification1, string Notification2, [FromBody] TicketNotificationsWithTicketId model)
{
// write data log into file
List<TicketNotificationsWithTicketId> objList = new List<TicketNotificationsWithTicketId>();
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
}
}