Ejemplo n.º 1
0
 public void LoadDropDownList(AgentNewModel agentmodel)
 {
     //Manage Distributor
     ViewBag.AgentCountryList         = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), agentmodel.AgentCountry, "--select Country--");
     ViewBag.AgentProvienceList       = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", agentmodel.AgentCountry), agentmodel.AgentProvince, "--select Provience--");
     ViewBag.AgentDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", agentmodel.AgentProvince) as Dictionary <string, string>, agentmodel.AgentDistrict, "--select District--");
     ViewBag.AgentVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", agentmodel.AgentDistrict), agentmodel.AgentVDC_Muncipality, "--select VDC Muncipality--");
     ViewBag.IssueDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("issuedistrict"), agentmodel.ContactPersonIdIssueDistrict, "--Select District--");
     ViewBag.DoctypeList = ApplicationUtilities.SetDDLValue(LoadDropdownList("doctype"), agentmodel.ContactPersonIdType, "--Select Document Type--");
 }
Ejemplo n.º 2
0
        public ActionResult ManageAgent(string UserName, string agentId = "")
        {
            AgentNewModel AM = new AgentNewModel();

            if (!string.IsNullOrEmpty(agentId))
            {
                AM.AgentID = agentId.DecryptParameter();
                if (!string.IsNullOrEmpty(AM.AgentID))
                {
                    AgentNewCommon AC = buss.GetAgentById(AM.AgentID, UserName.DecryptParameter());
                    AM         = AC.MapObject <AgentNewModel>();
                    AM.AgentID = AM.AgentID.EncryptParameter();
                }
            }
            LoadDropDownList(AM);
            return(View(AM));
        }
Ejemplo n.º 3
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));
        }