85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
namespace VECV_WebApi.Controllers.Van
|
|
{
|
|
#region Namespaces
|
|
|
|
using LoggingHelper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using System.Web.Mvc;
|
|
using VECV_WebApi.Models.Van;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// This controller contain apis releted to van
|
|
/// </summary>
|
|
public class VanPositionController : 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 the Database connection string available to this class
|
|
/// </summary>
|
|
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
/// <summary>
|
|
/// To set/remove alarm for van not move or van not live
|
|
/// </summary>
|
|
/// <param name="model">van info</param>
|
|
/// <returns>status and data</returns>
|
|
public GetVanPositionModel Post(GetVanPositionModel model)
|
|
{
|
|
GetVanPositionModel objModel =new GetVanPositionModel();
|
|
try
|
|
{
|
|
VanRepository objVanRepository = new VanRepository(_connStr);
|
|
// van not move after accept ticket.
|
|
objModel=objVanRepository.VanNotMoveAfterAcceptTicket(model);
|
|
// write data log into file
|
|
// van not live
|
|
objModel = objVanRepository.VanNotLive(model);
|
|
// write data log into file
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("VanPositionController post method no parameter", Ex.Message, path, errorlogtf);
|
|
objModel.Status = "0";
|
|
objModel.Message = Ex.Message;
|
|
}
|
|
return objModel;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|