public JsonResult SaveComplain(ENT.Complain model) { try { using (BAL.Complain objBAL = new BAL.Complain()) { model.CreatedDateTime = DateTime.Now; model.CreatedBy = _LoginUserId; model.complainstatus = (int)COM.MyEnumration.TICKETSTATUS.CREATED; model.adminremarks = string.Empty; if (objBAL.Insert(model)) { GlobalVarible.AddMessage("Complain registered successfully."); } else { GlobalVarible.AddError("Unable to register complain.Please contact your administrator."); } } } catch (Exception ex) { ERRORREPORTING.Report(ex, _REQUESTURL, _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(model)); GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage SaveSpectroEntry(List <ENT.SpectroEntry> Model) { try { int cnt = 0; Int64 SpectroNo = new DAL.SpectroEntry().GetTopOneSpectroNo(); foreach (ENT.SpectroEntry el in Model) { el.Mode = "ADD"; el.SpectroID = Guid.NewGuid(); el.SpectroNo = SpectroNo; if (new DAL.SpectroEntry().InsertUpdateDeleteSpectroEntry(el)) { Model[cnt].Message = "Entry Save Successfully."; } else { Model[cnt].Message = "Internal Server Error."; } cnt++; } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveSpectroEntry()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, Model)); //return ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { Model }); }
public JsonResult UpdateComplain(ENT.Complain model) { try { using (BAL.Complain objBAL = new BAL.Complain()) { objBAL.Entity.UpdatedBy = _LoginUserId; objBAL.Entity.UpdatedDateTime = DateTime.Now; objBAL.Entity.complainid = model.complainid; objBAL.Entity.complainstatus = (int)COM.MyEnumration.TICKETSTATUS.RESOLVED; objBAL.Entity.adminremarks = model.adminremarks; if (objBAL.UpdateStatus(objBAL.Entity)) { GlobalVarible.AddMessage("Complain updated successfully."); } else { GlobalVarible.AddError("Unable to update complain.Please try again."); } } } catch (Exception ex) { ERRORREPORTING.Report(ex, _REQUESTURL, _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(model)); GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage SaveDeviceID(ENT.Device obj) { DAL.Device objDAL = new DAL.Device(); try { if (!string.IsNullOrWhiteSpace(obj.DeviceId) && !string.IsNullOrWhiteSpace(obj.DeviceCode)) { if (objDAL.InsertUpdateDeleteDeviceID(obj)) { return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data save successfully." })); } else { throw new Exception("Internal Server Error."); } } else { return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Device ID and Device Token should not be empty or null or white space." })); } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveDeviceID()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } }
public HttpResponseMessage GetServices() { GlobalVarible.Clear(); List <ENT.ServiceMasterView> lstEntity = new List <ENT.ServiceMasterView>(); try { using (BAL.ServiceMaster objBal = new BAL.ServiceMaster()) { lstEntity = objBal.GetServices("30B24352-9F4B-485A-AB18-528E74F6F260"); } foreach (ENT.ServiceMasterView s in lstEntity) { s.serviceimage = "http://dmt.appsmith.co.in/Uploads/Services/postpaid.png"; } GlobalVarible.AddMessage("Services get successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public JsonResult UpdateStatus(string transid, int status, string accountid) { GlobalVarible.Clear(); try { COM.MEMBERS.SQLReturnMessageNValue mUpdate = new BAL.Recharge().UpdateRecharge( accountid, !string.IsNullOrEmpty(transid) ? transid : "N/A", status, "Manually by : " + User.Identity.GetUserName()); if (mUpdate.Outval > 0) { GlobalVarible.AddMessage(mUpdate.Outmsg); } else { GlobalVarible.AddError(mUpdate.Outmsg); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, (transid + "|" + status + "|" + accountid)); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
internal void ProcessINOUT(String REQ, string _requestid) { string[] VAL = REQ.Split('|'); try { // add log or response here. new BAL.Log().Insert(new ENT.Log() { logdata = REQ, CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.DATA, title = "PROCESS - INOUT API" }); SRServiceSoapClient client = new SRServiceSoapClient(); string X = client.DoRecharge(new Information { Amount = Convert.ToDecimal(VAL[1]), ApiCredentials = new Credentials { Password = VAL[5], UserName = VAL[6] }, MobileToRecharge = VAL[0], OperatorCode = int.Parse(VAL[2]), ServiceCode = int.Parse(VAL[4]), TypeOfRecharge = Convert.ToByte(VAL[3].ToString()), }); new BAL.Log().Insert(new ENT.Log() { logdata = X, CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.APIRES, title = "PROCESS - INOUT API" }); INOUTRESPONSE Response = JsonConvert.DeserializeObject <INOUTRESPONSE>(X); //if (Response.DoRechargeResponse.Code == "SR113") //{ // new BAL.Recharge().UpdateRecharge(_requestid, Response.DoRechargeResponse.ReferenceID == null ? string.Empty : Response.DoRechargeResponse.ReferenceID, 3, X); //} // parse json here and get action as per response. } catch (Exception ex) { new BAL.Log().Insert(new ENT.Log() { logdata = new JavaScriptSerializer().Serialize(ex), CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.APIERROR, title = "PROCESS - INOUT API" }); ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, REQ); ex.Message.ToString(); } }
/// <summary> /// This function is return all device token list from database /// </summary> /// <returns>String(DeviceID)</returns> public List <ENT.Device> getDeviceID() { List <ENT.Device> lstENT = new List <ENT.Device>(); try { lstENT = new DAL.Device().GetAllDeviceID(); } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : getDeviceID()"); } return(lstENT); }
public HttpResponseMessage VerifyCustomer(customerverificationmodel model) { GlobalVarible.Clear(); try { DMT dmt = new DMT(APICONSTANT.USERNAME, APICONSTANT.PASSWORD, APICONSTANT.URL); OTPVALIDATIONRESPONSE OV = new OTPVALIDATIONRESPONSE(); // get customer information by id using (BAL.DMT_CustomerRegister objBAL = new BAL.DMT_CustomerRegister()) { objBAL.Entity.dmt_customerid = model.dmt_customerid; ENT.DMT_CustomerRegister customerRegister = (ENT.DMT_CustomerRegister)objBAL.GetByPrimaryKey(objBAL.Entity); var postdata = new { RemitterId = customerRegister.dmt_requestno, OTP = model.verificationotp, CustomerMobile = customerRegister.dmt_mobile }; string response = dmt.ValidateCustomerOTP(postdata, "DMT_OTP_Customer_Confirmation"); OV = JsonConvert.DeserializeObject <OTPVALIDATIONRESPONSE>(response); if (OV.code == 0) { objBAL.Entity.dmt_status = 1; objBAL.UpdateStatus(objBAL.Entity); GlobalVarible.AddMessage("Customer Verified Successfully."); } else { GlobalVarible.AddError(OV.message.ToString()); } } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage LedgerReport(GetLedgerReportModal modal) { GlobalVarible.Clear(); List <ENT.LedgerReportApiView> lstEntity = new List <ENT.LedgerReportApiView>(); try { //Find paging info var start = modal.PageStart; var length = modal.PageSize; int pageSize = length != 0 ? length : 0; int skip = start != 0 ? start : 1; skip = (skip / pageSize) + 1; COM.TTPagination.isPageing = true; COM.TTPagination.PageSize = pageSize; COM.TTPagination.PageNo = Convert.ToInt64(skip); using (BAL.LedgerReport objBal = new BAL.LedgerReport()) { if (modal.ddrange == 1) { //if (string.IsNullOrEmpty(modal.fromdate) || string.IsNullOrEmpty(modal.todate)) //{ // GlobalVarible.AddError("For custome date you must have to select form and to date."); // return ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }); //} lstEntity = objBal.GetAllSearchApi(modal.ddrange, modal.fromdate.GetDate(), modal.todate.GetDate(), modal.ddData, modal.search, User.GetUserlevel(), _LOGINUSERID); } else { lstEntity = objBal.GetAllSearchApi(modal.ddrange, DateTime.Now, DateTime.Now, modal.ddData, modal.search, User.GetUserlevel(), _LOGINUSERID); } } GlobalVarible.AddMessage("Recharge report get successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity, COM.TTPagination.RecordCount })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage GetSpectroDetail(ENT.SpectroDetailParam objENT) { List <ENT.SpectroEntry> lstResult = new List <ENT.SpectroEntry>(); try { objENT.Mode = "GetSpectroDetail"; lstResult = new DAL.SpectroEntry().GetSpectroDetailForAPI(objENT); objENT.Message = lstResult.Count + " record found."; return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { objENT, lstResult })); } catch (Exception ex) { objENT.Message = ex.Message.ToString(); ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : GetSpectroDetail()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { objENT, lstResult })); } }
public HttpResponseMessage PendingApprovalRequest(GetPendingWalletRequestModel modal) { GlobalVarible.Clear(); List <ENT.WalletRequestApiView> lstEntity = new List <ENT.WalletRequestApiView>(); try { //Find paging info var start = modal.PageStart; var length = modal.PageSize; int pageSize = length != 0 ? length : 0; int skip = start != 0 ? start : 1; skip = (skip / pageSize) + 1; COM.TTPagination.isPageing = true; COM.TTPagination.PageSize = pageSize; COM.TTPagination.PageNo = Convert.ToInt64(skip); using (BAL.WalletRequest objBal = new BAL.WalletRequest()) { // lstEntity = new BAL.WalletRequest().GetAllSearch(ddrange, fromdate.GetDate(), todate.GetDate(), ddData, User.GetUserlevel(), Guid.Parse(User.Identity.GetUserId())); if (modal.ddrange == 1) { lstEntity = objBal.GetAllSearchApi(modal.ddrange, modal.fromdate.GetDate(), modal.todate.GetDate(), modal.ddData, User.GetUserlevel(), _LOGINUSERID); } else { lstEntity = objBal.GetAllSearchApi(modal.ddrange, DateTime.Now, DateTime.Now, modal.ddData, User.GetUserlevel(), _LOGINUSERID); } } GlobalVarible.AddMessage("Approval Pending get successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity, COM.TTPagination.RecordCount })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage GetOperators(GetOperatorModel model) { GlobalVarible.Clear(); List <ENT.OperatorView> lstEntity = new List <ENT.OperatorView>(); try { using (BAL.OperatorSetup objBal = new BAL.OperatorSetup()) { lstEntity = objBal.GetOperators("IN", model.serviceid); } foreach (ENT.OperatorView o in lstEntity) { if (o.servicename == "DTH") { o.auth_maxlength = 16; o.auth_maxlength2 = 0; } else if (o.servicename == "PostPaid" || o.servicename == "Prepaid") { o.auth_maxlength = 10; o.auth_maxlength2 = 0; } else { o.auth_maxlength = 30; o.auth_maxlength2 = 50; } } GlobalVarible.AddMessage("Operators get successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage GetLatesBalance() { GlobalVarible.Clear(); try { using (BAL.UserProfile objBal = new BAL.UserProfile()) { ENT.UserProfile up = objBal.GetBalance(_LOGINUSERID); GlobalVarible.AddMessage("User Balance Get Successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, up.up_balance })); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage doWalletRequest(MDL.WalletRequest model) { GlobalVarible.Clear(); List <string> strvalidationResult = new List <string>(); try { COM.DBHelper sqlhelper = new COM.DBHelper(); strvalidationResult = ValidateWalletRequest(model); if (strvalidationResult.Count() == 0) { model.userid = Guid.Parse(User.Identity.GetUserId()); string[,] param = { { "USERID", model.userid.ToString() }, { "AMOUNT", model.wr_amount }, { "TRANSMODE", model.wr_mode.ToString() }, { "ACCOUNTNO", model.wr_accountno }, { "BANKNAME", model.wr_bankname }, { "REFID", model.wr_refrenceid },{ "REMARKS", model.wr_remakrs }, { "USERLEVEL", ((int)User.GetUserlevel()).ToString() } }; COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_REQUEST", param, true); if (M.ValueFromSQL == 1) { GlobalVarible.AddMessage(M.MessageFromSQL); } else { throw new Exception(string.Join("<br />", M.MessageFromSQL)); } } else { throw new Exception(string.Join("<br />", strvalidationResult)); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(model)); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage GetLatestVersion() { GlobalVarible.Clear(); try { using (BAL.ApplicationVersion objBal = new BAL.ApplicationVersion()) { ENT.ApplicationVersionView av = objBal.GetLatestVersion(); GlobalVarible.AddMessage("Application Version Get Successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, av })); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage GetDmtCustomers() { GlobalVarible.Clear(); List <ENT.DMT_CustomerRegisterApiView> lstEntity = new List <ENT.DMT_CustomerRegisterApiView>(); try { using (BAL.DMT_CustomerRegister objBAL = new BAL.DMT_CustomerRegister()) { lstEntity = objBAL.GetAllApiCustomer(_LOGINUSERID); } GlobalVarible.AddMessage("User Customers Get Successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage SendSpectroDataToFCM(FcmRequest model) { bool IsSuccess = false; try { FCMRootObject FCMData = new FCMRootObject(); Notification NotificationBody = new Notification(); Data NotificationData = new Data(); string dt = ""; // getDeviceID(); if (!string.IsNullOrWhiteSpace(dt)) { FCMData.to = dt; NotificationData.Description = model.JsonModel; NotificationBody.title = "GI ADMIN"; NotificationBody.body = model.JsonModel; FCMData.data = NotificationData; FCMResponse FCMResp = new FCMSender().SendClientNotification(FCMData); IsSuccess = true; return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { FCMResp, IsSuccess })); } else { IsSuccess = false; return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { Response = "Token Invalid.", IsSuccess })); } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SendSpectroDataToFCM()"); IsSuccess = false; return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message, IsSuccess })); } }
public JsonResult LoadStatastics() { DashBoardModels objDashBoardModels = new DashBoardModels(); try { objENTDashboard = objBalDashboard.GetDashboardData(Guid.Parse(User.Identity.GetUserId()), User.GetUserlevel()); objDashBoardModels.TotalCustomers = objENTDashboard.TotalCustomers; objDashBoardModels.TotalBalance = objENTDashboard.TotalBalance; objDashBoardModels.TotalTodayRequests = objENTDashboard.TotalTodayRequests; objDashBoardModels.TotalSuccess = objENTDashboard.TotalSuccess; objDashBoardModels.TotalFailed = objENTDashboard.TotalFailed; objDashBoardModels.DMTtotalSuccess = objENTDashboard.DMTtotalSuccess; objDashBoardModels.DMTtotalFailed = objENTDashboard.DMTtotalFailed; objDashBoardModels.DMTinproccess = objENTDashboard.DMTinproccess; objDashBoardModels.WalletRequests = objENTDashboard.WalletRequests; objDashBoardModels.LoginActivity = objENTDashboard.LoginActivity; } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, string.Empty); } return(Json(objDashBoardModels, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage GetLastDeviceID() { DAL.Device objDAL = new DAL.Device(); string response = ""; try { List <ENT.Device> lstENT = objDAL.GetLastDeviceID(); if (lstENT.Count > 0) { response = lstENT[0].DeviceId; } else { response = "Record not found."; } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : GetLastDeviceID()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response })); }
public JsonResult doRecharge(ENT.Recharge recharge) { GlobalVarible.Clear(); try { recharge.reqvia = "WEB"; recharge.countrycode = "IN"; recharge.accountref = DateTime.Now.Ticks.ToString(); recharge.userid = _LoginUserId; recharge.ipaddress = Request.UserHostAddress.ToString(); // this will be provided after recharge recharge.requestid = string.Empty; COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue(); using (BAL.Recharge objBal = new BAL.Recharge()) { response = objBal.DoRecharge(recharge, _LoginUserId, recharge.ipaddress); } string LocalID = string.Empty; if (response.Outval == 1) { // manage route here to call real api for process recharge. string[] REQ = response.Outmsg.Split(';'); // add log or response here. new BAL.Log().Insert(new ENT.Log() { logdata = REQ[1], CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.DATA, title = "PORTAL-REQUEST" }); #region WEBSMITHAPI if (REQ[0].Split(':')[2].StartsWith("W")) { LocalID = REQ[0].Split(':')[2].StartsWith("W") ? REQ[0].Split(':')[2].Remove(0, 1) : REQ[0].Split(':')[2]; ProcessRecharge(recharge.numbertorecharge, recharge.operatorcode, (int)recharge.amount, LocalID, recharge.reqtype); } else if (REQ[0].Split(':')[2].StartsWith("X")) { LocalID = REQ[0].Split(':')[2].StartsWith("X") ? REQ[0].Split(':')[2].Remove(0, 2) : REQ[0].Split(':')[2]; ProcessINOUT(REQ[1], LocalID); } #endregion GlobalVarible.AddMessage(REQ[0].Split(',')[0]); } else { GlobalVarible.AddError(response.Outmsg); } return(Json(MySession.Current.MessageResult)); } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge)); GlobalVarible.AddError(ex.Message); return(Json(MySession.Current.MessageResult)); } }
public HttpResponseMessage InsertHeatStartStopReportAPI(ENT.HeatStartStopReport obj) { bool IsSuccess = false, IsSendToFcm = false; string ResMessage = string.Empty; try { if (obj != null) { // insert data into live database //if (new DAL.FurnaceSwitch().InsertFurnaceSwitchAPI(obj)) //{ // ResMessage = "Data save successfully."; #region Send Heat Data To FCM if (!string.IsNullOrWhiteSpace(obj.heat_json)) { FCMRootObject FCMData = new FCMRootObject(); Notification NotificationBody = new Notification(); Data NotificationData = new Data(); // Send notification if device token found. int count = 0; List <ENT.Device> lstENT = getDeviceID(); for (int i = 0; i < lstENT.Count; i++) { if (!string.IsNullOrWhiteSpace(lstENT[i].DeviceId)) { FCMData.to = lstENT[i].DeviceId; NotificationData.Description = obj.heat_json; NotificationBody.title = "GI ADMIN"; NotificationBody.body = obj.heat_json; FCMData.data = NotificationData; // FCMData.notification = NotificationBody; // send notification using FCM sender FCMResponse s = new FCMSender().SendClientNotification(FCMData); if (s.success > 0) { // successfull send notification count count++; } } } if (count == lstENT.Count) { IsSendToFcm = true; } else { IsSendToFcm = false; } ResMessage += "[" + count.ToString() + "] Notification Send Successfull Out of [" + lstENT.Count + "]."; } #endregion return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = ResMessage })); //} //else //{ // return ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { response = "Internal Server Error." }); //} } else { return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data should not be empty or null." })); } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveDeviceID()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message })); } }
public HttpResponseMessage CreateUser(RegisterViewModel model) { GlobalVarible.Clear(); try { var user = new ApplicationUser { UserName = model.Mobile, Email = model.Email, EmailConfirmed = true, PhoneNumber = model.Mobile }; var result = UserManager.Create(user, model.Password); if (result.Succeeded) { if ((int)User.GetUserlevel() == 1) { this.UserManager.AddToRole(user.Id, "distributor"); } else if ((int)User.GetUserlevel() == 2) { this.UserManager.AddToRole(user.Id, "retailer"); } using (BAL.UserProfile objBAL = new BAL.UserProfile()) { ENT.UserProfile userProfile = objBAL.GetSlabName(_LOGINUSERID); objBAL.Entity.up_userid = new Guid(user.Id); objBAL.Entity.up_username = model.UserName; objBAL.Entity.up_mobile = model.Mobile; objBAL.Entity.up_email = model.Email; objBAL.Entity.up_address = model.Address; objBAL.Entity.up_upperid = _LOGINUSERID; if ((int)User.GetUserlevel() == 1) { objBAL.Entity.up_userlevel = COM.MyEnumration.Userlevel.SD; } else if ((int)User.GetUserlevel() == 2) { objBAL.Entity.up_userlevel = COM.MyEnumration.Userlevel.R; } objBAL.Entity.Status = COM.MyEnumration.MyStatus.Active; objBAL.Entity.up_balance = 0; objBAL.Entity.slabid = userProfile.slabid; objBAL.Entity.up_imei = string.Empty; objBAL.Entity.CreatedBy = _LOGINUSERID; objBAL.Entity.CreatedDateTime = DateTime.Now; if (objBAL.Insert(objBAL.Entity)) { GlobalVarible.AddMessage("User created successfully."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } else { GlobalVarible.AddError("Unable to save user detail.Please check data and try again."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } } } else { GlobalVarible.AddErrors(result.Errors.ToList <string>()); ERRORREPORTING.Report(new Exception(string.Join(",", result.Errors.ToList <string>())), _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage approveRequest(approveRequest data) { COM.DBHelper sqlhelper = new COM.DBHelper(); GlobalVarible.Clear(); List <string> strvalidationResult = new List <string>(); try { string token = _LOGINUSERID.ToString(); string reqdata = ENCDESC.Decrypt(data.data, token, data.userid); MDL.ApproveRequest model = new ApproveRequest(); model = new JavaScriptSerializer().Deserialize <MDL.ApproveRequest>(reqdata); strvalidationResult = ValidateApproveRequest(model); if (strvalidationResult.Count() == 0) { if (checkpassword(model.loginpassword)) { Guid wrid = new Guid(model.wr_id); Guid userid = Guid.Parse(User.Identity.GetUserId()); string[,] param = { { "WR_ID", wrid.ToString() }, { "UPPERID", userid.ToString() } }; COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_APPROVED", param, true); if (M.ValueFromSQL == 1) { // get detail user device token using (BAL.WalletRequest objUDT = new BAL.WalletRequest()) { ENT.WalletRequest request = objUDT.GetRequestById(Guid.Parse(model.wr_id)); if (request != null) { string message = "Your account is credited with with " + request.wr_amount.ToString(); FCMNOTIFICATION.SendPushNotification(request.udt_devicetoken, message, request.wr_userid, 1); } } GlobalVarible.AddMessage(M.MessageFromSQL); } else { throw new Exception(string.Join("<br />", M.MessageFromSQL)); } } else { throw new Exception(string.Join("<br />", "Invalid Password !")); } } else { throw new Exception(string.Join("<br />", strvalidationResult)); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public HttpResponseMessage RegisterCustomer(ENT.DMT_CustomerRegister model) { GlobalVarible.Clear(); registerresponse rr = new registerresponse(); try { List <string> result = new List <string>(); result = ValidateRequest(model); if (result.Count <= 0) { model.CreatedBy = _LOGINUSERID; model.dmt_userid = _LOGINUSERID; model.CreatedDateTime = DateTime.Now; model.dmt_customerid = Guid.NewGuid(); using (BAL.DMT_CustomerRegister objBAL = new BAL.DMT_CustomerRegister()) { if (objBAL.Insert(model)) { // api call for register customer in api DMT dmt = new DMT(APICONSTANT.USERNAME, APICONSTANT.PASSWORD, APICONSTANT.URL); GENERALRESPONSE RR = new GENERALRESPONSE(); CUSTOMERREGISTRATIONRESPONSE CR = new CUSTOMERREGISTRATIONRESPONSE(); // prepare post data object to check if customer is available or not object postdata = new { CustomerMobile = model.dmt_mobile }; string response = dmt.CheckUser(postdata, "DMT_CustomerValidate"); CR = JsonConvert.DeserializeObject <CUSTOMERREGISTRATIONRESPONSE>(response); if (CR.Code == "224") { postdata = new { FirstName = model.dmt_firstname, LastName = model.dmt_lastname, MobileNo = model.dmt_mobile, DateOfBirth = model.dmt_dateofbirth, Address = model.dmt_address, Pincode = model.dmt_pincode, }; response = dmt.RegisterCustomer(postdata, "DMT_CustomerRegistration"); RR = new GENERALRESPONSE(); RR = JsonConvert.DeserializeObject <GENERALRESPONSE>(response); if (RR.code == 0) { Message message = JsonConvert.DeserializeObject <Message>(RR.message.ToString()); // update remitter id of registered customer. model.dmt_requestno = message.data.remitter.id; objBAL.UpdateRemitter(model); rr.code = 1; rr.message = "Customer Added Successfully.Please verify Customer Now."; rr.customerid = model.dmt_customerid; GlobalVarible.AddMessage("SUCCESS"); } else { GlobalVarible.AddError(RR.message.ToString()); // unable to register user so deleteing from our local database. objBAL.Delete(model); } } else if (CR.Code == "1") { string message = CR.Message.ToString(); GlobalVarible.AddError(message); // unable to register user so deleteing from our local database. objBAL.Delete(model); } else { Message message = JsonConvert.DeserializeObject <Message>(CR.Message.ToString()); if (!String.IsNullOrEmpty(message.data.remitter.mobile)) { // update remitter id of registered customer. model.dmt_requestno = message.data.remitter.id; model.dmt_status = 1; objBAL.UpdateStatusWithRemitter(model); // add all beneficary which already registered. if (message.data.beneficiary.Count > 0) { List <ENT.DMT_BeneficiaryRegister> lstEntity = new List <ENT.DMT_BeneficiaryRegister>(); foreach (BENEFICIARY B in message.data.beneficiary) { lstEntity.Add(new ENT.DMT_BeneficiaryRegister { dmt_beneficiaryid = Guid.NewGuid(), userid = _LOGINUSERID, dmt_beneficiaryname = B.name, dmt_beneficiarymobile = B.mobile, dmt_customerid = model.dmt_customerid, dmt_bankname = B.bank, dmt_ifsc = B.ifsc, dmt_accountnumber = B.account, dmt_address = string.Empty, dmt_addharcard = string.Empty, dmt_status = 1, dmt_requestno = B.id, dmt_response = string.Empty, dmt_pincode = string.Empty }); } using (BAL.DMT_BeneficiaryRegister objBenificary = new BAL.DMT_BeneficiaryRegister()) { objBenificary.BulkInsert(lstEntity); } } rr.code = 2; rr.message = "Customer Added Successfully."; rr.customerid = model.dmt_customerid; GlobalVarible.AddMessage("SUCCESS"); } else { rr.code = 1; rr.message = "Customer Added Successfully.Please verify Customer Now."; rr.customerid = model.dmt_customerid; GlobalVarible.AddMessage("SUCCESS"); } } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, rr })); } else { GlobalVarible.AddError("Some error occured while saving the customer."); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, rr })); } } } else { GlobalVarible.AddErrors(result); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, rr })); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, rr })); } }
public HttpResponseMessage doTransfer(doFundTransferModel data) { COM.DBHelper sqlhelper = new COM.DBHelper(); GlobalVarible.Clear(); List <string> strvalidationResult = new List <string>(); try { string token = _LOGINUSERID.ToString(); string reqdata = ENCDESC.Decrypt(data.data, token, data.userid); MDL.FundTransfer model = new FundTransfer(); model = new JavaScriptSerializer().Deserialize <MDL.FundTransfer>(reqdata); strvalidationResult = ValidateFundTransfer(model); if (strvalidationResult.Count() == 0) { if (checkpassword(model.up_password)) { model.up_upperid = Guid.Parse(User.Identity.GetUserId()); string[,] param = { { "PARENTID", model.up_upperid.ToString() }, { "USERID", model.up_userid.ToString() }, { "BALTOADD", model.up_fundbalance }, { "TRANSMODE", model.up_mode }, { "REMARKS", model.up_remakrs }, }; COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("ADD_FUND_TO_ACCOUNT", param, true); if (M.ValueFromSQL == 1) { // get detail user device token using (BAL.UserDeviceToken objUDT = new BAL.UserDeviceToken()) { ENT.UserDeviceToken usertoken = objUDT.GetUserDeviceToken(model.up_userid); if (usertoken != null) { string message = "Your account is credited with with " + model.up_fundbalance.ToString(); FCMNOTIFICATION.SendPushNotification(usertoken.udt_devicetoken, message, model.up_userid, 1); } } GlobalVarible.AddMessage(M.MessageFromSQL); } else { throw new Exception(string.Join("<br />", M.MessageFromSQL)); } } else { throw new Exception(string.Join("<br />", "Invalid Password !")); } } else { throw new Exception(string.Join("<br />", strvalidationResult)); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }
public async Task <JsonResult> RRegister(RegisterViewModel model) { try { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Mobile, Email = model.Email, EmailConfirmed = true, PhoneNumber = model.Mobile }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { try { await this.UserManager.AddToRoleAsync(user.Id, "retailer"); ENT.UserProfile objmodel = new ENT.UserProfile(); BAL.UserProfile objBAL = new BAL.UserProfile(); objmodel = new BAL.UserProfile().GetSlabName(Guid.Parse(User.Identity.GetUserId())); objmodel.up_userid = new Guid(user.Id); objmodel.up_username = model.UserName; objmodel.up_mobile = model.Mobile; objmodel.up_email = model.Email; objmodel.up_address = model.Address; objmodel.up_upperid = Guid.Parse(User.Identity.GetUserId()); objmodel.up_userlevel = COM.MyEnumration.Userlevel.R; objmodel.Status = COM.MyEnumration.MyStatus.Active; objmodel.up_balance = 0; objmodel.slabid = objmodel.slabid; objmodel.up_imei = string.Empty; objmodel.CreatedBy = Guid.Parse(User.Identity.GetUserId()); objmodel.CreatedDateTime = DateTime.Now; if (objBAL.Insert(objmodel)) { GlobalVarible.AddMessage("Record Save Successfully"); } else { GlobalVarible.AddError("Internal Error..."); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { ERRORREPORTING.Report(ex, _REQUESTURL, _LoginUserId, _ERRORKEY, JsonConvert.SerializeObject(model)); GlobalVarible.AddError("Contact to developer.."); var context = new ApplicationDbContext(); await UserManager.DeleteAsync(user); } } else { GlobalVarible.AddErrors(result.Errors.ToList <string>()); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); } } else { var Errors = ModelState.Select(x => x.Value.Errors).Where(y => y.Count > 0).ToList(); List <string> ErrorList = new List <string>(); string error = string.Empty; foreach (var item in Errors) { error = error + ',' + item[0].ErrorMessage; ErrorList.Add(item[0].ErrorMessage); } ERRORREPORTING.Report(new Exception(error), _REQUESTURL, _LoginUserId, _ERRORKEY, JsonConvert.SerializeObject(model)); GlobalVarible.AddErrors(ErrorList); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage SaveSpectroMaster(ENT.SpectroMaster Model) { bool IsSuccess = false, IsSendToFcm = false; string ResMessage = string.Empty; try { #region Send Spectro Data To FCM FCMRootObject FCMData = new FCMRootObject(); Notification NotificationBody = new Notification(); Data NotificationData = new Data(); int count = 0; List <ENT.Device> lstENT = getDeviceID(); for (int i = 0; i < lstENT.Count; i++) { if (!string.IsNullOrWhiteSpace(lstENT[i].DeviceId)) { FCMData.to = lstENT[i].DeviceId; NotificationData.Description = Model.SpectroJson; NotificationBody.title = "GI ADMIN"; NotificationBody.body = Model.SpectroJson; FCMData.data = NotificationData; // FCMData.notification = NotificationBody; FCMResponse s = new FCMSender().SendClientNotification(FCMData); if (s.success > 0) { count++; } } } if (count == lstENT.Count) { IsSendToFcm = true; } else { IsSendToFcm = false; } ResMessage = count.ToString() + " notification send successfull out of " + lstENT.Count + "."; #endregion #region Save Master To Local Database Int64 SpectroNo = new DAL.SpectroEntry().GetTopOneSpectroNo(); Model.Mode = "ADD"; Model.SpectroID = Guid.NewGuid(); Model.SpectroNo = SpectroNo + 1; DateTime dt1 = DateTime.Now; string[] dtDate = Model.SpectroDate.Split('/'); if (dtDate.Length == 3) { dt1 = new DateTime(Convert.ToInt32(dtDate[2]), Convert.ToInt32(dtDate[0]), Convert.ToInt32(dtDate[1])); } Model.SpectroDate = dt1.ToString("dd/MMM/yyyy"); if (new DAL.SpectroEntry().InsertUpdateDeleteSpectroMaster(Model)) { ResMessage += " Entry Save Successfully."; IsSuccess = true; } else { ResMessage += " Entry Not Save Successfully."; IsSuccess = false; } #endregion } catch (Exception ex) { ResMessage += ResMessage + " Error: " + ex.Message; IsSuccess = false; ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveSpectroMaster()"); return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ResMessage, IsSuccess, IsSendToFcm })); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { ResMessage, IsSuccess, IsSendToFcm })); }
internal void ProcessRecharge(string _number, int _operatorcode, int _amounttorecharge, string _requestid, int _rechargetype) { object postdata = new { country_code = "IN", operator_code = _operatorcode, number = _number, amount = _amounttorecharge, requestid = _requestid, reqvia = "API", recharge_type = _rechargetype, optionalparam = string.Empty, optionalparam1 = string.Empty, }; try { RECHARGE WC = new RECHARGE("*****@*****.**", "Bansi@123", "http://dmtsrv.appsmith.co.in/"); // add log or response here. new BAL.Log().Insert(new ENT.Log() { logdata = new JavaScriptSerializer().Serialize(postdata), CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.APIREQ, title = "PROCESS - WEBSMITH API" }); RECHARGERESPONSE RR = WC.ProcessRecharge(postdata, "Recharge"); // add log or response here. new BAL.Log().Insert(new ENT.Log() { logdata = new JavaScriptSerializer().Serialize(RR), CreatedDateTime = DateTime.Now, type = COM.MyEnumration.LOGTYPE.APIRES, title = "PROCESS - WEBSMITH API" }); if (RR.results.Count > 0) { // getting first item from recharge result object which got from websmith api RECHARGERESPONSERESULT _result = RR.results[0]; if (_result.status_code == 3) { // update fail code here to local database. new BAL.Recharge().UpdateRecharge(_requestid, _result.transNo == null ? string.Empty : _result.transNo, 3, new JavaScriptSerializer().Serialize(_result)); } else if (_result.status_code == 4) { // update success code here to local database. new BAL.Recharge().UpdateRecharge( _requestid, _result.transNo == null ? string.Empty : _result.transNo, 4, new JavaScriptSerializer().Serialize(_result)); } } } catch (Exception ex) { ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(postdata)); } }
public HttpResponseMessage DoRechargeEnc(doRechargeModel data) { try { string token = _LOGINUSERID.ToString(); if (String.IsNullOrEmpty(token)) { GlobalVarible.AddError("Unable to get token"); ERRORREPORTING.Report(new Exception("UNABLE TO GET TOKEN"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data)); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } string reqdata = ENCDESC.Decrypt(data.data, token, data.userid); ENT.Recharge recharge = new ENT.Recharge(); recharge = new JavaScriptSerializer().Deserialize <ENT.Recharge>(reqdata); try { ERRORREPORTING.Report(new Exception("API CALL STARTED"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, reqdata); recharge.reqvia = "GPRS"; recharge.countrycode = "IN"; recharge.accountref = DateTime.Now.Ticks.ToString(); recharge.userid = _LOGINUSERID; recharge.ipaddress = HttpContext.Current.Request.UserHostAddress; // this will be provided after recharge recharge.requestid = string.Empty; COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue(); using (BAL.Recharge objBal = new BAL.Recharge()) { response = objBal.DoRecharge(recharge, _LOGINUSERID, recharge.ipaddress); } if (response.Outval == 1) { string[] REQ = response.Outmsg.Split(';'); // process for real recharge here. GlobalVarible.AddMessage(REQ[0].Split(',')[0]); } else { GlobalVarible.AddError(response.Outmsg); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge)); GlobalVarible.AddError(ex.Message); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } } catch (Exception ex) { ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data)); GlobalVarible.AddError(ex.Message); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }