public JsonResult GetTransferCharge(moneytransfermodel model) { GlobalVarible.Clear(); var loginuser = User.Identity.GetUserId(); string transferCharge = "-1"; try { using (BAL.DMT_MoneyRemittance objTranfer = new BAL.DMT_MoneyRemittance()) { MEMBERS.SQLReturnMessageNValue retVal = objTranfer.DMT_GetCharge(model.transferamount.ToString(), _LoginUserId, (int)User.GetUserlevel()); if (retVal.Outval == 1) { transferCharge = retVal.Outmsg; GlobalVarible.AddMessage("Transfer Charge Get Successfully."); } else { GlobalVarible.AddError(retVal.Outmsg); } } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } return(Json(new { MySession.Current.MessageResult, transferCharge }, JsonRequestBehavior.AllowGet)); }
public JsonResult TransferMoney(moneytransfermodel model) { GlobalVarible.Clear(); try { // check for user password if (checkpassword(model.password)) { using (BAL.DMT_MoneyRemittance objTranfer = new BAL.DMT_MoneyRemittance()) { // check balance in local. MEMBERS.SQLReturnMessageNValue retVal = objTranfer.DMT_VALIDATE_Transaction(_LoginUserId.ToString(), model.transferamount.ToString()); if (retVal.Outval == 1) { DMT dmt = new DMT(APICONSTANT.USERNAME, APICONSTANT.PASSWORD, APICONSTANT.URL); GENERALRESPONSE GR = new GENERALRESPONSE(); ENT.DMT_BeneficiaryRegisterAdminView BD = new ENT.DMT_BeneficiaryRegisterAdminView(); ENT.DMT_CustomerRegisterAdminView CD = new ENT.DMT_CustomerRegisterAdminView(); // get customer information by id using (BAL.DMT_BeneficiaryRegister objBAL = new BAL.DMT_BeneficiaryRegister()) { BD = objBAL.GetBenificarybyId(model.benificaryid); } using (BAL.DMT_CustomerRegister objBAL = new BAL.DMT_CustomerRegister()) { CD = objBAL.GetCustomerById(model.customerid); } var postdata = new { BeneficiryCode = BD.dmt_requestno.ToString(), BeneficiryMobile = BD.dmt_beneficiarymobile.ToString(), CustomerMobile = CD.dmt_mobile.ToString(), IFSC = BD.dmt_ifsc.ToString(), AccountNo = BD.dmt_accountnumber.ToString(), RountingType = model.transfertype.ToString(), BeneficiaryName = BD.dmt_beneficiaryname.ToString(), Remakrs = model.remarks.ToString(), Amount = model.transferamount, Mode = "WEB", RemitterId = CD.dmt_requestno.ToString(), }; string response = dmt.TransferAmount(postdata, "DMT_MoneyRemittance"); GR = JsonConvert.DeserializeObject <GENERALRESPONSE>(response); if (GR.code == 0) { // amount credited successfully then calculate the commission and charge. objTranfer.Entity.userid = _LoginUserId; objTranfer.Entity.mt_beneficiarycode = BD.dmt_requestno; objTranfer.Entity.mt_BeneficiryMobile = BD.dmt_beneficiarymobile; objTranfer.Entity.mt_customermobile = CD.dmt_mobile; objTranfer.Entity.mt_ifsc = BD.dmt_ifsc; objTranfer.Entity.mt_accountnumber = BD.dmt_accountnumber; objTranfer.Entity.mt_routingtype = model.transfertype; objTranfer.Entity.mt_BeneficiaryName = BD.dmt_beneficiaryname; objTranfer.Entity.mt_remarks = model.remarks; objTranfer.Entity.mt_amount = (decimal)model.transferamount; objTranfer.Entity.mt_mode = "WEB"; objTranfer.Entity.mt_Ipaddress = GlobalVarible.GETIPADDRESS(); objTranfer.Entity.mt_RemitterId = CD.dmt_requestno; objTranfer.Entity.mt_RequestNo = string.Empty; objTranfer.Entity.mt_Response = response; retVal = objTranfer.DMT_REMITTANCE(objTranfer.Entity); if (retVal.Outval == 1) { GlobalVarible.AddMessage("Amount Transfered Successfully."); } else { GlobalVarible.AddError(retVal.Outmsg); } } else { GlobalVarible.AddError(GR.message.ToString()); } } else { GlobalVarible.AddError(retVal.Outmsg); } } } else { GlobalVarible.AddError("Invalid User Password."); } } catch (Exception ex) { GlobalVarible.AddError(ex.Message); } MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML(); return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet)); }