Beispiel #1
0
 public void LoadDropDownList(SubAgentManagementModel subagentmodel)
 {
     //Manage Distributor
     ViewBag.AgentCountryList         = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), subagentmodel.AgentCountry, "--select Country--");
     ViewBag.AgentProvinceList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", subagentmodel.AgentCountry), subagentmodel.AgentProvince, "--select Province--");
     ViewBag.AgentDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", subagentmodel.AgentProvince) as Dictionary <string, string>, subagentmodel.AgentDistrict, "--select District--");
     ViewBag.AgentVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", subagentmodel.AgentDistrict), subagentmodel.AgentVDC_Muncipality, "--select VDC Muncipality--");
     ViewBag.IssueDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("issuedistrict"), subagentmodel.ContactPersonIdIssueDistrict, "--Select District--");
     ViewBag.DoctypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("doctype"), subagentmodel.ContactPersonIdType, "--Select Document Type--");
 }
Beispiel #2
0
 public void RemoveBusinessValidation(SubAgentManagementModel AMM)
 {
     ModelState.Remove("AgentPhoneNumber");
     ModelState.Remove("AgentMobileNumber");
     ModelState.Remove("AgentEmail");
     ModelState.Remove("AgentWebUrl");
     ModelState.Remove("AgentRegistrationNumber");
     ModelState.Remove("AgentPanNumber");
     ModelState.Remove("AgentContractDate");
     ModelState.Remove("AgentContractDate_BS");
     ModelState.Remove("AgentRegistrationCertificate");
     ModelState.Remove("AgentPanCertificate");
     ModelState.Remove("ContactPersonName");
     ModelState.Remove("ContactPersonMobileNumber");
     ModelState.Remove("ContactPersonIdType");
     ModelState.Remove("ContactPersonIdNumber");
     ModelState.Remove("ContactPersonIdIssueCountry");
     ModelState.Remove("ContactPersonIdIssueDistrict");
     ModelState.Remove("ContactPersonIdIssueDate");
     ModelState.Remove("ContactPersonIdIssueDate_BS");
     ModelState.Remove("ContactPersonIdExpiryDate");
     ModelState.Remove("ContactPersonIdExpiryDate_BS");
     AMM.AgentPhoneNumber             = "";
     AMM.AgentMobileNumber            = "";
     AMM.AgentEmail                   = "";
     AMM.AgentWebUrl                  = "";
     AMM.AgentRegistrationNumber      = "";
     AMM.AgentPanNumber               = "";
     AMM.AgentContractDate            = "";
     AMM.AgentContractDate_BS         = "";
     AMM.ContactPersonName            = "";
     AMM.ContactPersonMobileNumber    = "";
     AMM.ContactPersonIdType          = "";
     AMM.ContactPersonIdNumber        = "";
     AMM.ContactPersonIdIssueCountry  = "";
     AMM.ContactPersonIdIssueDistrict = "";
     AMM.ContactPersonIdIssueDate     = "";
     AMM.ContactPersonIdIssueDate_BS  = "";
     AMM.ContactPersonIdExpiryDate    = "";
     AMM.ContactPersonIdExpiryDate_BS = "";
 }
Beispiel #3
0
        public ActionResult ManageSubAgent(string UserName, string parentid = "", string agentId = "")
        {
            SubAgentManagementModel SAM = new SubAgentManagementModel();

            SAM.ParentID = parentid;

            if (!string.IsNullOrEmpty(agentId))
            {
                SAM.AgentID = agentId.DecryptParameter();
                if (!string.IsNullOrEmpty(SAM.AgentID))
                {
                    SubAgentManagementCommon SAC = buss.GetSubAgentById(SAM.AgentID, UserName.DecryptParameter());
                    SAM          = SAC.MapObject <SubAgentManagementModel>();
                    SAM.AgentID  = SAM.AgentID.EncryptParameter();
                    SAM.UserID   = SAM.UserID.EncryptParameter();
                    SAM.ParentID = SAM.ParentID.EncryptParameter();
                }
            }


            LoadDropDownList(SAM);
            return(View(SAM));
        }
Beispiel #4
0
 public void RemoveupdateValidation(SubAgentManagementModel AMM)
 {
     ModelState.Remove("Password");
     ModelState.Remove("confirmPassword");
 }
Beispiel #5
0
        public ActionResult ManageSubAgent(SubAgentManagementModel subagentModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate, string changepassword = "")
        {
            var Agent_LogoPath               = "";
            var Pan_CertiticatePath          = "";
            var Registration_CertificatePath = "";

            ModelState.Remove("AgentContractDate_BS");
            ModelState.Remove("Action");
            LoadDropDownList(subagentModel);

            if (!string.IsNullOrEmpty(subagentModel.AgentID.DecryptParameter()))
            {
                ModelState.Remove("userName");
                if (changepassword.ToUpper() != "ON")
                {
                    RemoveupdateValidation(subagentModel);
                    subagentModel.Password        = "";
                    subagentModel.ConfirmPassword = "";
                }
            }
            if (subagentModel.AgentOperationType.ToUpper() != "BUSINESS")
            {
                subagentModel.AgentMobileNumber = subagentModel.UserMobileNumber;
                subagentModel.AgentEmail        = subagentModel.UserEmail;
                RemoveBusinessValidation(subagentModel);
            }
            if (ModelState.IsValid)
            {
                SubAgentManagementCommon AC = new SubAgentManagementCommon();
                AC = subagentModel.MapObject <SubAgentManagementCommon>();
                if (!string.IsNullOrEmpty(AC.AgentID))
                {
                    if (string.IsNullOrEmpty(AC.AgentID.DecryptParameter()))
                    {
                        return(View(subagentModel));
                    }
                    //if (changepassword.ToUpper() != "ON")
                    //{
                    //    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(subagentModel));
                    }
                    AC.ParentID = AC.ParentID.DecryptParameter();
                }


                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(subagentModel));
                    }
                    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/subagent"), myfilename);
                        AC.AgentLogo   = "/Content/userupload/subagent/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(subagentModel));
                    }
                }
                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(subagentModel));
                        }
                        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/subagent"), myfilename);
                            AC.AgentPanCertificate = "/Content/userupload/subagent/" + myfilename;
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(subagentModel));
                        }
                    }

                    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(subagentModel));
                        }
                        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/subagent"), myfilename);
                            AC.AgentRegistrationCertificate = "/Content/userupload/subagent/" + myfilename;
                            //Registration_Certificate.SaveAs(path);
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(subagentModel));
                        }
                    }
                }
                CommonDbResponse dbresp = buss.ManageSubAgent(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 { agentId = subagentModel.ParentID }));
                }
                subagentModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + subagentModel.Msg);
            return(View(subagentModel));
        }