Exemplo n.º 1
0
        public JsonResult UnBlockUser(string userid, string agentid)
        {
            var  data  = new CommonDbResponse();
            bool valid = true;

            if (!String.IsNullOrEmpty(userid))
            {
                userid = userid.DecryptParameter();
                if (string.IsNullOrEmpty(userid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }

            if (!String.IsNullOrEmpty(agentid))
            {
                agentid = agentid.DecryptParameter();
                if (string.IsNullOrEmpty(agentid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }
            if (valid)
            {
                data = _distributor.block_unblockuser(userid, "Y", agentid);
                if (data.ErrorCode == 0)
                {
                    data.Message = "Successfully Un Blocked User";
                }
            }

            data.SetMessageInTempData(this);
            return(Json(data));
        }
        public ActionResult AddClient(WalletUserInfoModel walletUserModel)
        {
            ModelState.Remove("BalanceToAdd");
            ModelState.Remove("Remarks");
            if (string.IsNullOrEmpty(walletUserModel.FullName))
            {
                ModelState.AddModelError("FullName", "Full Name is Required");
            }
            if (string.IsNullOrEmpty(walletUserModel.Email))
            {
                ModelState.AddModelError("Email", "Email is Required");
            }
            if (string.IsNullOrEmpty(walletUserModel.MobileNo))
            {
                ModelState.AddModelError("MobileNo", "Mobile Number is Required");
            }
            if (ModelState.IsValid)
            {
                WalletUserInfo walletUser = new WalletUserInfo();
                walletUser.MobileNo   = walletUserModel.MobileNo;
                walletUser.Email      = walletUserModel.Email;
                walletUser.FullName   = walletUserModel.FullName;
                walletUser.ActionUser = Session["UserName"].ToString();
                walletUser.ParentId   = Session["UserId"].ToString();
                walletUser.ActionIP   = ApplicationUtilities.GetIP();
                HttpContext httpCtx = System.Web.HttpContext.Current;
                walletUser.ActionBrowser = httpCtx.Request.Headers["User-Agent"];
                CommonDbResponse dbresp = _CLientManagement.AddUser(walletUser);
                if (dbresp.ErrorCode == 0)
                {
                    dbresp.SetMessageInTempData(this);

                    //this.ShowPopup(0, "Succesfully Added amount: " + walletUser.BalanceToAdd);
                    return(RedirectToAction("UserList"));
                }
                dbresp.SetMessageInTempData(this);
            }

            return(View(walletUserModel));
        }
Exemplo n.º 3
0
        public ActionResult changepassword(UserCommon uc)
        {
            string dbmessage = string.Empty;

            ModelState.Remove("RoleId");
            ModelState.Remove("IsActive");
            ModelState.Remove("PhoneNo");
            ModelState.Remove("Email");
            ModelState.Remove("FullName");
            ModelState.Remove("UserName");
            if (string.IsNullOrEmpty(uc.OldPassword))
            {
                ModelState.AddModelError("OldPassword", "Current Password is Required");
            }
            if (ModelState.IsValid)
            {
                string     oldpwd   = uc.OldPassword;
                string     newpwd   = uc.UserPwd;
                string     username = Session["username"].ToString();
                UserCommon user     = new UserCommon
                {
                    OldPassword = oldpwd,
                    UserName    = username,
                    UserPwd     = newpwd,
                    Session     = Session.SessionID
                };



                CommonDbResponse dbresp = buss.ChangePassword(user);
                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("Index", "home"));
                }
                dbmessage = dbresp.Message;
            }
            this.ShowPopup(1, string.IsNullOrEmpty(dbmessage) ? "Error" : dbmessage);
            return(View(uc));
        }
 public ActionResult ManageAssignCategory(AssignCommissionModel ACM)
 {
     if (ModelState.IsValid)
     {
         if (!string.IsNullOrEmpty(ACM.AgentId.DecryptParameter()))
         {
             AssignCommissionCommon ACC = new AssignCommissionCommon();
             ACC.CommissionCategoryId = ACM.CommissionCategoryId;
             ACC.AgentId    = ACM.AgentId.DecryptParameter();
             ACC.ActionUser = Session["username"].ToString();
             CommonDbResponse dbresp = comm.ManageAssignCategory(ACC);
             if (dbresp.Code == 0)
             {
                 this.ShowPopup(0, dbresp.Message);
                 return(RedirectToAction("AssignCategory"));
             }
             ACM.Msg = dbresp.Message;
         }
     }
     this.ShowPopup(1, "Error " + ACM.Msg);
     return(View(ACM));
 }
Exemplo n.º 5
0
        public ActionResult AssignRole(AgentUserRole dcommon)
        {
            var agent_id = dcommon.AgentID.DecryptParameter();
            var user_id  = dcommon.UserID.DecryptParameter();

            if (string.IsNullOrEmpty(agent_id))
            {
                return(RedirectToAction("Index"));
            }
            if (!string.IsNullOrEmpty(dcommon.UserID))
            {
                if (string.IsNullOrEmpty(user_id))
                {
                    return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
                }
            }
            if (ModelState.IsValid)
            {
                var isPrimary = "n";
                if (dcommon.IsPrimary == "on")
                {
                    isPrimary = "y";
                }
                AgentManagementCommon amc = new AgentManagementCommon();
                amc.UserName  = Session["UserName"].ToString();
                amc.UserID    = user_id;
                amc.AgentID   = agent_id;
                amc.IsPrimary = isPrimary;
                amc.RoleId    = dcommon.RoleId;
                CommonDbResponse dbresp = buss.AssignAgentUserRole(amc);
                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, "Role Assigned Successfully.");
                    return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
                }
            }
            this.ShowPopup(1, "Failed to assign role to user!");
            return(View(dcommon));
        }
        /// <summary>
        /// Mobile Topup Service
        /// </summary>
        /// <param name="MobileNumber"></param>
        /// <param name="Amount"></param>
        /// <returns>Extra1=BillNumber,Extra2=RefStan</returns>
        public CommonDbResponse ConsumeService(string MobileNumber, long Amount)
        {
            CommonDbResponse response = new CommonDbResponse();

            if (!Regex.IsMatch(MobileNumber, @"^\d+$"))
            {
                response.Code    = ResponseCode.Failed;
                response.Message = "Please input valid Mobile Number";
                return(response);
            }

            var checkMobile = MobileNumberValidate(MobileNumber, Amount);

            if (checkMobile.Code != ResponseCode.Success)
            {
                response.Code    = ResponseCode.Failed;
                response.Message = checkMobile.Message;
                return(response);
            }

            IServiceRepository factory = apiServicesAbstractFactory.Create(checkMobile.ServiceName);
            var package = factory.PACKAGE(checkMobile.MobileNumber, checkMobile.ServiceCode.ToString(), Amount.ToString());

            if (package.Result != "000")
            {
                response.Code    = ResponseCode.Failed;
                response.Message = package.ResultMessage;
                return(response);
            }
            var payment = factory.PAYMENT(Amount.ToString(), checkMobile.MobileNumber, package.BillInfo.Bill.BillNumber, package.BillInfo.Bill.RefStan, checkMobile.ServiceCode.ToString());

            response.Code    = payment.Result != "000" ? ResponseCode.Failed : ResponseCode.Success;
            response.Message = payment.ResultMessage;
            response.Extra1  = package.Result == "000" ? package.BillInfo.Bill.BillNumber : "";
            response.Extra2  = package.Result == "000" ? package.BillInfo.Bill.RefStan : "";
            response.Id      = package.TransactionId;
            response.Data    = payment;
            return(response);
        }
Exemplo n.º 7
0
        private CommonDbResponse NWSCvalidation(NwscBillPaymentCommon payment)
        {
            CommonDbResponse response = new CommonDbResponse();

            if (!Regex.IsMatch(payment.CustomerId, @"^\d+$"))
            {
                response.Code    = ResponseCode.Failed;
                response.Message = "Please input valid Customer Number";
                return(response);
            }
            else if (payment.CustomerId.Length < 1 || payment.CustomerId.Length > 7)
            {
                response.Code    = ResponseCode.Failed;
                response.Message = "Please input valid length Customer Number";
                return(response);
            }
            else
            {
                response.Code = ResponseCode.Success;
                return(response);
            }
        }
Exemplo n.º 8
0
        public CommonDbResponse BillPayment(NwscBillPaymentCommon payment)
        {
            CommonDbResponse response = new CommonDbResponse();
            var checkvalidation       = NWSCvalidation(payment);

            if (checkvalidation.Code != ResponseCode.Success)
            {
                response.Code    = ResponseCode.Failed;
                response.Message = checkvalidation.Message;
                return(response);
            }
            Dictionary <string, string> Data = new Dictionary <string, string>();

            Data.Add("OfficeCode", payment.OfficeCode);
            Data.Add("SCharge", payment.OfficeCode);
            GatewaySwitchAbstractService factory = GatewaySwitchAbstractFactory.Create("cgpay");

            factory.TransactionId = payment.TransactionId;
            var fresponse = factory.ProcessTransactions(Data);

            if (fresponse.GatewayName.ToUpper() == "PRABHUPAY")
            {
                if (fresponse.Code == "000")
                {
                    response.Code = ResponseCode.Success;
                    response.Data = fresponse.Data;
                }
                else if (fresponse.Code == "777")
                {
                    response.Code = ResponseCode.Exception;
                    response.Data = fresponse.Data;
                }
                else
                {
                    response.Code = ResponseCode.Failed;
                }
            }
            return(response);
        }
Exemplo n.º 9
0
 public ActionResult Changeuserpassword(UserSearchFilter model)
 {
     ModelState.Remove("RoleId");
     ModelState.Remove("SearchFilter");
     if (ModelState.IsValid)
     {
         model.UserName   = model.UserNamePassword.DecryptParameter();
         model.ActionUser = Session["UserName"].ToString();
         model.IpAddress  = ApplicationUtilities.GetIP();
         //model.BrowserInfo = ApplicationUtilities.GetBrowserInfo();
         var common            = model.MapObject <shared.Models.User.ChangePasswordCommon>();
         CommonDbResponse resp = buss.ChangeUserPassword(common);//.SetMessageInTempData(this);
         if (resp.Code == ResponseCode.Success)
         {
             this.ShowPopup(0, "Password Changed Successfully!!");
             //resp.SetMessageInTempData(this);
             return(RedirectToAction("Index"));
         }
     }
     this.ShowPopup(1, "Something went wrong!!");
     return(RedirectToAction("SearchUser", model));
 }
        public CommonDbResponse GetTransactionLimit(string AgentId)
        {
            CommonDbResponse dbResponse = new CommonDbResponse();
            string           sqlCommand = "Execute sproc_transaction_limit @flag = 'r'";

            sqlCommand += ",@txn_type = " + DAO.FilterString("Load");
            sqlCommand += ",@agent_id = " + DAO.FilterString(AgentId);
            var dtable = DAO.ExecuteDataTable(sqlCommand);

            if (dtable != null)
            {
                dbResponse.Code    = ResponseCode.Success;
                dbResponse.Message = "Success";
                dbResponse.Data    = DAO.DataTableToObject <FundLoadTransactionLimitCommon>(dtable);
            }
            else
            {
                dbResponse.Code    = ResponseCode.Failed;
                dbResponse.Message = "Something Went Wrong";
            }
            return(dbResponse);
        }
        public ActionResult ManageSubDistributorUsers(SubDistributorManagementModel DMM)
        {
            //RemoveAgentValidation(dcommon);
            //RemoveContactPersonValidation(dcommon);
            LoadDropDownList(DMM);
            RemoveAgentValidation(DMM);
            SubDistributorManagementCommon DMC = new SubDistributorManagementCommon();

            DMC = DMM.MapObject <SubDistributorManagementCommon>();
            if (!string.IsNullOrEmpty(DMC.UserID))
            {
                ModelState.Remove("Password");
                ModelState.Remove("ConfirmPassword");
                ModelState.Remove("username");
            }
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(DMC.UserID))
                {
                    DMC.UserID = DMC.UserID.DecryptParameter();
                }
                if (!string.IsNullOrEmpty(DMC.AgentID))
                {
                    DMC.AgentID = DMC.AgentID.DecryptParameter();
                }
                DMC.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
                DMC.IpAddress  = ApplicationUtilities.GetIP();
                CommonDbResponse dbresp = buss.ManageUser(DMC);
                if (dbresp.Code == shared.Models.ResponseCode.Success)
                {
                    this.ShowPopup(0, "Save Succesfully");
                    return(RedirectToAction("ViewSubDistributorUser", new { DistId = DMC.AgentID.EncryptParameter() }));
                }
                DMC.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Save unsuccessful!" + DMC.Msg);
            return(View(DMM));
        }
        public JsonResult UserStatusChange(string agentid, string userid, string status)
        {
            var    data    = new CommonDbResponse();
            bool   valid   = true;
            string userId  = userid.DecryptParameter();
            string agentId = agentid.DecryptParameter();

            if (String.IsNullOrEmpty(userId) || String.IsNullOrEmpty(agentId))
            {
                data = new CommonDbResponse {
                    Code = ResponseCode.Failed, Message = "Invalid User."
                };
                valid = false;
            }

            if (valid)
            {
                WalletUserInfo walletUser = new WalletUserInfo();
                walletUser.UserId = userId;
                if (status.ToLower() == "y")
                {
                    walletUser.AgentStatus = "n";
                }
                if (status.ToLower() == "n")
                {
                    walletUser.AgentStatus = "y";
                }
                walletUser.AgentId = agentId;
                data = _CustomerManagement.UserStatusChange(walletUser.UserId, walletUser.AgentId, walletUser.AgentStatus);
                //if (data.ErrorCode == 0)
                //{
                //    data.Message = "Successfully Changed User";
                //}
            }

            data.SetMessageInTempData(this);
            return(Json(data));
        }
        public CommonDbResponse GetPackage(NeaBillInquiryCommon NBI)
        {
            CommonDbResponse response = new CommonDbResponse();

            GatewaySwitchAbstractService factory = GatewaySwitchAbstractFactory.Create("cgpay");
            Dictionary <string, string>  Data    = new Dictionary <string, string>();

            Data.Add("CustomerId", NBI.ConsumerId);
            Data.Add("ScNo", NBI.ScNo);
            Data.Add("OfficeCode", NBI.OfficeCode);
            Data.Add("IpAddress", NBI.IpAddress);
            Data.Add("UserId", NBI.ActionUser);
            var fresponse = factory.GetUserDetails("26", Data);

            response.Message     = fresponse.Message;
            response.GatewayName = fresponse.GatewayName;

            if (fresponse.Code == "000")
            {
                string sql = "[sproc_parse_nea_detail] @additional_value=" + fresponse.Data;
                var    dt  = dao.ExecuteDataRow(sql);

                response.Code = ResponseCode.Success;
                response.Data = fresponse.Data;
            }
            else if (fresponse.Code == "777")
            {
                response.Code = ResponseCode.Exception;
                response.Data = fresponse.Data;
            }
            else
            {
                response.Code = ResponseCode.Failed;
            }


            return(response);
        }
        public ActionResult ManageCommissionCategory(ClientCommissionCategoryModel CCM)
        {
            if (ModelState.IsValid)
            {
                ClientCommissionCategoryCommon CCC = new ClientCommissionCategoryCommon();
                CCC.CategoryId   = CCM.CategoryId.DecryptParameter();
                CCC.CategoryName = CCM.CategoryName;
                CCC.IpAddress    = ApplicationUtilities.GetIP();
                CCC.AgentId      = ApplicationUtilities.GetSessionValue("agentid").ToString();

                CCC.ActionUser = Session["username"].ToString();
                CommonDbResponse dbresp = comm.ManageCommissionCategory(CCC);


                if (dbresp.Code == 0)
                {
                    this.ShowPopup((int)dbresp.Code, dbresp.Message);
                    return(RedirectToAction("Category"));
                }
            }
            this.ShowPopup(1, "Error");
            return(View());
        }
Exemplo n.º 15
0
        /// <summary>
        /// Parses DataTable To CommonDbResponse object
        /// </summary>
        /// <param name="dt">DataTable Object</param>
        /// <returns></returns>
        public CommonDbResponse ParseCommonDbResponse(System.Data.DataTable dt)
        {
            var res = new CommonDbResponse();

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    string Code = dt.Rows[0][0].ToString();
                    string Message = dt.Rows[0][1].ToString();
                    string Extra1 = "", Extra2 = "", Extra3 = "", Extra4 = "", Extra5 = "";
                    if (dt.Columns.Count > 2)
                    {
                        Extra1 = dt.Rows[0][2].ToString();
                    }
                    if (dt.Columns.Count > 3)
                    {
                        Extra2 = dt.Rows[0][3].ToString();
                    }
                    if (dt.Columns.Count > 4)
                    {
                        Extra3 = dt.Rows[0][4].ToString();
                    }
                    if (dt.Columns.Count > 5)
                    {
                        Extra4 = dt.Rows[0][5].ToString();
                    }
                    if (dt.Columns.Count > 6)
                    {
                        Extra5 = dt.Rows[0][6].ToString();
                    }
                    res.SetMessage(Code, Message, Extra1, Extra2, Extra3, Extra4, Extra5);
                }
            }
            return(res);
        }
Exemplo n.º 16
0
        public ActionResult ManageStaticData(StaticDataModel SDM)
        {
            StaticDataCommon SDC = new StaticDataCommon();

            if (ModelState.IsValid)
            {
                SDC = SDM.MapObject <StaticDataCommon>();
                SDC.StaticDataTypeId = SDC.StaticDataTypeId.DecryptParameter();

                if (!string.IsNullOrEmpty(SDC.StaticDataId))
                {
                    SDC.StaticDataId = SDC.StaticDataId.DecryptParameter();
                }
                SDC.ActionUser = Session["username"].ToString();
                CommonDbResponse dbresp = buss.ManageStaticData(SDC);
                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("StaticDataList", new { SdatatypeID = SDM.StaticDataTypeId }));
                }
            }
            this.ShowPopup(1, "Error");
            return(View(SDM));
        }
Exemplo n.º 17
0
 public JsonResult DisableAgent(string AgentId)
 {
     if (!string.IsNullOrEmpty(AgentId))
     {
         if (!string.IsNullOrEmpty(AgentId.DecryptParameter()))
         {
             AgentManagementCommon amc = new AgentManagementCommon();
             amc.AgentID    = AgentId.DecryptParameter();
             amc.IpAddress  = ApplicationUtilities.GetIP();
             amc.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
             amc.UserStatus = "N";
             CommonDbResponse dbresp = buss.Disable_EnableAgent(amc);
             if (dbresp.ErrorCode == 0)
             {
                 dbresp.Message = "Successfully Blocked Agent";
                 dbresp.SetMessageInTempData(this);
             }
             return(Json(dbresp));
         }
     }
     return(Json(new CommonDbResponse {
         ErrorCode = 1, Message = "Invalid Agent."
     }));
 }
Exemplo n.º 18
0
        public ActionResult CardApprovalDetail(CardModel cardModel, string btnApprove)
        {
            if (btnApprove.ToUpper() == "REJECT")
            {
                cardModel.RequestStatus = "Rejected";
            }
            if (btnApprove.ToUpper() == "APPROVE")
            {
                cardModel.RequestStatus = "Approved";
            }
            //Get user info from userName
            WalletUserInfo walletUser = _walletUserBusiness.UserInfo(cardModel.UserName);

            cardModel.UserId     = walletUser.UserId;
            cardModel.AgentId    = walletUser.AgentId;
            cardModel.ActionUser = Session["UserId"].ToString();
            cardModel.CreatedIp  = ApplicationUtilities.GetIP();
            cardModel.CardType   = _card.GetCardType().FirstOrDefault(x => x.Value == cardModel.CardType).Key;
            CardCommon       cardCommon = cardModel.MapObject <CardCommon>();
            CommonDbResponse dbResponse = _card.CardApproval(cardCommon);

            dbResponse.SetMessageInTempData(this);
            return(RedirectToAction("CardApprovalList"));
        }
        public CommonDbResponse CheckVianetAccount(VianetBillInquiryCommon Common)
        {
            CommonDbResponse            response = new CommonDbResponse();
            Dictionary <string, string> Data     = new Dictionary <string, string>();

            Data.Add("VianetCustomerId", Common.VianetCustomerId);
            Data.Add("IpAddress", Common.IpAddress);
            Data.Add("UserId", Common.UserId);
            GatewaySwitchAbstractService factory = GatewaySwitchAbstractFactory.Create("cgpay");
            var fresponse = factory.GetUserDetails("33", Data);

            response.Message     = fresponse.Message;
            response.GatewayName = fresponse.GatewayName;
            if (fresponse.Code == "000")
            {
                response.Code = ResponseCode.Success;
                response.Data = fresponse.Data;
            }
            else
            {
                response.Code = ResponseCode.Failed;
            }
            return(response);
        }
Exemplo n.º 20
0
        public ActionResult ManageAgent(AgentNewModel agentModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate)
        {
            var Agent_LogoPath               = "";
            var Pan_CertiticatePath          = "";
            var Registration_CertificatePath = "";

            LoadDropDownList(agentModel);
            if (ModelState.IsValid)
            {
                AgentNewCommon AC = new AgentNewCommon();
                AC = agentModel.MapObject <AgentNewCommon>();
                if (!string.IsNullOrEmpty(AC.AgentID))
                {
                    if (string.IsNullOrEmpty(AC.AgentID.DecryptParameter()))
                    {
                        return(View(agentModel));
                    }
                }
                if (!string.IsNullOrEmpty(AC.ParentID))
                {
                    if (string.IsNullOrEmpty(AC.ParentID.DecryptParameter()))
                    {
                        return(View(agentModel));
                    }
                }
                AC.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
                AC.IpAddress  = ApplicationUtilities.GetIP();

                if (Agent_Logo != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Agent_Logo.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Agent_Logo.FileName);
                    if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(agentModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Agent_Logo.FileName;
                        Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                        AC.AgentLogo   = myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(agentModel));
                    }
                }
                if (AC.AgentOperationType.ToUpper() == "BUSINESS")
                {
                    if (Pan_Certiticate != null)
                    {
                        var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                        var    fileName          = Path.GetFileName(Pan_Certiticate.FileName);
                        String timeStamp         = DateTime.Now.ToString();
                        var    ext = Path.GetExtension(Pan_Certiticate.FileName);
                        if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB
                        {
                            this.ShowPopup(1, "Image Size must be less than 1MB");
                            return(View(agentModel));
                        }
                        if (allowedExtensions.Contains(ext.ToLower()))
                        {
                            string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                            string myfilename = "logo " + datet + "." + Pan_Certiticate.FileName;
                            Pan_CertiticatePath    = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                            AC.AgentPanCertificate = myfilename;
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(agentModel));
                        }
                    }

                    if (Registration_Certificate != null)
                    {
                        var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                        var    fileName          = Path.GetFileName(Registration_Certificate.FileName);
                        String timeStamp         = DateTime.Now.ToString();
                        var    ext = Path.GetExtension(Registration_Certificate.FileName);
                        if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB
                        {
                            this.ShowPopup(1, "Image Size must be less than 1MB");
                            return(View(agentModel));
                        }
                        if (allowedExtensions.Contains(ext.ToLower()))
                        {
                            string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                            string myfilename = "logo " + datet + "." + Registration_Certificate.FileName;
                            Registration_CertificatePath    = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                            AC.AgentRegistrationCertificate = myfilename;
                            //Registration_Certificate.SaveAs(path);
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(agentModel));
                        }
                    }
                }
                CommonDbResponse dbresp = buss.ManageAgent(AC);
                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("Index"));
                }
                agentModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + agentModel.Msg);
            return(View(agentModel));
        }
Exemplo n.º 21
0
        public ActionResult Details(KYCModel kycModel, HttpPostedFileBase PPImageFile, HttpPostedFileBase Id_DocumentFrontFile, HttpPostedFileBase Id_DocumentBackFile, string submitbutton, string OthersRemarks = "")
        {
            if (submitbutton.ToUpper() == "GOBACK")
            {
                return(RedirectToAction("Index", ControllerName));
            }
            LoadDropDownList(kycModel);
            #region FileLocation

            string FileLocation;
            string usertype = kycModel.AgentType;
            if (usertype.ToLower() == "distributor")
            {
                FileLocation = "/Content/userupload/Distributor/kyc/";
            }
            else if (usertype.ToLower() == "sub-distributor")
            {
                FileLocation = "/Content/userupload/SubDistributor/kyc/";
            }
            else if (usertype.ToLower() == "walletuser")
            {
                FileLocation = "/Content/userupload/Walletuser/kyc/";
            }
            else if (usertype.ToLower() == "merchant")
            {
                FileLocation = "/Content/userupload/Merchant/kyc/";
            }
            else if (usertype.ToLower() == "agent")
            {
                FileLocation = "/Content/userupload/Agent/kyc/";
            }
            else if (usertype.ToLower() == "sub-agent")
            {
                FileLocation = "/Content/userupload/SubAgent/kyc/";
            }
            else
            {
                FileLocation = "/Content/userupload/";
            }

            ViewBag.FileLocation = FileLocation;
            #endregion
            if (String.IsNullOrEmpty(kycModel.AgentId))
            {
                return(RedirectToAction("Index", ControllerName));
            }
            string status = "";
            if (submitbutton.ToUpper() == "REJECT")
            {
                status = "r";
                if (kycModel.Remarks.ToUpper().Equals("OTHERS"))
                {
                    if (OthersRemarks == "")
                    {
                        ModelState.AddModelError("OtherRemarks", "Other Remarks is Required");
                        return(View(kycModel));
                    }
                    else
                    {
                        kycModel.Remarks = "Others::" + OthersRemarks;
                    }
                }
                RejectValidation();
            }
            else if (submitbutton.ToUpper() == "APPROVE")
            {
                status = "a";
                ModelState.Remove(("Remarks"));
            }
            else if (submitbutton.ToUpper() == "UPDATE")
            {
                status = "u";
                ModelState.Remove(("Remarks"));
            }
            else
            {
                return(RedirectToAction("Index", ControllerName));
            }

            if (submitbutton.ToUpper() != "REJECT")
            {
                if ((Id_DocumentFrontFile == null && string.IsNullOrEmpty(kycModel.Id_DocumentFront)) ||
                    (PPImageFile == null && string.IsNullOrEmpty(kycModel.PPImage)) ||
                    (Id_DocumentBackFile == null && string.IsNullOrEmpty(kycModel.Id_DocumentBack) && kycModel.Id_type.ToUpper() == "CITIZENSHIP"))
                {
                    if (Id_DocumentFrontFile == null && string.IsNullOrEmpty(kycModel.Id_DocumentFront))
                    {
                        ModelState.AddModelError("Id_DocumentFront", "Document Front Image is Required");
                    }
                    if (PPImageFile == null && string.IsNullOrEmpty(kycModel.PPImage))
                    {
                        ModelState.AddModelError("PPImage", "Profile Image is Required");
                    }
                    if ((Id_DocumentBackFile == null && string.IsNullOrEmpty(kycModel.Id_DocumentBack) && kycModel.Id_type.ToUpper() == "CITIZENSHIP"))
                    {
                        ModelState.AddModelError("Id_DocumentBack", "Document Front Image is Required");
                    }
                    return(View(kycModel));
                }

                if (kycModel.Id_type.ToUpper() == "CITIZENSHIP")
                {
                    ModelState.Remove(("Id_ExpiryDateAD"));
                    ModelState.Remove(("Id_ExpiryDateBS"));
                }
                string temp_address = kycModel.SameAsPermanentAddress.ToString();
                if (temp_address == "True")
                {
                    kycModel.TProvince  = kycModel.PProvince;
                    kycModel.TDistrict  = kycModel.PDistrict;
                    kycModel.TLocalBody = kycModel.PLocalBody;
                    kycModel.TWardNo    = kycModel.PWardNo;
                    kycModel.TAddress   = kycModel.PAddress;
                }
            }

            string ID                   = "";
            var    PPImagePath          = "";
            var    Id_DocumentFrontPath = "";
            var    Id_DocumentBackPath  = "";

            if (ModelState.IsValid)
            {
                //kycModel.Remarks = String.IsNullOrEmpty(kycModel.Remarks) ? "" :
                //  kycModel.Remarks.ToUpper().Equals("OTHERS") ? OthersRemarks : kycModel.Remarks;

                kycModel.ActionUser = Session["UserName"].ToString();

                ID = kycModel.AgentId.DecryptParameter();
                kycModel.AgentId = ID;

                #region "PPImage"
                if (PPImageFile != null && (status.ToUpper() == "A" || status.ToUpper() == "U"))
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(PPImageFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(PPImageFile.FileName);
                    if (PPImageFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', ' ').Replace(':', ' ');
                        string myfilename = kycModel.MobileNo + "-PPImage-" + datet + ext;
                        PPImagePath      = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        kycModel.PPImage = FileLocation + myfilename;
                        //PPImageFile.SaveAs(PPImagePath);
                    }
                    else
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                }
                #endregion
                #region "Id_DocumentFront"
                if (Id_DocumentFrontFile != null && (status.ToUpper() == "A" || status.ToUpper() == "U"))
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Id_DocumentFrontFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Id_DocumentFrontFile.FileName);
                    if (Id_DocumentFrontFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', ' ').Replace(':', ' ');
                        string myfilename = kycModel.MobileNo + "-Id_DocumentFront-" + datet + ext;
                        Id_DocumentFrontPath      = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        kycModel.Id_DocumentFront = FileLocation + myfilename;
                        //Id_DocumentFrontFile.SaveAs(Id_DocumentFrontPath);
                    }
                    else
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                }
                #endregion
                #region "Id_DocumentBack"
                if (Id_DocumentBackFile != null && (status.ToUpper() == "A" || status.ToUpper() == "U"))
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Id_DocumentBackFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Id_DocumentBackFile.FileName);
                    if (Id_DocumentBackFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', ' ').Replace(':', ' ');
                        string myfilename = kycModel.MobileNo + "-Id_DocumentBack-" + datet + ext;
                        Id_DocumentBackPath      = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        kycModel.Id_DocumentBack = FileLocation + myfilename;
                        //Id_DocumentBackFile.SaveAs(Id_DocumentBackPath);
                    }
                    else
                    {
                        return(RedirectToAction("Details", ControllerName, ID));
                    }
                }
                #endregion
                KYCCommon        kycCommon  = kycModel.MapObject <KYCCommon>();
                CommonDbResponse dbResponse = _kyc.UpadateKycDetails(kycCommon, status);
                if (dbResponse.Code == 0)
                {
                    //SaveImages On Success
                    if (PPImagePath != "")
                    {
                        PPImageFile.SaveAs(PPImagePath);
                    }
                    if (Id_DocumentFrontPath != "")
                    {
                        Id_DocumentFrontFile.SaveAs(Id_DocumentFrontPath);
                    }
                    if (Id_DocumentBackPath != "")
                    {
                        Id_DocumentBackFile.SaveAs(Id_DocumentBackPath);
                    }
                    //Ends SaveImages
                }
                dbResponse.SetMessageInTempData(this);
                return(RedirectToAction("Index"));
            }

            return(View(kycModel));
            //return RedirectToAction("Index");
        }
Exemplo n.º 22
0
        public ActionResult ManageServices(ServicesModel SM, HttpPostedFileBase file)
        {
            string productid = "";

            if (ModelState.IsValid)
            {
                string username = Session["UserName"].ToString();
                SM.StatusList = LoadDropdownList("status") as List <SelectListItem>;

                productid = SM.ProductId;
                if (!string.IsNullOrEmpty(productid))
                {
                    if (string.IsNullOrEmpty(productid.DecryptParameter()))
                    {
                        return(RedirectToAction("ManageServices", SM));
                    }
                    SM.ProductId = productid.DecryptParameter();
                    SM.Status    = "";
                }
                var path = "";
                #region "logo"
                if (file != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(file.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(file.FileName);
                    if (file.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(RedirectToAction("ManageServices", ControllerName, productid));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = SM.ProductType.Replace('|', '.') + "." + file.FileName;
                        path           = Path.Combine(Server.MapPath("~/Content/assets/images/service logos"), myfilename);
                        SM.ProductLogo = myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(RedirectToAction("ManageServices", ControllerName, productid));
                    }
                }
                #endregion


                ServicesCommon   service = SM.MapObject <ServicesCommon>();
                CommonDbResponse dbresp  = _services.ManageServices(service, username);
                if (dbresp.Code == 0)
                {
                    if (path != "")
                    {
                        file.SaveAs(path);
                    }
                    this.ShowPopup(0, "Save Succesfully");
                    // dbresp.SetMessageInTempData(this);
                    return(RedirectToAction("Index"));
                }
            }
            this.ShowPopup(1, "Error");
            // dbresp.SetMessageInTempData(this);

            return(RedirectToAction("ManageServices", SM));
        }
Exemplo n.º 23
0
        public ActionResult Details(KYCModelDetail kycModel, string submitbutton, string OthersRemarks = "")
        {
            if (submitbutton.ToUpper() == "GOBACK")
            {
                return(RedirectToAction("Index", ControllerName));
            }
            KYCModel kyc = new KYCModel();

            kyc = kycModel.MapObject <KYCModel>();
            LoadDropDownList(kyc);
            #region FileLocation

            string FileLocation;
            string usertype = kycModel.AgentType;
            if (usertype.ToLower() == "distributor")
            {
                FileLocation = "/Content/userupload/Distributor/kyc/";
            }
            else if (usertype.ToLower() == "sub-distributor")
            {
                FileLocation = "/Content/userupload/SubDistributor/kyc/";
            }
            else if (usertype.ToLower() == "walletuser")
            {
                FileLocation = "/Content/userupload/Walletuser/kyc/";
            }
            else if (usertype.ToLower() == "merchant")
            {
                FileLocation = "/Content/userupload/Merchant/kyc/";
            }
            else if (usertype.ToLower() == "agent")
            {
                FileLocation = "/Content/userupload/Agent/kyc/";
            }
            else if (usertype.ToLower() == "sub-agent")
            {
                FileLocation = "/Content/userupload/SubAgent/kyc/";
            }
            else
            {
                FileLocation = "/Content/userupload/";
            }

            ViewBag.FileLocation = FileLocation;
            #endregion
            if (String.IsNullOrEmpty(kycModel.AgentId))
            {
                return(RedirectToAction("Index", ControllerName));
            }
            string status = "";
            if (submitbutton.ToUpper() == "REJECT")
            {
                status = "r";
                if (kycModel.Remarks.ToUpper().Equals("OTHERS"))
                {
                    if (OthersRemarks == "")
                    {
                        ModelState.AddModelError("OtherRemarks", "Other Remarks is Required");
                        return(View(kycModel));
                    }
                    else
                    {
                        kycModel.Remarks = "Others::" + OthersRemarks;
                    }
                }
                RejectValidation();
            }
            else if (submitbutton.ToUpper() == "APPROVE")
            {
                status = "a";
                ModelState.Remove(("Remarks"));
            }

            else
            {
                return(RedirectToAction("Index", ControllerName));
            }

            kycModel.ActionUser = Session["UserName"].ToString();
            kycModel.AgentId    = kycModel.AgentId.DecryptParameter();
            KYCCommon        kycCommon  = kycModel.MapObject <KYCCommon>();
            CommonDbResponse dbResponse = _kyc.UpadateKycDetails(kycCommon, status);
            dbResponse.SetMessageInTempData(this);
            return(RedirectToAction("Index"));
        }
        public CommonDbResponse DirectPayment(string TransactionId)
        {
            CommonDbResponse response = new CommonDbResponse();

            GatewaySwitchAbstractService factory = GatewaySwitchAbstractFactory.Create("cgpay");

            factory.TransactionId = TransactionId;
            var fresponse = factory.ProcessTransactions();

            response.Message     = fresponse.Message;
            response.Data        = fresponse.Data;
            response.GatewayName = fresponse.GatewayName;

            if (fresponse.Code == "000")
            {
                response.Code = ResponseCode.Success;
            }
            else if (fresponse.Code == "777")
            {
                response.Code = ResponseCode.Exception;
            }
            else
            {
                response.Code = ResponseCode.Failed;
            }

            //if (fresponse.GatewayName.ToUpper() == "PRABHUPAY")
            //{
            //    response.Message = fresponse.Message;


            //    if (fresponse.Code == "000")
            //    {
            //        response.Code = ResponseCode.Success;
            //        response.Data = fresponse.Data;

            //    }
            //    else if (fresponse.Code == "777")
            //    {
            //        response.Code = ResponseCode.Exception;
            //        response.Data = fresponse.Data;

            //    }
            //    else
            //    {
            //        response.Code = ResponseCode.Failed;
            //    }
            //}


            //}
            //if(fresponse.GatewayName.ToUpper() == "PAYPOINT")
            //{

            //    response.Message = fresponse.Message;
            //    if (fresponse.Code == "000")
            //    {
            //        response.Code = ResponseCode.Success;
            //        response.Data = fresponse.Data;

            //    }
            //    else if (fresponse.Code == "777")
            //    {
            //        response.Code = ResponseCode.Exception;
            //    }
            //    else
            //    {
            //        response.Code = ResponseCode.Failed;
            //    }
            //}



            //if (payment.GatewayName == "PAYPOINT")
            //{
            //    if (payment.Code == shared.Models.ResponseCode.Success)
            //    {
            //        var billNo = payment.Extra1;
            //        var refStan = payment.Extra2;
            //        var ppresponse = (PPResponse)payment.Data;
            //        var data = new MobileTopUpPaymentUpdateRequest();
            //        data.action_user = Session["UserName"].ToString();
            //        data.transaction_id = response.Extra1;
            //        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
            //        data.amount = clientModel.Amount;
            //        data.bill_number = billNo;
            //        data.refstan = refStan;
            //        data.status_code = ppresponse.Result;
            //        data.remarks = ppresponse.ResultMessage;
            //        data.ip_address = ApplicationUtilities.GetIP();
            //        data.product_id = clientModel.ProductId;
            //        data.partner_txn_id = ppresponse.TransactionId;
            //        response = _mtp.MobileTopUpPaymentResponse(data);
            //        failed = false;

            //    }
            //    else
            //    {
            //        var ppresponse = (PPResponse)payment.Data;
            //        var data = new MobileTopUpPaymentUpdateRequest();
            //        data.action_user = Session["UserName"].ToString();
            //        data.transaction_id = response.Extra1;
            //        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
            //        data.amount = clientModel.Amount;
            //        data.status_code = ((int)payment.Code).ToString();
            //        data.remarks = payment.Message;
            //        data.ip_address = ApplicationUtilities.GetIP();
            //        data.product_id = clientModel.ProductId;
            //        response = _mtp.MobileTopUpPaymentResponse(data);

            //    }
            //}
            //if (payment.GatewayName == "PRABHUPAY")
            //{
            //    if (payment.Code == ResponseCode.Success)
            //    {
            //        var billNo = payment.Extra1;
            //        var refStan = payment.Extra2;
            //        var ppresponse = (PPResponse)payment.Data;
            //        var data = new MobileTopUpPaymentUpdateRequest();
            //        data.action_user = Session["UserName"].ToString();
            //        data.transaction_id = response.Extra1;
            //        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
            //        data.amount = clientModel.Amount;
            //        data.bill_number = billNo;
            //        data.refstan = refStan;
            //        data.status_code = ppresponse.Result;
            //        data.remarks = ppresponse.ResultMessage;
            //        data.ip_address = ApplicationUtilities.GetIP();
            //        data.product_id = clientModel.ProductId;
            //        data.partner_txn_id = ppresponse.TransactionId;
            //        response = _mtp.MobileTopUpPaymentResponse(data);
            //        failed = false;

            //    }
            //    else if (payment.Code == ResponseCode.Exception)
            //    {

            //        var billNo = payment.Extra1;
            //        var refStan = payment.Extra2;
            //        var ppresponse = (PPResponse)payment.Data;
            //        var data = new MobileTopUpPaymentUpdateRequest();
            //        data.action_user = Session["UserName"].ToString();
            //        data.transaction_id = response.Extra1;
            //        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
            //        data.amount = clientModel.Amount;
            //        data.bill_number = billNo;
            //        data.refstan = refStan;
            //        data.status_code = ppresponse.Result;
            //        data.remarks = ppresponse.ResultMessage;
            //        data.ip_address = ApplicationUtilities.GetIP();
            //        data.product_id = clientModel.ProductId;
            //        data.partner_txn_id = ppresponse.TransactionId;
            //        response = _mtp.MobileTopUpPaymentResponse(data);
            //        failed = false;
            //    }
            //    else
            //    {
            //        var ppresponse = (PPResponse)payment.Data;
            //        var data = new MobileTopUpPaymentUpdateRequest();
            //        data.action_user = Session["UserName"].ToString();
            //        data.transaction_id = response.Extra1;
            //        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
            //        data.amount = clientModel.Amount;
            //        data.status_code = ((int)payment.Code).ToString();
            //        data.remarks = payment.Message;
            //        data.ip_address = ApplicationUtilities.GetIP();
            //        data.product_id = clientModel.ProductId;
            //        response = _mtp.MobileTopUpPaymentResponse(data);
            //    }
            //}



            return(response);
        }
Exemplo n.º 25
0
        public ActionResult Manage(DistributorCommon DModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate)
        {
            string DistId                       = "";
            var    Agent_LogoPath               = "";
            var    Pan_CertiticatePath          = "";
            var    Registration_CertificatePath = "";
            string op_type                      = DModel.AgentOperationType;

            //string temp_address = DModel..ToString();
            DistId = DModel.AgentID;
            if (!string.IsNullOrEmpty(DModel.AgentID))
            {
                RemoveUpdateValidation(DModel);
                ModelState.Remove("ContactPersonIDExpiryDate");
                ModelState.Remove("ContactPersonIDExpiryDate_BS");
            }
            if (DModel.AgentOperationType == "Individual")
            {
                RemoveContactPersonValidation(DModel);
            }
            LoadDropDownList(DModel);
            if (ModelState.IsValid)
            {
                string username = Session["UserName"].ToString();
                if (!string.IsNullOrEmpty(DModel.AgentID))
                {
                    if (string.IsNullOrEmpty(DModel.AgentID.DecryptParameter()))
                    {
                        return(View("Manage", DModel));
                    }
                    DModel.AgentID = DModel.AgentID.DecryptParameter();
                }

                DModel.ActionUser = Session["username"].ToString();
                DModel.IpAddress  = ApplicationUtilities.GetIP();


                if (Pan_Certiticate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Pan_Certiticate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Pan_Certiticate.FileName);
                    if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(DModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Pan_Certiticate.FileName;
                        Pan_CertiticatePath        = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                        DModel.AgentPanCertificate = myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(DModel));
                    }
                }

                if (Registration_Certificate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Registration_Certificate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Registration_Certificate.FileName);
                    if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(DModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Registration_Certificate.FileName;
                        Registration_CertificatePath        = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                        DModel.AgentRegistrationCertificate = myfilename;
                        //Registration_Certificate.SaveAs(path);
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(DModel));
                    }
                }

                if (Agent_Logo != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Agent_Logo.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Agent_Logo.FileName);
                    if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(DModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Agent_Logo.FileName;
                        Agent_LogoPath   = Path.Combine(Server.MapPath("~/Content/assets/images/distributor_image"), myfilename);
                        DModel.AgentLogo = myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(DModel));
                    }
                }
                //DModel.DistributorId = DModel.DistributorId.DecryptParameter();
                CommonDbResponse dbresp = _distributor.ManageDistributor(DModel, username);

                if (dbresp.Code == 0)
                // if (dbresp.Code == shared.Models.ResponseCode.Success)
                {
                    if (!string.IsNullOrEmpty(Agent_LogoPath))
                    {
                        Agent_Logo.SaveAs(Agent_LogoPath);
                    }
                    if (!string.IsNullOrEmpty(Registration_CertificatePath))
                    {
                        Registration_Certificate.SaveAs(Registration_CertificatePath);
                    }
                    if (!string.IsNullOrEmpty(Pan_CertiticatePath))
                    {
                        Pan_Certiticate.SaveAs(Pan_CertiticatePath);
                    }
                    //SaveImages On Success
                    //Ends SaveImages
                    this.ShowPopup(0, "Saved Succesfully");
                    return(RedirectToAction("Index"));
                }
            }
            this.ShowPopup(1, "Please fill out all the field stating * (Mandatory)");
            return(View(DModel));
        }
        public ActionResult ManageMerchant(MerchantModel merchantModel, HttpPostedFileBase Merchant_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword)
        {
            var Merchant_LogoPath            = "";
            var Pan_CertiticatePath          = "";
            var Registration_CertificatePath = "";

            LoadDropDownList(merchantModel);
            if (!string.IsNullOrEmpty(merchantModel.MerchantID.DecryptParameter()))
            {
                ModelState.Remove("UserName");
                if (string.IsNullOrEmpty(changepassword))
                {
                    ModelState.Remove("Password");
                    ModelState.Remove("ConfirmPassword");
                }
            }
            if (ModelState.IsValid)
            {
                MerchantCommon merchantCommon = new MerchantCommon();
                merchantCommon = merchantModel.MapObject <MerchantCommon>();
                if (!string.IsNullOrEmpty(merchantCommon.MerchantID))
                {
                    if (string.IsNullOrEmpty(merchantCommon.MerchantID.DecryptParameter()))
                    {
                        return(View(merchantModel));
                    }
                    if (string.IsNullOrEmpty(changepassword))
                    {
                        merchantCommon.Password             = "";
                        merchantCommon.ConfirmPassword      = "";
                        merchantCommon.MerchantEmail        = "";
                        merchantCommon.MerchantMobileNumber = "";
                    }
                    merchantCommon.MerchantID = merchantCommon.MerchantID.DecryptParameter();
                    merchantCommon.UserID     = merchantCommon.UserID.DecryptParameter();
                }
                if (!string.IsNullOrEmpty(merchantCommon.ParentID))
                {
                    if (string.IsNullOrEmpty(merchantCommon.ParentID.DecryptParameter()))
                    {
                        return(View(merchantModel));
                    }
                    merchantCommon.ParentID = merchantCommon.ParentID.DecryptParameter();
                }
                merchantCommon.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
                merchantCommon.IpAddress  = ApplicationUtilities.GetIP();

                if (Merchant_Logo != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Merchant_Logo.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Merchant_Logo.FileName);
                    if (Merchant_Logo.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Merchant_Logo.FileName;
                        Merchant_LogoPath           = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantLogo = "/Content/userupload/merchant/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                if (Pan_Certiticate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Pan_Certiticate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Pan_Certiticate.FileName);
                    if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "pan " + datet + "." + Pan_Certiticate.FileName;
                        Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantPanCertificate = "/Content/userupload/merchant/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                if (Registration_Certificate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Registration_Certificate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Registration_Certificate.FileName);
                    if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "reg " + datet + "." + Registration_Certificate.FileName;
                        Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantRegistrationCertificate = "/Content/userupload/merchant/" + myfilename;

                        //Registration_Certificate.SaveAs(path);
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                CommonDbResponse dbresp = _merchant.ManageMerchant(merchantCommon);
                if (dbresp.Code == 0)
                {
                    if (Pan_Certiticate != null)
                    {
                        Pan_Certiticate.SaveAs(Pan_CertiticatePath);
                    }
                    if (Registration_Certificate != null)
                    {
                        Registration_Certificate.SaveAs(Registration_CertificatePath);
                    }

                    if (Merchant_Logo != null)
                    {
                        Merchant_Logo.SaveAs(Merchant_LogoPath);
                    }
                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("Index"));
                }
                merchantModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + merchantModel.Msg);
            return(View(merchantModel));
        }
Exemplo n.º 27
0
        public ActionResult ManageAgent(AgentManagementModel agentModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword = "")
        {
            var Agent_LogoPath               = "";
            var Pan_CertiticatePath          = "";
            var Registration_CertificatePath = "";

            ModelState.Remove("AgentContractDate_BS");
            LoadDropDownList(agentModel);
            if (!string.IsNullOrEmpty(agentModel.AgentID))
            {
                agentModel.AgentID = agentModel.AgentID.DecryptParameter();
                ModelState.Remove("userName");
                if (changepassword.ToUpper() != "ON")
                {
                    RemoveupdateValidation(agentModel);
                    agentModel.Password        = "";
                    agentModel.ConfirmPassword = "";
                }
            }
            if (agentModel.AgentOperationType.ToUpper() != "BUSINESS")
            {
                agentModel.AgentMobileNumber = agentModel.UserMobileNumber;
                agentModel.AgentEmail        = agentModel.UserEmail;
                RemoveBusinessValidation(agentModel);
            }
            if (ModelState.IsValid)
            {
                AgentManagementCommon AC = new AgentManagementCommon();
                AC = agentModel.MapObject <AgentManagementCommon>();
                if (!string.IsNullOrEmpty(AC.AgentID))
                {
                    if (string.IsNullOrEmpty(AC.AgentID))
                    {
                        return(View(agentModel));
                    }
                    //if (string.IsNullOrEmpty(changepassword))
                    //{
                    //    AC.Password = "";
                    //    AC.ConfirmPassword = "";
                    //}
                    AC.AgentID = AC.AgentID;//.DecryptParameter();
                    AC.UserID  = AC.UserID.DecryptParameter();
                }
                if (!string.IsNullOrEmpty(AC.ParentID))
                {
                    if (string.IsNullOrEmpty(AC.ParentID.DecryptParameter()))
                    {
                        return(View(agentModel));
                    }
                    AC.ParentID = AC.ParentID.DecryptParameter();
                }

                AC.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
                AC.IpAddress  = ApplicationUtilities.GetIP();

                if (Agent_Logo != null)
                {
                    var    contentType       = Agent_Logo.ContentType;
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Agent_Logo.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Agent_Logo.FileName);
                    if (Agent_Logo.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(agentModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + ext.ToLower();
                        Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                        AC.AgentLogo   = "/Content/userupload/Agent/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(agentModel));
                    }
                }
                if (AC.AgentOperationType.ToUpper() == "BUSINESS")
                {
                    if (Pan_Certiticate != null)
                    {
                        var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                        var    fileName          = Path.GetFileName(Pan_Certiticate.FileName);
                        String timeStamp         = DateTime.Now.ToString();
                        var    ext = Path.GetExtension(Pan_Certiticate.FileName);
                        if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB
                        {
                            this.ShowPopup(1, "Image Size must be less than 1MB");
                            return(View(agentModel));
                        }
                        if (allowedExtensions.Contains(ext.ToLower()))
                        {
                            string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                            string myfilename = "pan " + datet + ext.ToLower();
                            Pan_CertiticatePath    = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                            AC.AgentPanCertificate = "/Content/userupload/Agent/" + myfilename;
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(agentModel));
                        }
                    }

                    if (Registration_Certificate != null)
                    {
                        var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                        var    fileName          = Path.GetFileName(Registration_Certificate.FileName);
                        String timeStamp         = DateTime.Now.ToString();
                        var    ext = Path.GetExtension(Registration_Certificate.FileName);
                        if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB
                        {
                            this.ShowPopup(1, "Image Size must be less than 1MB");
                            return(View(agentModel));
                        }
                        if (allowedExtensions.Contains(ext.ToLower()))
                        {
                            string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                            string myfilename = "reg" + datet + ext.ToLower();
                            Registration_CertificatePath    = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                            AC.AgentRegistrationCertificate = "/Content/userupload/Agent/" + myfilename;
                            //Registration_Certificate.SaveAs(path);
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(agentModel));
                        }
                    }
                }
                CommonDbResponse dbresp = buss.ManageAgent(AC);
                if (dbresp.Code == 0)
                {
                    if (AC.AgentOperationType.ToUpper() == "BUSINESS")
                    {
                        if (Pan_Certiticate != null)
                        {
                            Pan_Certiticate.SaveAs(Pan_CertiticatePath);
                        }
                        if (Registration_Certificate != null)
                        {
                            Registration_Certificate.SaveAs(Registration_CertificatePath);
                        }
                    }
                    if (Agent_Logo != null)
                    {
                        Agent_Logo.SaveAs(Agent_LogoPath);
                    }
                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("Index", new { parent_id = agentModel.ParentID }));
                }
                agentModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + agentModel.Msg);
            return(View(agentModel));
        }
Exemplo n.º 28
0
        public ActionResult Kyc(KYCModel clientkyc, HttpPostedFileBase PPImageFile, HttpPostedFileBase Id_DocumentFrontFile, HttpPostedFileBase Id_DocumentBackFile)
        {
            LoadDropDownList(clientkyc);
            string status = "u";

            ModelState.Remove(("Remarks"));
            #region FileLocation

            string FileLocation;
            string usertype = Session["UserType"].ToString();
            if (usertype.ToLower() == "distributor")
            {
                FileLocation = "/Content/userupload/Distributor/kyc/";
            }
            else if (usertype.ToLower() == "sub-distributor")
            {
                FileLocation = "/Content/userupload/SubDistributor/kyc/";
            }
            else if (usertype.ToLower() == "walletuser")
            {
                FileLocation = "/Content/userupload/Walletuser/kyc/";
            }
            else if (usertype.ToLower() == "merchant")
            {
                FileLocation = "/Content/userupload/Merchant/kyc/";
            }
            else if (usertype.ToLower() == "agent")
            {
                FileLocation = "/Content/userupload/Agent/kyc/";
            }
            else if (usertype.ToLower() == "sub-agent")
            {
                FileLocation = "/Content/userupload/SubAgent/kyc/";
            }
            else
            {
                FileLocation = "/Content/userupload/";
            }

            ViewBag.FileLocation = FileLocation;
            #endregion

            if ((Id_DocumentFrontFile == null && string.IsNullOrEmpty(clientkyc.Id_DocumentFront)) ||
                (PPImageFile == null && string.IsNullOrEmpty(clientkyc.PPImage)) ||
                (Id_DocumentBackFile == null && string.IsNullOrEmpty(clientkyc.Id_DocumentBack) && clientkyc.Id_type.ToUpper() == "CITIZENSHIP"))
            {
                if (Id_DocumentFrontFile == null && string.IsNullOrEmpty(clientkyc.Id_DocumentFront))
                {
                    ModelState.AddModelError("Id_DocumentFront", "Document Front Image is Required");
                }
                if (PPImageFile == null && string.IsNullOrEmpty(clientkyc.PPImage))
                {
                    ModelState.AddModelError("PPImage", "Profile Image is Required");
                }
                if ((Id_DocumentBackFile == null && string.IsNullOrEmpty(clientkyc.Id_DocumentBack) && clientkyc.Id_type.ToUpper() == "CITIZENSHIP"))
                {
                    ModelState.AddModelError("Id_DocumentBack", "Document Front Image is Required");
                }
                return(View(clientkyc));
            }

            if (clientkyc.Id_type.ToUpper() == "CITIZENSHIP")
            {
                //if (Id_DocumentBackFile == null && string.IsNullOrEmpty(clientkyc.Id_DocumentBack))
                //{
                //    ModelState.AddModelError("Id_DocumentBack", "Document Front Image is Required");
                //    return View(clientkyc);
                //}
                ModelState.Remove(("Id_ExpiryDateAD"));
                ModelState.Remove(("Id_ExpiryDateBS"));
            }

            var PPImagePath          = "";
            var Id_DocumentFrontPath = "";
            var Id_DocumentBackPath  = "";

            string temp_address = clientkyc.SameAsPermanentAddress.ToString();
            if (temp_address == "True")
            {
                clientkyc.TProvince  = clientkyc.PProvince;
                clientkyc.TDistrict  = clientkyc.PDistrict;
                clientkyc.TLocalBody = clientkyc.PLocalBody;
                clientkyc.TWardNo    = clientkyc.PWardNo;
                clientkyc.TAddress   = clientkyc.PAddress;
            }

            if (ModelState.IsValid)
            {
                //clientkyc.Remarks = String.IsNullOrEmpty(clientkyc.Remarks) ? "" :
                //  clientkyc.Remarks.ToUpper().Equals("OTHERS") ? OthersRemarks : clientkyc.Remarks;

                clientkyc.ActionUser = Session["UserName"].ToString();

                #region "PPImage"
                if (PPImageFile != null && status.ToUpper() == "U")
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(PPImageFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(PPImageFile.FileName);
                    if (PPImageFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', '-').Replace(':', '-');
                        string myfilename = clientkyc.MobileNo + "-PPImage-" + datet + ext;
                        PPImagePath       = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        clientkyc.PPImage = FileLocation + myfilename;
                        //PPImageFile.SaveAs(PPImagePath);
                    }
                    else
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                }
                #endregion
                #region "Id_DocumentFront"
                if (Id_DocumentFrontFile != null && status.ToUpper() == "U")
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Id_DocumentFrontFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Id_DocumentFrontFile.FileName);
                    if (Id_DocumentFrontFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', '-').Replace(':', '-');
                        string myfilename = clientkyc.MobileNo + "-Id_DocumentFront-" + datet + ext;
                        Id_DocumentFrontPath       = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        clientkyc.Id_DocumentFront = FileLocation + myfilename;
                        //Id_DocumentFrontFile.SaveAs(Id_DocumentFrontPath);
                    }
                    else
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                }
                #endregion
                #region "Id_DocumentBack"
                if (Id_DocumentBackFile != null && status.ToUpper() == "U")
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Id_DocumentBackFile.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Id_DocumentBackFile.FileName);
                    if (Id_DocumentBackFile.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = timeStamp.Replace('/', '-').Replace(':', '-');
                        string myfilename = clientkyc.MobileNo + "-Id_DocumentBack-" + datet + ext;
                        Id_DocumentBackPath       = Path.Combine(Server.MapPath(FileLocation), myfilename);
                        clientkyc.Id_DocumentBack = FileLocation + myfilename;
                        //Id_DocumentBackFile.SaveAs(Id_DocumentBackPath);
                    }
                    else
                    {
                        return(RedirectToAction("Kyc", ControllerName));
                    }
                }
                #endregion
                KYCCommon        kycCommon  = clientkyc.MapObject <KYCCommon>();
                CommonDbResponse dbResponse = _kyc.UpadateKycDetails(kycCommon, status);
                if (dbResponse.Code == 0)
                {
                    //SaveImages On Success
                    if (PPImagePath != "")
                    {
                        PPImageFile.SaveAs(PPImagePath);
                    }
                    if (Id_DocumentFrontPath != "")
                    {
                        Id_DocumentFrontFile.SaveAs(Id_DocumentFrontPath);
                    }
                    if (Id_DocumentBackPath != "")
                    {
                        Id_DocumentBackFile.SaveAs(Id_DocumentBackPath);
                    }
                    //Ends SaveImages
                }
                dbResponse.SetMessageInTempData(this);
                return(RedirectToAction("Profile"));
            }
            return(View(clientkyc));
        }
Exemplo n.º 29
0
        public ActionResult ManageMerchant(MerchantModel merchantModel, HttpPostedFileBase Merchant_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword)
        {
            var Merchant_LogoPath            = "";
            var Pan_CertiticatePath          = "";
            var Registration_CertificatePath = "";

            LoadDropDownList(merchantModel);
            if (!string.IsNullOrEmpty(merchantModel.MerchantID.DecryptParameter()))
            {
                ModelState.Remove("UserName");
                ModelState.Remove("Password");
                ModelState.Remove("ConfirmPassword");
                ModelState.Remove("FullName");
                ModelState.Remove("UserMobileNumber");
                ModelState.Remove("UserEmail");
                ModelState.Remove("FirstName");
                ModelState.Remove("LastName");

                if (string.IsNullOrEmpty(changepassword))
                {
                    ModelState.Remove("UserName");
                    ModelState.Remove("Password");
                    ModelState.Remove("ConfirmPassword");
                }
            }
            if (ModelState.IsValid)
            {
                MerchantCommon merchantCommon = new MerchantCommon();
                merchantCommon = merchantModel.MapObject <MerchantCommon>();
                if (!string.IsNullOrEmpty(merchantCommon.MerchantID))
                {
                    if (string.IsNullOrEmpty(merchantCommon.MerchantID.DecryptParameter()))
                    {
                        return(View(merchantModel));
                    }
                    if (string.IsNullOrEmpty(changepassword))
                    {
                        merchantCommon.Password             = "";
                        merchantCommon.ConfirmPassword      = "";
                        merchantCommon.MerchantEmail        = "";
                        merchantCommon.MerchantMobileNumber = "";
                    }
                    merchantCommon.MerchantID = merchantCommon.MerchantID.DecryptParameter();
                    merchantCommon.UserID     = merchantCommon.UserID.DecryptParameter();
                }
                if (!string.IsNullOrEmpty(merchantCommon.ParentID))
                {
                    if (string.IsNullOrEmpty(merchantCommon.ParentID.DecryptParameter()))
                    {
                        return(View(merchantModel));
                    }
                    merchantCommon.ParentID = merchantCommon.ParentID.DecryptParameter();
                }
                merchantCommon.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
                merchantCommon.IpAddress  = ApplicationUtilities.GetIP();

                if (Merchant_Logo != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Merchant_Logo.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Merchant_Logo.FileName);
                    if (Merchant_Logo.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + "." + Merchant_Logo.FileName;
                        Merchant_LogoPath           = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantLogo = "/Content/userupload/merchant/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                if (Pan_Certiticate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Pan_Certiticate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Pan_Certiticate.FileName);
                    if (Pan_Certiticate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "pan " + datet + "." + Pan_Certiticate.FileName;
                        Pan_CertiticatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantPanCertificate = "/Content/userupload/merchant/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                if (Registration_Certificate != null)
                {
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Registration_Certificate.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Registration_Certificate.FileName);
                    if (Registration_Certificate.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(merchantModel));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "reg " + datet + "." + Registration_Certificate.FileName;
                        Registration_CertificatePath = Path.Combine(Server.MapPath("~/Content/userupload/merchant"), myfilename);
                        merchantCommon.MerchantRegistrationCertificate = "/Content/userupload/merchant/" + myfilename;

                        //Registration_Certificate.SaveAs(path);
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(merchantModel));
                    }
                }

                CommonDbResponse dbresp = _merchant.ManageMerchant(merchantCommon);
                if (dbresp.Code == 0)
                {
                    if (Pan_Certiticate != null)
                    {
                        Pan_Certiticate.SaveAs(Pan_CertiticatePath);
                    }
                    if (Registration_Certificate != null)
                    {
                        Registration_Certificate.SaveAs(Registration_CertificatePath);
                    }

                    if (Merchant_Logo != null)
                    {
                        Merchant_Logo.SaveAs(Merchant_LogoPath);
                    }

                    string userId    = dbresp.Extra1;
                    string agentId   = dbresp.Extra2;
                    string AgentCode = dbresp.Extra3;

                    QRCoder.QRCodeGenerator qrGenerator = new QRCodeGenerator();
                    var        encData     = AgentCode.EncryptParameterForQr();
                    QRCodeData qrCodeData  = qrGenerator.CreateQrCode(encData, QRCodeGenerator.ECCLevel.Q);
                    QRCode     qrCode      = new QRCode(qrCodeData);
                    Bitmap     qrCodeImage = qrCode.GetGraphic(20);
                    string     ImageUrl    = "";
                    using (MemoryStream stream = new MemoryStream())
                    {
                        qrCodeImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] byteImage = stream.ToArray();
                        ImageUrl = string.Format(Convert.ToBase64String(byteImage));
                    }
                    string qrFilePath  = Server.MapPath("~/Content/userupload/Merchant/");
                    string qrImageName = "qrImage" + "_" + userId + "_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "_").Replace(" ", "_").Replace(":", "_") + ".png";
                    qrCodeImage.Save(qrFilePath + qrImageName, ImageFormat.Png);
                    CommonDbResponse qrInsert = _merchant.AddCardQr(userId, agentId, ImageUrl, "/Content/userupload/Merchant/" + qrImageName);


                    this.ShowPopup(0, dbresp.Message);
                    return(RedirectToAction("Index"));
                }
                merchantModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + merchantModel.Msg);
            return(View(merchantModel));
        }
        public ActionResult ManageTransaction(TransactionLimitModel TLC)
        {
            if (TLC.transacation_type == "Cash In" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 20000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 20000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Cash In" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 25000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 25000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 25000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 25000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 100000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 100000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Card Fund Load" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 30000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 30000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Card Fund Load" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 16000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 16000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 50000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 50000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 300000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 300000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Transfer" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 10000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 10000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Transfer" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 25000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 25000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 100000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 100000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 500000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 500000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Withdraw" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 20000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 20000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Withdraw" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 25000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 25000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 100000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 100000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 500000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 500000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Card Fund Load(SCT)" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 30000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 30000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Card Fund Load(SCT)" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 500000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 500000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 100000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 100000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 500000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 500000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Wallet Payment" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 20000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 20000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Wallet Payment" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 1000000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 1000000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 1000000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 1000000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 5000000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 5000000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (TLC.transacation_type == "Load" && TLC.kyc_status == "not verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 5000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 5000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 5000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 30000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 30000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }
            if (TLC.transacation_type == "Load" && TLC.kyc_status == "verified")
            {
                int flag = 0;
                if (/*Convert.ToDouble( TLC.transaction_limit_maximum) <= 0 && */ Convert.ToDouble(TLC.transaction_limit_maximum) > 100000)
                {
                    ModelState.AddModelError("transaction_limit_maximum", "Transaction limit should be less than 100000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.daily_maximum_limit) > 1000000)
                {
                    ModelState.AddModelError("daily_maximum_limit", "Daily Transaction limit should be less than 1000000");
                    flag = 1;
                }
                if (Convert.ToDouble(TLC.monthly_maximum_limit) > 1000000)
                {
                    ModelState.AddModelError("monthly_maximum_limit", "Monthly Transaction limit should be less than 1000000");
                    flag = 1;
                }
                if (flag == 1)
                {
                    return(View(TLC));
                }
            }

            if (ModelState.IsValid)
            {
                TransactionLimitCommon tl = new TransactionLimitCommon();
                tl.transacation_id           = TLC.transacation_id.DecryptParameter();
                tl.transaction_limit_maximum = TLC.transaction_limit_maximum;
                tl.daily_maximum_limit       = TLC.daily_maximum_limit;
                tl.monthly_maximum_limit     = TLC.monthly_maximum_limit;

                tl.ActionUser = Session["username"].ToString();
                CommonDbResponse dbresp = tbuss.ManageTransactionlimit(tl);

                if (dbresp.Code == 0)
                {
                    this.ShowPopup((int)dbresp.Code, dbresp.Message);
                    return(RedirectToAction("Index"));
                }
            }
            this.ShowPopup(1, "Error");
            return(View());
        }