110 lines
3.7 KiB
C#
110 lines
3.7 KiB
C#
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.EscalationMatrix;
|
|
|
|
namespace VECV_WebApi.Controllers.EscalationMatrix
|
|
{
|
|
public class EscalationMatrixController : ApiController
|
|
{
|
|
#region Global References
|
|
|
|
/// <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 EscalationMatrix Repository object available to this class
|
|
/// </summary>
|
|
EscalationMatrixRepository objEscalationMatrixRepository;
|
|
|
|
/// <summary>
|
|
/// making the Database connection string available to this class
|
|
/// </summary
|
|
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
/// <summary>
|
|
/// To Insert, Update and get Escalation Matrix
|
|
/// </summary>
|
|
/// <param name="model">escalation matrix info</param>
|
|
/// <returns>status and data</returns>
|
|
public EscalationMatrixModel Post([FromBody]EscalationMatrixModel model)
|
|
{
|
|
// write data log into file
|
|
EscalationMatrixModel objModel = new EscalationMatrixModel();
|
|
try
|
|
{
|
|
objEscalationMatrixRepository = new EscalationMatrixRepository(_connStr);
|
|
|
|
if (model.Action.Trim().ToUpper() == "INSERT" || model.Action.Trim().ToUpper() == "UPDATE" || model.Action.Trim().ToUpper() == "DELETE" || model.Action.Trim().ToUpper() == "GET")
|
|
{
|
|
objModel = objEscalationMatrixRepository.InserUpdateGetEscalationMatrix(model);
|
|
}
|
|
else
|
|
{
|
|
objModel = objEscalationMatrixRepository.GetEscalationMatrix(model);
|
|
}
|
|
return objModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objModel.Status = "0";
|
|
objModel.Message = Ex.Message;
|
|
objLog.ErrorLogFile("GetDealerOpenTicketDetail_Controller", Ex.Message, path, errorlogtf);
|
|
|
|
return objModel;
|
|
}
|
|
}
|
|
|
|
|
|
public EscalationMatrixModel post([FromUri]string phone, [FromBody]EscalationPhoneNumber model)
|
|
{
|
|
EscalationMatrixModel objModel = new EscalationMatrixModel();
|
|
try
|
|
{
|
|
objEscalationMatrixRepository = new EscalationMatrixRepository(_connStr);
|
|
objModel = objEscalationMatrixRepository.UpdateEscalationPhoneNUmber(model);
|
|
return objModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objModel.Status = "0";
|
|
objModel.Message = Ex.Message;
|
|
objLog.ErrorLogFile("UpdateEscalationPhoneNumber", Ex.Message, path, errorlogtf);
|
|
|
|
return objModel;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|