283 lines
10 KiB
C#
283 lines
10 KiB
C#
namespace VECV_WebApi.Controllers.Reports
|
|
{
|
|
#region Namespaces
|
|
|
|
using LoggingHelper;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using System.Web.Mvc;
|
|
using VECV_WebApi.Models.Reports;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// This controller contain reports releted apis
|
|
/// </summary>
|
|
public class ReportController : 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();
|
|
|
|
/// <summary>
|
|
/// making Report Repository object available to this class
|
|
/// </summary>
|
|
public ReportsRepository objReportRepo;
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
/// <summary>
|
|
/// To get various many reports
|
|
/// </summary>
|
|
/// <param name="type">type of report</param>
|
|
/// <param name="model">date range and user info</param>
|
|
/// <returns>status and report data</returns>
|
|
public EosallCountRequestModel Post([FromUri]string type, [FromBody]EosallCountRequestModel model)
|
|
{
|
|
EosallCountRequestModel objModel = new EosallCountRequestModel();
|
|
|
|
try
|
|
{
|
|
objReportRepo = new ReportsRepository(_connStr);
|
|
|
|
// get EOS call count report
|
|
if (type.ToLower().Trim() == "eoscallcount")
|
|
{
|
|
objModel = objReportRepo.GetEosCallCountDetail(model);
|
|
}
|
|
// get HD, LMD, BUS contribution report
|
|
else if (type.ToLower().Trim() == "hdlmdbus")
|
|
{
|
|
objModel = objReportRepo.GetHdLmdBusContributionDetail(model);
|
|
}
|
|
// get Dealer wise report
|
|
else if (type.ToLower().Trim() == "dealerwise")
|
|
{
|
|
objModel = objReportRepo.GetDealerWiseCallDetail(model);
|
|
}
|
|
// get timeslot closure report
|
|
else if (type.ToLower().Trim() == "timeslotclouser")
|
|
{
|
|
objModel = objReportRepo.GetTimeSlotClouserDetail(model);
|
|
}
|
|
// get reason for call closed > 24 hrs report
|
|
else if (type.ToLower().Trim() == "dealerwisereasonforcallclosedbeyond24hrs")
|
|
{
|
|
objModel = objReportRepo.GetReasonCallCloseBeyond24HrsDetail(model);
|
|
}
|
|
// get opportunity loss report
|
|
else if (type.ToLower().Trim() == "eosopportunityloss")
|
|
{
|
|
objModel = objReportRepo.GetOpportunityLossReport(model);
|
|
}
|
|
// get toll free number report
|
|
else if (type.ToLower().Trim() == "eostollfreenosource")
|
|
{
|
|
objModel = objReportRepo.GetTollFreeNoSourceReport(model);
|
|
}
|
|
// get HD, LMD call closure report
|
|
else if (type.ToLower().Trim() == "hdlmdcallcloser")
|
|
{
|
|
objModel = objReportRepo.GetHdLmdBusCallCloserReport(model);
|
|
}
|
|
// get reason for call closed > 24 hrs report
|
|
else if (type.ToLower().Trim() == "reasonforcallclosedbeyond24hrs")
|
|
{
|
|
objModel = objReportRepo.GetReasonWiseCallClosedBeyond24Hrs(model);
|
|
}
|
|
// get call feedback report
|
|
else if (type.ToLower().Trim() == "eoscallfeedbackparameter")
|
|
{
|
|
objModel = objReportRepo.GetEosFeedBackCallFeedBackParameter(model);
|
|
}
|
|
// get geo analysis report
|
|
else if (type.ToLower().Trim() == "geo")
|
|
{
|
|
objModel = objReportRepo.GeoAnalysis(model);
|
|
}
|
|
// get geo analysis report route wise
|
|
else if (type.ToLower().Trim() == "georoutewise")
|
|
{
|
|
objModel = objReportRepo.GeoRouteAnalysis(model);
|
|
}
|
|
else if (type.ToLower().Trim() == "countgeokpi")
|
|
{
|
|
objModel = objReportRepo.CountGeoRouteAnalysis(model);
|
|
}
|
|
// get declined calls report
|
|
else if (type.ToLower().Trim() == "declined")
|
|
{
|
|
objModel = objReportRepo.GetDeclinedReport(model);
|
|
}
|
|
// get customer report
|
|
else if (type.ToLower().Trim() == "customer")
|
|
{
|
|
objModel = objReportRepo.GetCustomerReport(model);
|
|
}
|
|
// get promise report
|
|
else if (type.ToLower().Trim() == "promise")
|
|
{
|
|
objModel = objReportRepo.GetPromiseReport(model);
|
|
}
|
|
|
|
return objModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetEosCallCountDetail", Ex.Message, path, errorlogtf);
|
|
|
|
objModel.Status = "0";
|
|
objModel.Message = Ex.Message;
|
|
return objModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To get closed/open ticket report.
|
|
/// </summary>
|
|
/// <param name="TicketType">extra param to idenify the api</param>
|
|
/// <param name="model">ticket info</param>
|
|
/// <returns>closed/open ticket report</returns>
|
|
public TicketRequestModel Post([FromUri]string TicketType, [FromBody]TicketRequestModel model)
|
|
{
|
|
// write data log into file
|
|
TicketRequestModel ObjModel = new TicketRequestModel();
|
|
try
|
|
{
|
|
ReportsRepository objTicket = new ReportsRepository(_connStr);
|
|
model.TicketType = TicketType;
|
|
ObjModel = objTicket.GetCloseTicketDetail(model);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCloseTicketDetail", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
return ObjModel;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// To get closed/open ticket report.
|
|
/// </summary>
|
|
/// <param name="TicketType">extra param to idenify the api</param>
|
|
/// <param name="model">ticket info</param>
|
|
/// <returns>closed/open ticket report</returns>
|
|
public TicketRequestModel Post([FromUri]string TicketType,[FromUri]int TicketsScore, [FromBody]TicketRequestModel model)
|
|
{
|
|
// write data log into file
|
|
TicketRequestModel ObjModel = new TicketRequestModel();
|
|
try
|
|
{
|
|
ReportsRepository objTicket = new ReportsRepository(_connStr);
|
|
model.TicketType = TicketType;
|
|
ObjModel = objTicket.GetCloseTicketScoresDetail(model);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCloseTicketScoresDetail", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
return ObjModel;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// To get closed ticket report.
|
|
/// </summary>
|
|
/// <param name="TicketType">extra param to idenify the api</param>
|
|
/// <param name="model">ticket info</param>
|
|
/// <returns>closed/open ticket report</returns>
|
|
public TicketRequestModel Post([FromUri]string ClosedTicket, [FromUri]string ClosedTicketScores, [FromBody]TicketRequestModel model)
|
|
{
|
|
// write data log into file
|
|
TicketRequestModel ObjModel = new TicketRequestModel();
|
|
try
|
|
{
|
|
ReportsRepository objTicket = new ReportsRepository(_connStr);
|
|
ObjModel = objTicket.GetCloseTicketList(model);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetCloseTicketList", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
return ObjModel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// To get Dealer Current Score .
|
|
/// </summary>
|
|
/// <param name="TicketType">extra param to idenify the api</param>
|
|
/// <param name="model">Dealer info With Score</param>
|
|
/// <returns>Score Card report</returns>
|
|
public ScoreRequestModel Post([FromUri]string ReportType, [FromUri]string CompareData, [FromBody]ScoreRequestModel model)
|
|
{
|
|
// write data log into file
|
|
ScoreRequestModel ObjModel = new ScoreRequestModel();
|
|
try
|
|
{
|
|
ReportsRepository objTicket = new ReportsRepository(_connStr);
|
|
model.ReportType = ReportType;
|
|
ObjModel = objTicket.GetScoreCardReport(model);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetScoreCardReport", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
return ObjModel;
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
}
|