125 lines
3.5 KiB
C#
125 lines
3.5 KiB
C#
|
|
|
|
namespace VECV_WebApi.Controllers
|
|
{
|
|
|
|
#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.Models.Customer;
|
|
using VECV_WebApi.Models.EmailServices;
|
|
using VECV_WebApi.Models.Ticket;
|
|
using VECV_WebApi.Models.Vehicle;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public class ServiceStationController : 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 List<ElectricServiceStationModel> Post([FromBody] ElectricServiceStationModel model)
|
|
{
|
|
|
|
try
|
|
{
|
|
List<ElectricServiceStationModel> objservicelist = new List<ElectricServiceStationModel>();
|
|
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
objservicelist = objTicket.GetServiceStation(model);
|
|
|
|
return objservicelist;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEscalationLevels_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
|
|
}
|
|
|
|
public List<ElectricServiceStationModel> Post([FromUri] string getServiceStation, [FromBody] ElectricServiceStationModel model)
|
|
{
|
|
// write data log into file
|
|
EscalationLevelOutputModel oEscalationLevelOutputModel = new EscalationLevelOutputModel();
|
|
try
|
|
{
|
|
List<ElectricServiceStationModel> objservicelist = new List<ElectricServiceStationModel>();
|
|
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
objservicelist = objTicket.GetServiceStation(model);
|
|
oEscalationLevelOutputModel.Status = "0";
|
|
return objservicelist;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEscalationLevels_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |