152 lines
4.0 KiB
C#
152 lines
4.0 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.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>
|
|
public class WhatupAPIController : 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
|
|
|
|
public WhatupModel Post([FromBody] WhatupModel model)
|
|
{
|
|
// write data log into file
|
|
|
|
WhatupModel objWhatupModel = new WhatupModel();
|
|
try
|
|
{
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
objWhatupModel = objTicket.SaveLocationDetailsWhatsup(model);
|
|
return objWhatupModel;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf);
|
|
|
|
objWhatupModel = new WhatupModel();
|
|
objWhatupModel.Status = 0;
|
|
objWhatupModel.Message = "Not Saved";
|
|
return objWhatupModel;
|
|
}
|
|
}
|
|
|
|
|
|
public string Post([FromUri] string sendSMS, [FromBody] WhatupAPIModel model)
|
|
{
|
|
// write data log into file
|
|
string strresponse = "";
|
|
//WhatupAPIModel strresponse = new WhatupAPIModel();
|
|
try
|
|
{
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
strresponse = objTicket.sendWhatupMessage(model);
|
|
return strresponse;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf);
|
|
|
|
strresponse = "Failed";
|
|
|
|
return strresponse;
|
|
}
|
|
}
|
|
|
|
public string Post([FromUri] string getlatlng, [FromUri] string sendSMS, [FromBody] WhatupAPIModel model)
|
|
{
|
|
// write data log into file
|
|
string strresponse = "";
|
|
//WhatupAPIModel strresponse = new WhatupAPIModel();
|
|
try
|
|
{
|
|
TicketRepository objTicket = new TicketRepository(_connStr);
|
|
strresponse = objTicket.GetDetailsWhatsup(model);
|
|
return strresponse;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCustomerDetails_Controller", Ex.Message, path, errorlogtf);
|
|
|
|
strresponse = "Failed";
|
|
|
|
return strresponse;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|