116 lines
3.1 KiB
C#
116 lines
3.1 KiB
C#
namespace VECV_WebApi.Controllers.Ticket
|
|
{
|
|
using ExcelHelper;
|
|
#region Namespaces
|
|
|
|
using LoggingHelper;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using System.Web.Mvc;
|
|
using VECV_WebApi.Common;
|
|
using VECV_WebApi.CommonAuthorization;
|
|
using VECV_WebApi.Models.Customer;
|
|
using VECV_WebApi.Models.EmailServices;
|
|
using VECV_WebApi.Models.Ticket;
|
|
using VECV_WebApi.Models.Vehicle;
|
|
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// This controller contain ticket related api
|
|
/// </summary>
|
|
|
|
//[JwtAuthentication]
|
|
//[System.Web.Http.Authorize]
|
|
public class TicketInfoController : 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"]);
|
|
|
|
string _appName = (ConfigurationManager.AppSettings["ApplicationName"]);
|
|
|
|
/// <summary>
|
|
/// making the Database connection string available to this class
|
|
/// </summary>
|
|
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
|
|
|
|
/// <summary>
|
|
/// making Global Repository object available to this class
|
|
/// </summary>
|
|
/// GlobalRepository objGlobalRepository;
|
|
|
|
/// <summary>
|
|
/// making Customer Repository object available to this class
|
|
/// </summary>
|
|
CustomerRepository objCustomerRepository;
|
|
|
|
/// <summary>
|
|
/// making Ticket Repository object available to this class
|
|
/// </summary>
|
|
TicketRepository objTicketRepository;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
/// <summary>
|
|
/// To get customer details
|
|
/// </summary>
|
|
/// <param name="model">customer info</param>
|
|
/// <returns>customer details</returns>
|
|
///
|
|
|
|
public TicketInfoModel Post([FromBody] InsertOpenTicket model)
|
|
{
|
|
// write data log into file
|
|
|
|
TicketInfoModel objInsertOpenTicket = new TicketInfoModel();
|
|
try
|
|
{
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
objInsertOpenTicket = objTicket.getTicketInfoAPI(model);
|
|
return objInsertOpenTicket;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("TicketInfo_Controller", Ex.Message, path, errorlogtf);
|
|
|
|
objInsertOpenTicket = new TicketInfoModel();
|
|
objInsertOpenTicket.Status = "0";
|
|
objInsertOpenTicket.Message = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
return objInsertOpenTicket;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |