107 lines
3.6 KiB
C#
107 lines
3.6 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.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using System.Web.Mvc;
|
|
using VECV_WebApi.Common;
|
|
using VECV_WebApi.Models.Customer;
|
|
using VECV_WebApi.Models.Dealer;
|
|
using VECV_WebApi.Models.EmailServices;
|
|
//using VECV_WebApi.Models.Sync;
|
|
using VECV_WebApi.Models.Ticket;
|
|
using VECV_WebApi.Models.Vehicle;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// This controller contain apis related to open ticket
|
|
/// </summary>ticketid
|
|
public class EPSNonHarvesterController : 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 Ticket Repository object available to this class
|
|
/// </summary>
|
|
GlobalRepository objGlobalRepository;
|
|
/// <summary>
|
|
/// making the Database connection string available to this class
|
|
/// </summary>
|
|
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
public InsertOpenTicket Post([FromUri] string Ticket, [FromBody] InsertOpenTicket model)
|
|
{
|
|
|
|
try
|
|
{
|
|
InsertOpenTicket objModel = new InsertOpenTicket();
|
|
InsertOpenTicket objModel1 = new InsertOpenTicket();
|
|
DealerRepository obj = new DealerRepository(_connStr);
|
|
objModel1 = obj.getDelaerIdByState(model.StateName);
|
|
model.AssignedToUserId = objModel1.AssignedToUserId;
|
|
model.AssignedToUserLattitude = objModel1.AssignedToUserLattitude;
|
|
model.AssignedToUserLongitude = objModel1.AssignedToUserLongitude;
|
|
objTicketRepository = new TicketRepository(_connStr);
|
|
objModel = objTicketRepository.InsertOpenTicketNonHarvester(model);
|
|
//sending email to mulitiple people when ticket got created
|
|
|
|
// string isSend = objTicketRepository.sendEPSNewTicketmail(objModel.TicketId);
|
|
//if (isSend.ToLower().Trim() == "true")
|
|
//{
|
|
// objModel.Status = "1";
|
|
//}
|
|
//else
|
|
//{
|
|
// objModel.Status = "0";
|
|
//}
|
|
return objModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("EPSNonHarvester_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |