public JsonResult DeleteBeneficary(Guid benificaryid) { registerresponse rr = new registerresponse(); try { using (BAL.DMT_BeneficiaryRegister objBAL = new BAL.DMT_BeneficiaryRegister()) { ENT.DMT_BeneficiaryRegisterAdminView BR = objBAL.GetBenificarybyId(benificaryid); if (BR != null) { DMT dmt = new DMT(APICONSTANT.USERNAME, APICONSTANT.PASSWORD, APICONSTANT.URL); GENERALRESPONSE GR = new GENERALRESPONSE(); object postdata = new { CustomerMobile = BR.dmt_beneficiarymobile, BeneficiaryCode = BR.dmt_requestno, RemitterId = BR.dmt_remitterId }; string response = dmt.DeleteBeneficary(postdata, "DMT_DeleteBeneficiary"); GR = JsonConvert.DeserializeObject <GENERALRESPONSE>(response); if (GR.code == 0) { if (GR.message.ToString().ToUpper() == "OTC SEND SUCCESSFULLY") { rr.message = GR.message.ToString().ToUpper(); rr.code = 1; rr.customerid = BR.dmt_beneficiaryid; } GlobalVarible.AddMessage("SUCCESS"); } else { GlobalVarible.AddError(GR.message.ToString()); } } } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(new { MySession.Current.MessageResult, rr }, JsonRequestBehavior.AllowGet)); }
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 JsonResult SaveEntry(ENT.DMT_CustomerRegister model) { // in this method we return one json with two properties.with code and message. // if code is 1 then we have to open box for otp verification. registerresponse rr = new registerresponse(); try { List <string> result = new List <string>(); result = ValidateRequest(model); if (result.Count <= 0) { if (model.EntryMode == COM.Enumration.EntryMode.ADD) { 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 { GlobalVarible.AddError("Some error occured while saving the customer."); } } } else { model.UpdatedDateTime = DateTime.Now; model.UpdatedBy = _LoginUserId; GlobalVarible.AddMessage("Customer Updated Successfully."); } } else { GlobalVarible.AddErrors(result); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(new { MySession.Current.MessageResult, rr }, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveEntry(ENT.DMT_BeneficiaryRegister model) { // in this method we return one json with two properties.with code and message. // if code is 1 then we have to open box for otp verification. registerresponse rr = new registerresponse(); try { List <string> result = new List <string>(); result = ValidateRequest(model); if (result.Count <= 0) { if (model.EntryMode == COM.Enumration.EntryMode.ADD) { model.CreatedBy = _LoginUserId; model.userid = _LoginUserId; model.CreatedDateTime = DateTime.Now; model.dmt_beneficiaryid = Guid.NewGuid(); using (BAL.DMT_BeneficiaryRegister objBAL = new BAL.DMT_BeneficiaryRegister()) { if (objBAL.Insert(model)) { // api call for register benificary in api DMT dmt = new DMT(APICONSTANT.USERNAME, APICONSTANT.PASSWORD, APICONSTANT.URL); GENERALRESPONSE RR = new GENERALRESPONSE(); BENEFICIARYREGISTRATIONRESPONSE BR = new BENEFICIARYREGISTRATIONRESPONSE(); ENT.DMT_CustomerRegister customer = null; using (BAL.DMT_CustomerRegister customerBAL = new BAL.DMT_CustomerRegister()) { customerBAL.Entity.dmt_customerid = model.dmt_customerid; customer = (ENT.DMT_CustomerRegister)customerBAL.GetByPrimaryKey(customerBAL.Entity); } // prepare post data object to check if beneficiary is available object postdata = new { FirstName = model.dmt_beneficiaryname, LastName = model.dmt_beneficiaryname, BeneficiaryMobile = model.dmt_beneficiarymobile, CustomerMobile = customer.dmt_mobile, BankName = model.dmt_bankname, IfscCode = model.dmt_ifsc, AccountNumber = model.dmt_accountnumber, BranchName = model.dmt_branchname, Address = model.dmt_address, AddharCard = model.dmt_addharcard, Pincode = model.dmt_pincode, RemitterId = customer.dmt_requestno }; string response = dmt.RegisterBenificary(postdata, "DMT_BeneficiaryRegistration"); BR = JsonConvert.DeserializeObject <BENEFICIARYREGISTRATIONRESPONSE>(response); if (BR.Code == 0) { if (BR.Message.data.beneficiary.id > 0) { model.dmt_status = 1; model.dmt_requestno = BR.Message.data.beneficiary.id.ToString(); objBAL.UpdateStatusWithId(model); rr.code = 2; rr.message = "Benificary Added Successfully."; rr.customerid = model.dmt_beneficiaryid; GlobalVarible.AddMessage("SUCCESS"); } } else if (BR.Code == 1) { GlobalVarible.AddError(BR.Message.ToString()); } } else { GlobalVarible.AddError("Some error occured while saving the benificary."); } } } else { model.UpdatedDateTime = DateTime.Now; model.UpdatedBy = _LoginUserId; GlobalVarible.AddMessage("Benificary Updated Successfully."); } } else { GlobalVarible.AddErrors(result); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(new { MySession.Current.MessageResult, rr }, JsonRequestBehavior.AllowGet)); }