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