コード例 #1
0
        public bool UpdateStatusWithId(ENT.DMT_BeneficiaryRegister objEntity)
        {
            bool blnResult = false;

            try
            {
                //Create Fields List in dictionary
                Dictionary <string, bool> dctFields = new Dictionary <string, bool>();
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_beneficiaryid), true);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_requestno), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_status), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.UpdatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.UpdatedDateTime), false);

                objEntity.FieldCollection = dctFields;
                if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity))
                {
                    blnResult = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blnResult);
        }
コード例 #2
0
        internal List <String> ValidateRequest(ENT.DMT_BeneficiaryRegister model)
        {
            List <string> result = new List <string>();

            if (!model.dmt_beneficiarymobile.ValidateMobile())
            {
                result.Add("Please add mobile number in proper format.");
            }

            return(result);
        }
コード例 #3
0
        public object GetByPrimaryKey(ENT.DMT_BeneficiaryRegister Entity)
        {
            object objResult = null;

            try
            {
                DAL.CRUDOperation tt = new DAL.CRUDOperation();
                objResult = tt.GetEntityByPrimartKey(Entity);
            }
            catch (Exception)
            {
                throw;
            }
            return(objResult);
        }
コード例 #4
0
        // this function for just referance for partial update field user have to create seperate function learn from this function.
        public bool UpdatePartial(ENT.DMT_BeneficiaryRegister objEntity)
        {
            bool blnResult = false;

            try
            {
                //Create Fields List in dictionary
                Dictionary <string, bool> dctFields = new Dictionary <string, bool>();
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_beneficiaryid), true);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.userid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_beneficiaryname), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_beneficiarymobile), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_customerid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_bankname), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_ifsc), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_accountnumber), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_branchname), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_address), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_addharcard), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_status), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_Ipaddress), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_requestno), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_response), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.dmt_pincode), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.SystemDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.CreatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.CreatedDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.UpdatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_BeneficiaryRegister>(x => x.UpdatedDateTime), false);
                objEntity.FieldCollection = dctFields;
                if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity))
                {
                    blnResult = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blnResult);
        }
コード例 #5
0
        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));
        }