252 lines
8.5 KiB
C#
252 lines
8.5 KiB
C#
using LoggingHelper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using GODATA.RoleServices;
|
|
using GODATA.AuthenticationServices;
|
|
using RestSharp;
|
|
using Newtonsoft.Json;
|
|
using GODATA.Models.Ticket;
|
|
using Kendo.Mvc.UI;
|
|
using Kendo.Mvc.Extensions;
|
|
using GODATA.Models.DropDownData;
|
|
|
|
namespace GODATA.Models.DropDownData
|
|
{
|
|
public class DropDownDataRepository
|
|
{
|
|
|
|
#region Global Variables
|
|
|
|
/// <summary>
|
|
/// Represent object of LoggingUtility class
|
|
/// </summary>
|
|
LoggingUtility objLog = new LoggingUtility();
|
|
|
|
/// <summary>
|
|
/// Represent string object contain log file path
|
|
/// </summary>
|
|
//string path = "~/Log/";
|
|
string path = System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]);
|
|
|
|
/// <summary>
|
|
/// Represent string object contain log status
|
|
/// </summary>
|
|
string logtf = (ConfigurationManager.AppSettings["Log"]);
|
|
|
|
/// <summary>
|
|
/// Represent string object contain Error log status
|
|
/// </summary>
|
|
string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]);
|
|
|
|
|
|
/// <summary>
|
|
/// getting application name from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _appName = ConfigurationManager.AppSettings["ApplicationName"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting web api token from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _securityToken = ConfigurationManager.AppSettings["RESTfulSecurityToken"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting user's utc minutes from session
|
|
/// </summary>
|
|
private static string _timeOffSetMinutes = null;
|
|
|
|
/// <summary>
|
|
/// getting login user's id
|
|
/// </summary>
|
|
private static string _LoginUserId = null;
|
|
|
|
/// <summary>
|
|
/// getting login user's name
|
|
/// </summary>
|
|
private static string _LoginUserName = null;
|
|
|
|
/// <summary>
|
|
/// getting time zone id from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _TimeZoneId = ConfigurationManager.AppSettings["TimeZoneId"].ToString();
|
|
|
|
/// <summary>
|
|
/// getting rest api url from AppSetting in web.config file
|
|
/// </summary>
|
|
private static string _RestClientUrl = ConfigurationManager.AppSettings["RestfulApiUrl"].ToString();
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// Get Languages list
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<LanguageModel> GetLanguagesList()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Language=dssd", Method.POST);
|
|
request.AddParameter("Id", "");
|
|
return client.Execute<List<LanguageModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetLanguagesList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Source list of toll free no.
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<TollFreeSourceModel> GetSourceListOfTollFreeNo()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=TollFree", Method.POST);
|
|
return client.Execute<List<TollFreeSourceModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetSourceListOfTollFreeNo", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get warrenty list
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<WarrentyModel> GetWarrentyAmcList()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=warranty", Method.POST);
|
|
return client.Execute<List<WarrentyModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetWarrentyAmcList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get opportunity lost reasons list
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<OpportunityLostReasonsModel> GetOpprtunityLostReasonsList()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=OpportunityLost", Method.POST);
|
|
return client.Execute<List<OpportunityLostReasonsModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetOpprtunityLostReasonsList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
//----------------------- added on 25-11-2020 (start) ---------------------------------------------------
|
|
|
|
/// <summary>
|
|
/// Get Ticket closed reason
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<TicketClosedReason> GetTicketClosedReason()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=ClosedTicketReason", Method.POST);
|
|
return client.Execute<List<TicketClosedReason>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetOpprtunityLostReasonsList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
//----------------------- added on 25-11-2020 (end) ---------------------------------------------------
|
|
|
|
|
|
/// <summary>
|
|
/// Get opportunity lost reasons list
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<OpportunityLostReasonsModel> GetAllDelayedReasonMorethan24Hrs()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=delayedreasonmorethan24hrs", Method.POST);
|
|
return client.Execute<List<OpportunityLostReasonsModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetAllDelayedReasonMorethan24Hrs", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
#region get dealer ticket reasons
|
|
|
|
|
|
/// <summary>
|
|
/// Get Source list of toll free no.
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<TollFreeSourceModel> GetReasonForDealerTicket()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?Type=Reasonfordealer", Method.POST);
|
|
return client.Execute<List<TollFreeSourceModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetSourceListOfTollFreeNo", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region get repair cost estimated list
|
|
|
|
/// <summary>
|
|
/// Get opportunity lost reasons list
|
|
/// </summary>
|
|
/// <returns>return list</returns>
|
|
public List<EstimateCostModel> GetEstimatedRepairCostList()
|
|
{
|
|
try
|
|
{
|
|
var client = new RestSharp.RestClient(_RestClientUrl);
|
|
var request = new RestRequest("Api/Global?EstimateCost=e&EstimateCost1=e1", Method.GET);
|
|
return client.Execute<List<EstimateCostModel>>(request).Data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
objLog.ErrorLogFile("DropDownDataRepository_GetEstimatedRepairCostList", ex.Message, path, errorlogtf);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
} |