コード例 #1
0
 public ActionResult ManageAgentUsers(AgentCommon dcommon)
 {
     RemoveAgentValidation(dcommon);
     RemoveContactPersonValidation(dcommon);
     if (!string.IsNullOrEmpty(dcommon.UserId))
     {
         ModelState.Remove("Password");
         ModelState.Remove("ConfirmPassword");
     }
     if (ModelState.IsValid)
     {
         if (!string.IsNullOrEmpty(dcommon.UserId))
         {
             dcommon.UserId = dcommon.UserId.DecryptParameter();
         }
         if (!string.IsNullOrEmpty(dcommon.AgentID))
         {
             dcommon.AgentID = dcommon.AgentID.DecryptParameter();
         }
         LoadDropDownList(dcommon);
         CommonDbResponse dbresp = _Agent.ManageUser(dcommon);
         if (dbresp.Code == shared.Models.ResponseCode.Success)
         {
             this.ShowPopup(0, "Save Succesfully");
             return(RedirectToAction("ViewAgentUser", new { AgentId = dcommon.AgentID.EncryptParameter() }));
         }
     }
     this.ShowPopup(1, "Save unsuccessful.Please try again!");
     return(View(dcommon));
 }
コード例 #2
0
 public void RemoveUpdateValidation(AgentCommon SDM)
 {
     ModelState.Remove("AgentOperationType");
     ModelState.Remove("UserId");
     ModelState.Remove("UserName");
     ModelState.Remove("UserFullName");
     ModelState.Remove("UserEmail");
     ModelState.Remove("UserMobileNo");
     ModelState.Remove("UserType");
     ModelState.Remove("UserTypeId");
     ModelState.Remove("Password");
     ModelState.Remove("ConfirmPassword");
 }
コード例 #3
0
 public void RemoveContactPersonValidation(AgentCommon SDM)
 {
     ModelState.Remove("ContactPersonName");
     ModelState.Remove("ContactPersonAddress");
     ModelState.Remove("ContactPersonNumber");
     ModelState.Remove("ContactPersonIDtype");
     ModelState.Remove("ContactPersonIDNumber");
     ModelState.Remove("ContactPersonIDIssueDate");
     ModelState.Remove("ContactPersonIDIssueDate_BS");
     ModelState.Remove("ContactPersonIDExpiryDate");
     ModelState.Remove("ContactPersonIDExpiryDate_BS");
     ModelState.Remove("ContactPersonIDIssueDistrict");
 }
コード例 #4
0
        public CommonDbResponse ManageUser(AgentCommon discomm)
        {
            string sql = "sproc_user_detail ";

            sql += "@flag ='" + (string.IsNullOrEmpty(discomm.UserId) ? "i" : "u") + "' ";
            sql += ",@user_id =" + DAO.FilterString(discomm.UserId);
            sql += ",@agent_id =" + DAO.FilterString(discomm.AgentID);
            sql += ",@user_name = " + DAO.FilterString(discomm.UserName);
            sql += ",@full_name =" + DAO.FilterString(discomm.UserFullName);
            sql += ",@email  =" + DAO.FilterString(discomm.UserEmail);
            sql += ",@password  ="******",@mobile   =" + DAO.FilterString(discomm.UserMobileNo);
            sql += ",@usr_type =" + DAO.FilterString(discomm.UserType);
            sql += ",@is_primary =" + DAO.FilterString(discomm.isPrimary);
            sql += ",@status =" + DAO.FilterString(discomm.UserStatus);
            return(DAO.ParseCommonDbResponse(sql));
        }
コード例 #5
0
        public void LoadDropDownList(AgentCommon Agentmodel)
        {
            //Manage Agent
            ViewBag.PermanentCountryList         = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), Agentmodel.PermanentCountry, "--Permanent Country--");
            ViewBag.PermanentProvienceList       = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", Agentmodel.PermanentCountry), Agentmodel.PermanentProvince, "--Permanent Provience--");
            ViewBag.PermanentDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", Agentmodel.PermanentProvince) as Dictionary <string, string>, Agentmodel.PermanentDistrict, "--Permanent District--");
            ViewBag.PermanentVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", Agentmodel.PermanentDistrict), Agentmodel.PermanentVDC_Muncipality, "--Permanent VDC Muncipality--");

            ViewBag.TemporarytCountryList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("country"), Agentmodel.TemporaryCountry, "--Temporary Country--");
            ViewBag.TemporaryProvienceList       = ApplicationUtilities.SetDDLValue(LoadDropdownList("province", Agentmodel.TemporaryCountry), Agentmodel.TemporaryProvince, "--Temporary Provience--");
            ViewBag.TemporaryDistrictList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("districtList", Agentmodel.TemporaryProvince), Agentmodel.TemporaryDistrict, "--Temporary District--");
            ViewBag.TemporaryVDC_MuncipilityList = ApplicationUtilities.SetDDLValue(LoadDropdownList("vdc_muncipality", Agentmodel.TemporaryDistrict), Agentmodel.TemporaryVDC_Muncipality, "--Temporary VDC Muncipality--");

            ViewBag.GenderList        = ApplicationUtilities.SetDDLValue(LoadDropdownList("gender"), Agentmodel.Gender, "--Select Gender--");
            ViewBag.OccupationList    = ApplicationUtilities.SetDDLValue(LoadDropdownList("occupation"), Agentmodel.Occupation, "--Select Occupation--");
            ViewBag.Nationalitylist   = ApplicationUtilities.SetDDLValue(LoadDropdownList("nationality"), Agentmodel.Nationality, "--Select Nationality--");
            ViewBag.DoctypeList       = ApplicationUtilities.SetDDLValue(LoadDropdownList("doctype"), Agentmodel.Nationality, "--Select Document Type--");
            ViewBag.IssueDistrictList = ApplicationUtilities.SetDDLValue(LoadDropdownList("issuedistrict"), Agentmodel.Nationality, "--Select District--");
        }
コード例 #6
0
 public void RemoveAgentValidation(AgentCommon SDM)
 {
     ModelState.Remove("AgentType");
     ModelState.Remove("AgentID");
     ModelState.Remove("AgentOperationType");
     ModelState.Remove("isautocommission");
     ModelState.Remove("AgentName");
     ModelState.Remove("AgentMobileNumber");
     ModelState.Remove("AgentEmail");
     ModelState.Remove("AgentWebUrl");
     ModelState.Remove("AgentRegistrationNumber");
     ModelState.Remove("AgentPanNo");
     ModelState.Remove("AgentContractDate");
     ModelState.Remove("AgentAddress");
     ModelState.Remove("AgentLatitude");
     ModelState.Remove("AgentLongitude");
     ModelState.Remove("AgentCreditLimit");
     ModelState.Remove("AgentBalance");
     ModelState.Remove("AgentLogo");
     ModelState.Remove("AgentRegistrationCertificate");
     ModelState.Remove("AgentPanCertificate");
     ModelState.Remove("FirstName");
     ModelState.Remove("MiddleName");
     ModelState.Remove("LastName");
     ModelState.Remove("DOB_AD");
     ModelState.Remove("DOB_BS");
     ModelState.Remove("Gender");
     ModelState.Remove("Occupation");
     ModelState.Remove("Nationality");
     ModelState.Remove("PermanentCountry");
     ModelState.Remove("PermanentProvince");
     ModelState.Remove("PermanentDistrict");
     ModelState.Remove("PermanentVDC_Muncipality");
     ModelState.Remove("PermanentWardNo");
     ModelState.Remove("PermanentStreet");
     ModelState.Remove("TemporaryCountry");
     ModelState.Remove("TemporaryProvince");
     ModelState.Remove("TemporaryDistrict");
     ModelState.Remove("TemporaryVDC_Muncipality");
     ModelState.Remove("TemporaryWardNo");
     ModelState.Remove("TemporaryStreet");
 }
コード例 #7
0
        public CommonDbResponse ManageAgent(AgentCommon discomm, string username)
        {
            //string sql = "sproc_agent_detail ";
            //sql += "@flag ='" + (string.IsNullOrEmpty(discomm.AgentId) ? "i" : "u")  "'  ,@action_user = "******"Exec sproc_agent_detail";

            sql += " @flag='" + (string.IsNullOrEmpty(discomm.AgentID) ? "i" : "u") + "'";
            sql += " ,@agent_type='Agent'";
            sql += " ,@is_auto_commission=" + discomm.isautocommission;// DAO.FilterString(discomm.isautocommission.ToString());
            sql += " ,@agent_id=" + DAO.FilterString(discomm.AgentID);
            sql += " ,@agent_name=" + DAO.FilterString(discomm.AgentName);
            sql += " ,@agent_address=" + DAO.FilterString(discomm.AgentAddress);
            sql += " ,@mobile_number= " + DAO.FilterString(discomm.AgentMobileNumber);

            sql += " ,@web_url= " + DAO.FilterString(discomm.AgentWebUrl);
            sql += " ,@registration_no= " + DAO.FilterString(discomm.AgentRegistrationNumber);
            sql += " ,@pan_no= " + DAO.FilterString(discomm.AgentPanNo);
            sql += " ,@contract_date= " + DAO.FilterString(discomm.AgentContractDate.ToString());
            sql += " ,@phone_no= " + DAO.FilterString(discomm.AgentMobileNumber);


            sql += " ,@latitude=" + DAO.FilterString(discomm.AgentID);
            sql += " ,@longitude=" + DAO.FilterString(discomm.AgentID);
            sql += " ,@credit_limit=" + DAO.FilterString(discomm.AgentCreditLimit.ToString());
            sql += " ,@balance=" + DAO.FilterString(discomm.AgentBalance.ToString());

            //image
            sql += ", @logo_img=" + DAO.FilterString(discomm.AgentLogo);
            sql += ", @agent_doc_image_front=" + DAO.FilterString(discomm.AgentPanCertificate);
            sql += ", @agent_doc_image_back=" + DAO.FilterString(discomm.AgentRegistrationCertificate);

            //user info

            sql += " ,@first_name=" + DAO.FilterString(discomm.FirstName);
            sql += " ,@middle_name=" + DAO.FilterString(discomm.MiddleName);
            sql += " ,@last_name=" + DAO.FilterString(discomm.LastName);
            sql += " ,@user_full_name=" + DAO.FilterString(discomm.FirstName + (string.IsNullOrEmpty(discomm.MiddleName) ? "" : (" " + discomm.MiddleName)) + " " + discomm.LastName);
            sql += " ,@dob_eng=" + DAO.FilterString(discomm.DOB_AD);
            sql += " ,@dob_nepali=" + DAO.FilterString(discomm.DOB_BS);
            sql += " ,@gender=" + DAO.FilterString(discomm.Gender);
            sql += " ,@occupation=" + DAO.FilterString(discomm.Occupation);
            sql += " ,@nationality=" + DAO.FilterString(discomm.Nationality);
            //permanent Address
            sql += " ,@country=" + DAO.FilterString(discomm.PermanentCountry);
            sql += " ,@province=" + DAO.FilterString(discomm.PermanentProvince);
            sql += " ,@district=" + DAO.FilterString(discomm.PermanentDistrict);
            sql += " ,@local_body=" + DAO.FilterString(discomm.PermanentVDC_Muncipality);
            sql += " ,@ward_no=" + DAO.FilterString(discomm.PermanentWardNo);
            sql += " ,@address=" + DAO.FilterString(discomm.PermanentStreet);


            //Temporary Address
            // sql += " ,@country=" + DAO.FilterString(discomm.TemporaryCountry);
            sql += " ,@temp_province=" + DAO.FilterString(discomm.TemporaryProvince);
            sql += " ,@temp_district=" + DAO.FilterString(discomm.TemporaryDistrict);
            sql += " ,@temp_local_body=" + DAO.FilterString(discomm.TemporaryVDC_Muncipality);
            sql += " ,@temp_ward_no=" + DAO.FilterString(discomm.TemporaryWardNo);
            sql += " ,@temp_address=" + DAO.FilterString(discomm.TemporaryStreet);

            //contact person
            sql += " ,@contact_name=" + DAO.FilterString(discomm.ContactPersonName);
            sql += " ,@mobile_no=" + DAO.FilterString(string.IsNullOrEmpty(discomm.ContactPersonNumber) ? discomm.AgentMobileNumber : discomm.ContactPersonNumber);
            if (!string.IsNullOrEmpty(discomm.AgentID))
            {
                sql += " ,@Contact_id_type=" + DAO.FilterString(discomm.ContactPersonIDtype);
                sql += " ,@Contact_id_issue_date=" + DAO.FilterString(discomm.ContactPersonIDIssueDate);
                sql += " ,@Contact_id_issue_date_bs=" + DAO.FilterString(discomm.ContactPersonIDIssueDate_BS);
                sql += " ,@Contact_id_address=" + DAO.FilterString(discomm.ContactPersonAddress);
                sql += " ,@Contact_id_no=" + DAO.FilterString(discomm.ContactPersonIDNumber);
                //sql += " agent_id="+DAO.FilterString(discomm.ContactPersonIDExpiryDate);
                sql += " ,@Contact_id_issue_district=" + DAO.FilterString(discomm.ContactPersonIDIssueDistrict);
            }

            sql += " ,@action_ip=" + DAO.FilterString(discomm.IpAddress);
            sql += ", @action_user="******" ,@agent_operation_type=" + DAO.FilterString(discomm.AgentOperationType);

                //     sql += " ,@usr_type='Manager'";
                sql += " ,@email_address= " + DAO.FilterString(discomm.AgentEmail);
                sql += " ,@user_name=" + DAO.FilterString(discomm.UserName);
                sql += " ,@password=" + DAO.FilterString(discomm.Password);
            }
            return(DAO.ParseCommonDbResponse(sql));
        }
コード例 #8
0
 public CommonDbResponse ManageUser(AgentCommon discomm)
 {
     return(_repo.ManageUser(discomm));
 }
コード例 #9
0
 public CommonDbResponse ManageAgent(AgentCommon discomm, string username)
 {
     return(_repo.ManageAgent(discomm, username));
 }
コード例 #10
0
        public ActionResult Manage(AgentCommon DModel, HttpPostedFileBase Agent_Logo, HttpPostedFileBase Pan_Certiticate, HttpPostedFileBase Registration_Certificate)
        {
            var    Agent_LogoPath               = "";
            var    Pan_CertiticatePath          = "";
            var    Registration_CertificatePath = "";
            string op_type = DModel.AgentOperationType;
            //string temp_address = DModel..ToString();
            var ParentId = DModel.ParentId.DecryptParameter();

            if (DModel.AgentID != null)
            {
                var AgentId = DModel.AgentID.DecryptParameter();
            }
            if (!string.IsNullOrEmpty(DModel.ParentId))
            {
                if (string.IsNullOrEmpty(ParentId))
                {
                    return(RedirectToAction("Index", "Distributor"));
                }
            }
            if (string.IsNullOrEmpty(DModel.AgentID) == false)
            {
                if (string.IsNullOrEmpty(DModel.AgentID))
                {
                    return(RedirectToAction("Index", new { ParentId = ParentId.EncryptParameter() }));
                }
            }
            if (!string.IsNullOrEmpty(DModel.AgentID))
            {
                RemoveUpdateValidation(DModel);
            }
            if (string.IsNullOrEmpty(DModel.AgentID))
            {
                RemoveUpdateValidation(DModel);
            }
            if (DModel.AgentOperationType == "Individual")
            {
                RemoveContactPersonValidation(DModel);
            }
            DModel.ParentId = ParentId;
            DModel.AgentID  = DModel.AgentID ?? "";
            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();
                }
                if (DModel.AgentID == null)
                {
                    DModel.AgentID = "''";
                }
                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/Agent_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/Agent_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/Agent_image"), myfilename);
                        DModel.AgentLogo = myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(DModel));
                    }
                }
                //DModel.AgentId = DModel.AgentId.DecryptParameter();
                CommonDbResponse dbresp = _Agent.ManageAgent(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", new { ParentId = ParentId.EncryptParameter() }));
                }
            }
            this.ShowPopup(1, "Please fill out all the field stating * (Mandatory)");
            return(View(DModel));
        }