172 lines
6.8 KiB
C#
172 lines
6.8 KiB
C#
using LoggingHelper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using VECV_WebApi.Models.EmailServices;
|
|
using VECV_WebApi.Models.Ticket;
|
|
|
|
namespace VECV_WebApi.Controllers.Global
|
|
{
|
|
public class GetAllVanController : 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 Ticket Repository object available to this class
|
|
/// </summary>
|
|
TicketRepository objTicketRepository;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
public List<VanDealerListStateWise> Post([FromBody] VanDealerListStateWise model)
|
|
{
|
|
List<VanDealerListStateWise> objList = new List<VanDealerListStateWise>();
|
|
try
|
|
{
|
|
|
|
if (model.Fuel_type == "Diesel/CNG")
|
|
{
|
|
model.Fuel_type = "diesel,cng";
|
|
}
|
|
else if (model.Fuel_type == "Diesel/CNG/Electric")
|
|
{
|
|
model.Fuel_type = "diesel,cng,electric";
|
|
}
|
|
else if (model.Fuel_type == "Electric")
|
|
{
|
|
model.Fuel_type = "electric";
|
|
}
|
|
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
objList = objTicket.GetVanDealerListLatLngWise(model);
|
|
return objList;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetVanDealerListStateWise_Controller Ticket controller ticket3", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
public EscalationLevelOutputModel Post([FromUri] string operation, [FromBody] EscalationLevelInputModel model)
|
|
{
|
|
// write data log into file
|
|
EscalationLevelOutputModel oEscalationLevelOutputModel = new EscalationLevelOutputModel();
|
|
try
|
|
{
|
|
if (operation.ToLower() == "getescalationlevels")
|
|
{
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
oEscalationLevelOutputModel = objTicket.GetEscalationLevelsByDealerId(model);
|
|
return oEscalationLevelOutputModel;
|
|
}
|
|
oEscalationLevelOutputModel.Status = "0";
|
|
return oEscalationLevelOutputModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEscalationLevels_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
|
|
public bool Post([FromUri] string send, [FromUri] string sendmessage,[FromBody] sendSMSInputModel model)
|
|
{
|
|
// write data log into file
|
|
EscalationLevelOutputModel oEscalationLevelOutputModel = new EscalationLevelOutputModel();
|
|
try
|
|
{
|
|
string url = System.Web.Configuration.WebConfigurationManager.AppSettings["SmsUrl"].ToString();
|
|
GlobalRepository objGlobalRepository = new GlobalRepository(_connStr);
|
|
string breakdownLocation = objGlobalRepository.getdealerlatlong(model.DelerId);
|
|
string LocationLikn = "https://www.google.com/maps/search/?api=1%26query=" + breakdownLocation;
|
|
|
|
string msgForEscalationForUser = System.Web.Configuration.WebConfigurationManager.AppSettings["msgForEscalation"].ToString();
|
|
string msgforEscalation = string.Format(msgForEscalationForUser, model.DealerName , LocationLikn,model.ManagerName, model.ManagerNo);
|
|
//Please contact to(Name Arman / Mohit & Number 9818945971 / 9558820990) at our nearest dealership NONACTIVE - EOS by clicking on following link https://www.google.com/maps?q=23.5391281,87.3047335 Regards, Eicher
|
|
|
|
string CSMsms = string.Format(url, model.MobileNumber, msgforEscalation);
|
|
objGlobalRepository.SendMessageEscalation(CSMsms);
|
|
return true;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEscalationLevels_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
public bool Post([FromUri] string sendservicelocation,[FromUri] string send, [FromUri] string sendmessage, [FromBody] ElectricServiceStationModel model)
|
|
{
|
|
// write data log into file
|
|
EscalationLevelOutputModel oEscalationLevelOutputModel = new EscalationLevelOutputModel();
|
|
try
|
|
{
|
|
string url = System.Web.Configuration.WebConfigurationManager.AppSettings["SmsUrl"].ToString();
|
|
GlobalRepository objGlobalRepository = new GlobalRepository(_connStr);
|
|
string breakdownLocation = model.lattitude + ',' + model.longitude;
|
|
|
|
string LocationLikn = "https://www.google.com/maps/search/?api=1%26query=" + breakdownLocation;
|
|
|
|
string msgForEscalationForUser = System.Web.Configuration.WebConfigurationManager.AppSettings["msgForServiceLocation"].ToString();
|
|
string msgforEscalation = string.Format(msgForEscalationForUser, model.name, LocationLikn);
|
|
//Please contact to(Name Arman / Mohit & Number 9818945971 / 9558820990) at our nearest dealership NONACTIVE - EOS by clicking on following link https://www.google.com/maps?q=23.5391281,87.3047335 Regards, Eicher
|
|
|
|
string CSMsms = string.Format(url, model.MobileNumber, msgforEscalation);
|
|
objGlobalRepository.SendMessageEscalation(CSMsms);
|
|
return true;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEscalationLevels_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
} |