// GET: DmtBeneficiary
        public ActionResult Index(Guid id)
        {
            ENT.DMT_CustomerRegister customer = null;

            using (BAL.DMT_CustomerRegister customerBAL = new BAL.DMT_CustomerRegister())
            {
                customerBAL.Entity.dmt_customerid = id;
                customer = (ENT.DMT_CustomerRegister)customerBAL.GetByPrimaryKey(customerBAL.Entity);
            }

            ViewBag.CUSTOMERID   = customer.dmt_customerid;
            ViewBag.CUSTOMERNAME = customer.dmt_firstname + " " + customer.dmt_lastname + " - " + customer.dmt_mobile;
            return(View());
        }
Example #2
0
        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 }));
            }
        }
Example #3
0
        public JsonResult 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());
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
            }
            MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML();
            return(Json(MySession.Current.MessageResult, 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));
        }