931 lines
49 KiB
C#
931 lines
49 KiB
C#
namespace VECV_WebApi.Models.ServiceEngineer
|
|
{
|
|
#region Namespaces
|
|
|
|
using DBHelper;
|
|
using LoggingHelper;
|
|
using Npgsql;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using VECV_WebApi.Models.Authorization;
|
|
using VECV_WebApi.Models.Dashboard;
|
|
|
|
#endregion
|
|
|
|
#region Repository Class
|
|
|
|
public class ServiceEngineerRepository
|
|
{
|
|
|
|
#region Global Variables
|
|
|
|
/// <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 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;
|
|
|
|
/// <summary>
|
|
/// making ServiceEngineerRegistrationResponse Model object available to this class
|
|
/// </summary>
|
|
ServiceEngineerRegistrationResponseModel objServiceEngRegistrationRepsonseModel;
|
|
|
|
/// <summary>
|
|
/// making Authentication Repository object available to this class
|
|
/// </summary>
|
|
AuthenticationRepository objAuthorization;
|
|
|
|
#endregion
|
|
|
|
#region Contructors
|
|
|
|
/// <summary>
|
|
/// Default constructor intialize connection string of vecv database
|
|
/// </summary>
|
|
public ServiceEngineerRepository(string connString)
|
|
{
|
|
this._connStr = connString;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region API Methods
|
|
|
|
/// <summary>
|
|
/// To register new service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationResponseModel RegisterNewServiceEngineerDevice(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
DataSet ds = new DataSet();
|
|
if (model.PushNotificationBit != 1)
|
|
{
|
|
model.PushNotificationBit = 0;
|
|
}
|
|
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[6];
|
|
nSqlParam[0] = new NpgsqlParameter("inapplication_license_key", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("inimei_number", model.Imei);
|
|
nSqlParam[2] = new NpgsqlParameter("indevice_gcm_id", model.DeviceGcmId);
|
|
nSqlParam[3] = new NpgsqlParameter("inmobile_info", model.MobileInfo);
|
|
nSqlParam[4] = new NpgsqlParameter("inapp_version", model.AppVersion);
|
|
nSqlParam[5] = new NpgsqlParameter("inpush_notification_bit", model.PushNotificationBit);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_insert_service_engg_device_resitration"], nSqlParam);
|
|
|
|
// For Telematics Use
|
|
// NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_sync_service_engineer_details"]);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (ds.Tables[0].Rows[0]["sp_insert_service_engg_device_resitration"].ToString() != "0")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["1"].ToString();
|
|
objServiceEngRegistrationRepsonseModel.DeviceAlias = Convert.ToInt64(ds.Tables[0].Rows[0]["sp_insert_service_engg_device_resitration"].ToString());
|
|
objServiceEngRegistrationRepsonseModel.Token = ConfigurationManager.AppSettings["Token"].ToString();
|
|
DataSet ds1 = new DataSet();
|
|
NpgsqlParameter[] nSqlParam1 = new NpgsqlParameter[1];
|
|
nSqlParam1[0] = new NpgsqlParameter("indeviceid", objServiceEngRegistrationRepsonseModel.DeviceAlias.ToString());
|
|
ds1 = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_apppVersion_by_deviceid"], nSqlParam1);
|
|
if (ds1.Tables[0].Rows.Count > 0)
|
|
{
|
|
double appversion = Convert.ToDouble(ConfigurationManager.AppSettings["app_version"]);
|
|
if ((Convert.ToDouble(ds1.Tables[0].Rows[0]["sp_apppVersion_by_deviceid"]) >= appversion))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["app_version_error"].ToString();
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["0"].ToString();
|
|
}
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["0"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("RegisterNewServiceEngineerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// To register new service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationConfirmationResponseModel ConfiramationServiceEngineerAPI(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
ServiceEngineerRegistrationConfirmationResponseModel objServiceEngineerRegistrationConfirmationResponseModel = new ServiceEngineerRegistrationConfirmationResponseModel();
|
|
try
|
|
{
|
|
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("inapplication_license_key", model.RegistrationNo);
|
|
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_details_service_engineer_license_key"], nSqlParam);
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Status = "1";
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Massage = ConfigurationManager.AppSettings["1"].ToString();
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Token = ConfigurationManager.AppSettings["Token"].ToString();
|
|
|
|
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Name = Convert.ToString(ds.Tables[0].Rows[0]["_name"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.ContactNumber = Convert.ToString(ds.Tables[0].Rows[0]["_contact_number"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.DealerCode = Convert.ToString(ds.Tables[0].Rows[0]["_dealer_code"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.DealerName = Convert.ToString(ds.Tables[0].Rows[0]["_dealer_name"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.State = Convert.ToString(ds.Tables[0].Rows[0]["_state"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.City = Convert.ToString(ds.Tables[0].Rows[0]["_city"].ToString());
|
|
objServiceEngineerRegistrationConfirmationResponseModel.LicenseKey = Convert.ToString(ds.Tables[0].Rows[0]["_license_key"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Status = "0";
|
|
objServiceEngineerRegistrationConfirmationResponseModel.Massage = ConfigurationManager.AppSettings["0"].ToString();
|
|
}
|
|
return objServiceEngineerRegistrationConfirmationResponseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["0"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("RegisterNewServiceEngineerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngineerRegistrationConfirmationResponseModel;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// To update service engineer device password
|
|
/// </summary>
|
|
/// <param name="model">service engineer device details</param>
|
|
/// <returns>staus and data</returns>
|
|
public ServiceEngineerRegistrationResponseModel UpdateServiceEngineerDevicePin(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("indevice_alias ", model.DeviceAlias);
|
|
nSqlParam[1] = new NpgsqlParameter("inpin_password ", model.DevicePin);
|
|
NpgSqlHelper.ExecuteNonQuery(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_insert_update_service_engg_device_password"], nSqlParam);
|
|
|
|
// For Telematics Use
|
|
// NpgSqlHelper.ExecuteNonQuery(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_sync_service_engineer_details"]);
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdUpdate"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("UpdateServiceEngineerDevicePin", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To authenticate service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer device details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationResponseModel AuthenticateServiceEngineerDevice(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("indevice_alias ", model.DeviceAlias);
|
|
nSqlParam[1] = new NpgsqlParameter("inpin_password ", model.DevicePin);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_authentication_device_password"], nSqlParam);
|
|
if (ds.Tables[0].Rows[0]["sp_authentication_device_password"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceAuthenticationSuccessMessage"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceAuthenticationFailMessage"].ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("AuthenticateServiceEngineerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To get van detail user wise
|
|
/// </summary>
|
|
/// <param name="model">van info</param>
|
|
/// <returns>Dataset having van detail user wise</returns>
|
|
public DataSet GetVanDetailUserIdWise(VanModel model)
|
|
{
|
|
try
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("inuser_id ", model.UserId);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_van_dealer_service_engg_user_wise"], nSqlParam);
|
|
|
|
//ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["c"], nSqlParam);
|
|
return ds;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objLog.ErrorLogFile("GetVanDetailUserIdWise", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
public DataSet GetVanDetailWMWise(VanModel model)
|
|
{
|
|
try
|
|
{
|
|
if(model.mobile_number == "")
|
|
{
|
|
model.mobile_number = null;
|
|
}
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("indealerid", model.DealerId);
|
|
nSqlParam[1] = new NpgsqlParameter("inmobilenumber", model.mobile_number);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_van_dealer_service_engg_user_wise_wm_user"], nSqlParam);
|
|
|
|
//ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["c"], nSqlParam);
|
|
return ds;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objLog.ErrorLogFile("GetVanDetailWMWise", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
public DataSet GetVanDetailUserIdWiseOnlyDealer(VanModel model)
|
|
{
|
|
try
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("indealer_state", model.DealerStateParam);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_van_dealer_user_wise"], nSqlParam);
|
|
|
|
//ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["c"], nSqlParam);
|
|
return ds;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objLog.ErrorLogFile("GetVanDetailUserIdWise", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
public DataSet GetVanDetailUserIdWiseOnlyDealerFuelType(VanModel model)
|
|
{
|
|
try
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("indealer_state", model.DealerStateParam);
|
|
nSqlParam[1] = new NpgsqlParameter("infuel_type", model.fuel_type);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_van_dealer_user_wise_fuel_type"], nSqlParam);
|
|
|
|
//ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["c"], nSqlParam);
|
|
return ds;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objLog.ErrorLogFile("GetVanDetailUserIdWise", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To get van detail user wise
|
|
/// </summary>
|
|
/// <param name="model">van info</param>
|
|
/// <returns>Dataset having van detail user wise</returns>
|
|
public DataSet GetVanDetailUserIdWiseVECVUser(VanModel model)
|
|
{
|
|
try
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[3];
|
|
nSqlParam[0] = new NpgsqlParameter("inuser_id ", model.UserId);
|
|
nSqlParam[1] = new NpgsqlParameter("inDealerId ", model.DealerId);
|
|
nSqlParam[2] = new NpgsqlParameter("inemails ", model.emails);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_van_dealer_service_engg_user_wise_VECV_User"], nSqlParam);
|
|
|
|
//ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["c"], nSqlParam);
|
|
return ds;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objLog.ErrorLogFile("GetVanDetailUserIdWise", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region KAM/Dealer API Methods
|
|
|
|
/// <summary>
|
|
/// To register new service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public RegistrationResponseModel RegisterKamOrDealerDevice(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
RegistrationResponseModel oRegistrationResponseModel = new RegistrationResponseModel();
|
|
try
|
|
{
|
|
DataSet ds = new DataSet();
|
|
if (model.PushNotificationBit != 1)
|
|
{
|
|
model.PushNotificationBit = 0;
|
|
}
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[4];
|
|
nSqlParam[0] = new NpgsqlParameter("inapplication_license_key", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("inimei_number", model.Imei);
|
|
nSqlParam[2] = new NpgsqlParameter("indevice_gcm_id", model.DeviceGcmId);
|
|
nSqlParam[3] = new NpgsqlParameter("inpush_notification_bit", model.PushNotificationBit);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_insert_mobile_users_device_resitration"], nSqlParam);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
|
|
oRegistrationResponseModel.Status = "1";
|
|
oRegistrationResponseModel.Massage = ConfigurationManager.AppSettings["1"].ToString();
|
|
oRegistrationResponseModel.Token = ConfigurationManager.AppSettings["Token"].ToString();
|
|
oRegistrationResponseModel.UserId = ds.Tables[0].Rows[0]["_user_id"].ToString();
|
|
oRegistrationResponseModel.UserName = ds.Tables[0].Rows[0]["_user_name"].ToString();
|
|
oRegistrationResponseModel.City = ds.Tables[0].Rows[0]["_city"].ToString();
|
|
oRegistrationResponseModel.State = ds.Tables[0].Rows[0]["_state"].ToString();
|
|
oRegistrationResponseModel.Contact1 = ds.Tables[0].Rows[0]["_contact_number1"].ToString();
|
|
oRegistrationResponseModel.Contact2 = ds.Tables[0].Rows[0]["_contact_number2"].ToString();
|
|
oRegistrationResponseModel.Address = ds.Tables[0].Rows[0]["_address"].ToString();
|
|
oRegistrationResponseModel.Email = ds.Tables[0].Rows[0]["_emails"].ToString();
|
|
oRegistrationResponseModel.DeviceAlias = ds.Tables[0].Rows[0]["_device_alias"].ToString();
|
|
oRegistrationResponseModel.UserType = ds.Tables[0].Rows[0]["_user_type"].ToString();
|
|
oRegistrationResponseModel.IsPasswordExist = ds.Tables[0].Rows[0]["_is_password_exist"].ToString();
|
|
}
|
|
else
|
|
{
|
|
oRegistrationResponseModel.Status = "0";
|
|
oRegistrationResponseModel.Massage = ConfigurationManager.AppSettings["0"].ToString();
|
|
}
|
|
return oRegistrationResponseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
//oRegistrationResponseModel = new ServiceEngineerRegistrationResponseModel();
|
|
oRegistrationResponseModel.Status = "0";
|
|
oRegistrationResponseModel.Massage = ConfigurationManager.AppSettings["0"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("RegisterKamOrDealerDevice", Ex.Message, path, errorlogtf);
|
|
return oRegistrationResponseModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To update service engineer device password
|
|
/// </summary>
|
|
/// <param name="model">service engineer device details</param>
|
|
/// <returns>staus and data</returns>
|
|
public ServiceEngineerRegistrationResponseModel UpdateKamOrDealerDevicePin(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("indevice_alias ", model.DeviceAlias);
|
|
nSqlParam[1] = new NpgsqlParameter("inpin_password ", model.DevicePin);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_insert_update_mobile_users_device_password"], nSqlParam);
|
|
|
|
if (ds.Tables[0].Rows[0]["sp_insert_update_mobile_users_device_password"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdUpdate"].ToString();
|
|
}
|
|
else if (ds.Tables[0].Rows[0]["sp_insert_update_mobile_users_device_password"].ToString() == "2")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceWrongPassword"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("UpdateServiceEngineerDevicePin", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To authenticate service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer device details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationResponseModel AuthenticateKamOrDealerDevice(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[3];
|
|
nSqlParam[0] = new NpgsqlParameter("inlicence_key", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("indevice_alias", model.DeviceAlias);
|
|
nSqlParam[2] = new NpgsqlParameter("inpin_password", model.DevicePin);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_authentication_mobile_user_device_password"], nSqlParam);
|
|
|
|
if (ds.Tables[0].Rows[0]["sp_authentication_mobile_user_device_password"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceAuthenticationSuccessMessage"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceAuthenticationFailMessage"].ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("AuthenticateKamOrDealerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
//FCM Refresh
|
|
/// <summary>
|
|
/// To register new service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationResponseModel RefreshPushNotification(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
DataSet ds = new DataSet();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[4];
|
|
nSqlParam[0] = new NpgsqlParameter("inapplication_license_key", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("inimei_number", model.Imei);
|
|
nSqlParam[2] = new NpgsqlParameter("indevice_id", model.DeviceId);
|
|
nSqlParam[3] = new NpgsqlParameter("inpush_notification_bit", model.PushNotificationBit);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_update_push_notification_bit"], nSqlParam);
|
|
if (ds.Tables[0].Rows[0]["sp_update_push_notification_bit"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshSuccessMSG"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshFailedMSG"].ToString();
|
|
}
|
|
}
|
|
else {
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshFailedMSG"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("AuthenticateKamOrDealerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
|
|
//FCM Refresh
|
|
/// <summary>
|
|
/// To register new service engineer device
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public ServiceEngineerRegistrationResponseModel RefreshPushNotificationMobile(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
DataSet ds = new DataSet();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[4];
|
|
nSqlParam[0] = new NpgsqlParameter("inapplication_license_key", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("inimei_number", model.Imei);
|
|
nSqlParam[2] = new NpgsqlParameter("indevice_id", model.DeviceId);
|
|
nSqlParam[3] = new NpgsqlParameter("inpush_notification_bit", model.PushNotificationBit);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_update_push_notification_bit_for_mobile_users"], nSqlParam);
|
|
if (ds.Tables[0].Rows[0]["sp_update_push_notification_bit_for_mobile_users"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshSuccessMSG"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshFailedMSG"].ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["RefreshFailedMSG"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("AuthenticateKamOrDealerDevice", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// To register new service engineer device with mobile number for mechanic app
|
|
/// </summary>
|
|
/// <param name="model">service engineer details</param>
|
|
/// <returns>status</returns>
|
|
public MechanicServiceEngineerLoginResponseModel MechnicalLoginServiceEngineerAPI(MechanicServiceEngineerLoginRequestModel model)
|
|
{
|
|
MechanicServiceEngineerLoginResponseModel objNewServiceEngineerRegistrationConfirmationResponseModel = new MechanicServiceEngineerLoginResponseModel();
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
|
|
try
|
|
{
|
|
char[] charsToTrim = { '*', ' ', '\'' };
|
|
string mobileNumber = model.userName.Trim(charsToTrim);
|
|
|
|
if (!string.IsNullOrEmpty(model.userName) && mobileNumber.Length == 10)
|
|
{
|
|
nSqlParam[0] = new NpgsqlParameter("contact_number", mobileNumber);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_details_service_engineer_new_license_key"], nSqlParam);
|
|
if (ds.Tables[0].Rows.Count > 1)
|
|
{
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Token = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Name = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.ContactNumber = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DealerCode = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DealerName = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.State = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.City = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.LicenseKey = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DeviceAlias = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.IMEINumber = "";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Status = "4";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Massage = ConfigurationManager.AppSettings["4"].ToString();
|
|
return objNewServiceEngineerRegistrationConfirmationResponseModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Status = "1";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Massage = ConfigurationManager.AppSettings["1"].ToString();
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Token = ConfigurationManager.AppSettings["Token"].ToString();
|
|
|
|
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Name = Convert.ToString(ds.Tables[0].Rows[0]["_name"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.ContactNumber = Convert.ToString(ds.Tables[0].Rows[0]["_contact_number"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DealerCode = Convert.ToString(ds.Tables[0].Rows[0]["_dealer_code"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DealerName = Convert.ToString(ds.Tables[0].Rows[0]["_dealer_name"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.State = Convert.ToString(ds.Tables[0].Rows[0]["_state"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.City = Convert.ToString(ds.Tables[0].Rows[0]["_city"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.LicenseKey = Convert.ToString(ds.Tables[0].Rows[0]["_license_key"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.DeviceAlias = Convert.ToString(ds.Tables[0].Rows[0]["device_alias"].ToString());
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.IMEINumber = Convert.ToString(ds.Tables[0].Rows[0]["imei_number"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Status = "0";
|
|
objNewServiceEngineerRegistrationConfirmationResponseModel.Massage = ConfigurationManager.AppSettings["0"].ToString();
|
|
}
|
|
|
|
return objNewServiceEngineerRegistrationConfirmationResponseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["0"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("RegisterNewServiceEngineerDevice", Ex.Message, path, errorlogtf);
|
|
return objNewServiceEngineerRegistrationConfirmationResponseModel;
|
|
}
|
|
}
|
|
|
|
|
|
public string GetDealerAppVersion(string userid)
|
|
{
|
|
string strsucess = "";
|
|
|
|
try
|
|
{
|
|
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("inuserid ", userid);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_app_version_dealerwise"], nSqlParam);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
strsucess = Convert.ToString(ds.Tables[0].Rows[0]["sp_app_version_dealerwise"]);
|
|
}
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("getAppVersion", Ex.Message, path, errorlogtf);
|
|
|
|
}
|
|
return strsucess;
|
|
|
|
}
|
|
|
|
public string updateDealerAppVersion(string userid, string app_version)
|
|
{
|
|
string strsucess = "";
|
|
|
|
try
|
|
{
|
|
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("inuserid ", userid);
|
|
nSqlParam[1] = new NpgsqlParameter("inappversion ", app_version);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_update_app_version_dealerwise"], nSqlParam);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
string appversion = Convert.ToString(ds.Tables[0].Rows[0]["sp_update_app_version_dealerwise"]);
|
|
if (appversion == "" || appversion == null)
|
|
{
|
|
strsucess = "Invalid userid";
|
|
}
|
|
else
|
|
{
|
|
strsucess = "success";
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("UpdateAppVersion", Ex.Message, path, errorlogtf);
|
|
//return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
return strsucess;
|
|
|
|
}
|
|
|
|
|
|
public ServiceEngineerRegistrationResponseModel LoginWMUser(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
try
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[2];
|
|
nSqlParam[0] = new NpgsqlParameter("inuser_name ", model.RegistrationNo);
|
|
nSqlParam[1] = new NpgsqlParameter("inpin_password ", model.DevicePin);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_login_wm_user"], nSqlParam);
|
|
|
|
if (ds.Tables[0].Rows[0]["sp_login_wm_user"].ToString() == "1")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "1";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdUpdate"].ToString();
|
|
}
|
|
else if (ds.Tables[0].Rows[0]["sp_login_wm_user"].ToString() == "2")
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceWrongPassword"].ToString();
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
objServiceEngRegistrationRepsonseModel = new ServiceEngineerRegistrationResponseModel();
|
|
objServiceEngRegistrationRepsonseModel.Status = "0";
|
|
objServiceEngRegistrationRepsonseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("UpdateServiceEngineerDevicePin", Ex.Message, path, errorlogtf);
|
|
return objServiceEngRegistrationRepsonseModel;
|
|
}
|
|
}
|
|
|
|
public string GetWMAppVersion(string userid, string token)
|
|
{
|
|
string strsucess = "";
|
|
|
|
try
|
|
{
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("inuserid ", userid);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_app_version_WMwise"], nSqlParam);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
strsucess = Convert.ToString(ds.Tables[0].Rows[0]["sp_app_version_WMwise"]);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetDealerListUserIdWise", Ex.Message, path, errorlogtf);
|
|
|
|
|
|
}
|
|
return strsucess;
|
|
|
|
}
|
|
|
|
public RegistrationResponseModel GetUserDetailWMWise(ServiceEngineerRegistrationRequestModel model)
|
|
{
|
|
RegistrationResponseModel objRegistrationResponseModel = new RegistrationResponseModel();
|
|
try
|
|
{
|
|
objAuthorization = new AuthenticationRepository();
|
|
if (objAuthorization.AuthenticateDevice(model.Token))
|
|
{
|
|
DataSet ds = new DataSet();
|
|
NpgsqlParameter[] nSqlParam = new NpgsqlParameter[1];
|
|
nSqlParam[0] = new NpgsqlParameter("inusername ", model.RegistrationNo);
|
|
ds = NpgSqlHelper.ExecuteDataset(_connStr, CommandType.StoredProcedure, ConfigurationManager.AppSettings["usp_get_user_details_wm_wise"], nSqlParam);
|
|
|
|
|
|
objRegistrationResponseModel.Status = "1";
|
|
objRegistrationResponseModel.UserName = ds.Tables[0].Rows[0]["_auth_engine_id"].ToString();
|
|
|
|
objRegistrationResponseModel.City = ds.Tables[0].Rows[0]["_city"].ToString();
|
|
objRegistrationResponseModel.UserType = ds.Tables[0].Rows[0]["_designation"].ToString();
|
|
objRegistrationResponseModel.State = ds.Tables[0].Rows[0]["_state"].ToString();
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
objRegistrationResponseModel.Status = "0";
|
|
objRegistrationResponseModel.Massage = ConfigurationManager.AppSettings["DeviceConfigurationTokenMessage"].ToString();
|
|
}
|
|
return objRegistrationResponseModel;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objRegistrationResponseModel.Status = "0";
|
|
objRegistrationResponseModel.Massage = ConfigurationManager.AppSettings["PwdErrorMsg"].ToString() + Ex.Message;
|
|
objLog.ErrorLogFile("GetUserDetailUserNameWise", Ex.Message, path, errorlogtf);
|
|
return objRegistrationResponseModel;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
} |