示例#1
0
        public CommonDbResponse ManageSubDistributor(SubDistributorManagementCommon DC)
        {
            string sql = "sproc_agent_Detail_v3 ";

            sql += "@flag='" + (string.IsNullOrEmpty(DC.AgentID) ? "i" : "u") + "'";
            sql += " ,@agent_type='Sub-Distributor'";
            sql += " ,@agent_id=" + dao.FilterString(DC.AgentID);
            sql += " ,@agent_operation_type=" + dao.FilterString(DC.AgentOperationType);
            sql += " ,@agent_commission_type=" + DC.AgentCommissionType;
            //sql += " ,@agent_mobile_no=" + dao.FilterString(DC.AgentMobileNumber);
            //sql += " ,@agent_contract_date_bs=" + dao.FilterString(AC.AgentContractDate_BS);
            sql += " ,@agent_country=" + dao.FilterString(DC.AgentCountry);
            sql += " ,@agent_province=" + dao.FilterString(DC.AgentProvince);
            sql += " ,@agent_district=" + dao.FilterString(DC.AgentDistrict);
            sql += " ,@agent_local_body=" + dao.FilterString(DC.AgentVDC_Muncipality);
            sql += " ,@agent_ward_number=" + dao.FilterString(DC.AgentWardNo);
            sql += " ,@agent_street=" + dao.FilterString(DC.AgentStreet);
            sql += " ,@agent_available_balance=" + dao.FilterString(DC.AgentBalance);
            sql += " ,@agent_logo=" + dao.FilterString(DC.AgentLogo);
            sql += " ,@password="******" ,@user_id=" + dao.FilterString(DC.UserID);
            sql += " ,@first_name=" + dao.FilterString(DC.FirstName);
            sql += " ,@middle_name=" + dao.FilterString(DC.MiddleName);
            sql += " ,@last_name=" + dao.FilterString(DC.LastName);
            sql += " ,@confirm_password="******" ,@contact_person_name=" + dao.FilterString(DC.ContactPersonName);
            sql += " ,@contact_person_mobile_number=" + dao.FilterString(DC.ContactPersonMobileNumber);
            sql += " ,@contact_person_ID_type=" + dao.FilterString(DC.ContactPersonIdType);
            sql += " ,@contact_person_ID_no=" + dao.FilterString(DC.ContactPersonIdNumber);
            //sql += " ,@contact_person_id_issue_country=" + dao.FilterString(AC.ContactPersonIdIssueCountry);
            sql += " ,@contact_person_id_issue_district=" + dao.FilterString(DC.ContactPersonIdIssueDistrict);
            sql += " ,@contact_person_Id_issue_date=" + dao.FilterString(DC.ContactPersonIdIssueDate);
            sql += " ,@contact_person_id_issue_date_nepali=" + dao.FilterString(DC.ContactPersonIdIssueDate_BS);
            sql += " ,@contact_person_id_expiry_date=" + dao.FilterString(DC.ContactPersonIdExpiryDate);
            sql += " ,@contact_person_id_expiry_date_nepali=" + dao.FilterString(DC.ContactPersonIdExpiryDate_BS);
            sql += " ,@action_user="******" ,@action_ip=" + dao.FilterString(DC.IpAddress);
            sql += " ,@action_platform=''";// + dao.FilterString(AC.IpAddress);
            sql += " ,@usr_type='sub-distrubutor'";
            sql += " ,@role_id='10'";
            sql += " ,@usr_type_id='10'";


            if (DC.AgentOperationType.ToUpper() == "BUSINESS")
            {
                sql += " ,@agent_mobile_no=" + dao.FilterString(DC.AgentMobileNumber);
                sql += " ,@agent_email=" + dao.FilterString(DC.AgentEmail);
                sql += " ,@agent_web_url=" + dao.FilterString(DC.AgentWebUrl);
                sql += " ,@agent_registration_no=" + dao.FilterString(DC.AgentRegistrationNumber);
                sql += " ,@agent_Pan_no=" + dao.FilterString(DC.AgentPanNumber);
                sql += " ,@agent_contract_date=" + dao.FilterString(DC.AgentContractDate);
                sql += " ,@agent_reg_certificate=" + dao.FilterString(DC.AgentRegistrationCertificate);
                sql += " ,@agent_pan_Certificate=" + dao.FilterString(DC.AgentPanCertificate);
            }
            if (string.IsNullOrEmpty(DC.AgentID))
            {
                sql += " ,@parent_id=" + dao.FilterString(DC.ParentID);
                //user Information
                sql += " ,@agent_name=" + dao.FilterString(DC.AgentName);
                sql += " ,@agent_credit_limit=" + dao.FilterString(DC.AgentCreditLimit);
                sql += " ,@user_name=" + dao.FilterString(DC.UserName);


                sql += " ,@user_mobile_number=" + dao.FilterString(DC.UserMobileNumber);
                sql += " ,@user_email=" + dao.FilterString(DC.UserEmail);
            }

            return(dao.ParseCommonDbResponse(sql));
        }
        public ActionResult ManageSubDistributor(SubDistributorManagementModel DistModel, 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(DistModel);
            if (!string.IsNullOrEmpty(DistModel.AgentID.DecryptParameter()))
            {
                RemoveupdateValidation(DistModel);
            }
            if (DistModel.AgentOperationType.ToUpper() != "BUSINESS")
            {
                DistModel.AgentEmail        = DistModel.UserEmail;
                DistModel.AgentMobileNumber = DistModel.UserMobileNumber;
                RemoveBusinessValidation(DistModel);
            }
            if (ModelState.IsValid)
            {
                SubDistributorManagementCommon DMC = new SubDistributorManagementCommon();
                DMC = DistModel.MapObject <SubDistributorManagementCommon>();
                if (!string.IsNullOrEmpty(DMC.AgentID))
                {
                    if (string.IsNullOrEmpty(DMC.AgentID.DecryptParameter()))
                    {
                        return(View(DistModel));
                    }
                    if (string.IsNullOrEmpty(changepassword))
                    {
                        DMC.Password        = "";
                        DMC.ConfirmPassword = "";
                    }
                    DMC.AgentID = DMC.AgentID.DecryptParameter();
                    DMC.UserID  = DMC.UserID.DecryptParameter();
                }
                if (!string.IsNullOrEmpty(DMC.ParentID))
                {
                    if (string.IsNullOrEmpty(DMC.ParentID.DecryptParameter()))
                    {
                        return(View(DistModel));
                    }
                    DMC.ParentID = DMC.ParentID.DecryptParameter();
                }

                DMC.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
                DMC.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(DistModel));
                    }
                    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/subdistributor"), myfilename);
                        DMC.AgentLogo  = "/content/userupload/subdistributor/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(DistModel));
                    }
                }
                if (DMC.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(DistModel));
                        }
                        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/subdistributor"), myfilename);
                            DMC.AgentPanCertificate = "/content/userupload/subdistributor/" + myfilename;
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(DistModel));
                        }
                    }

                    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(DistModel));
                        }
                        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/subdistributor"), myfilename);
                            DMC.AgentRegistrationCertificate = "/content/userupload/subdistributor/" + myfilename;
                            //Registration_Certificate.SaveAs(path);
                        }
                        else
                        {
                            this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                            return(View(DistModel));
                        }
                    }
                }
                CommonDbResponse dbresp = buss.ManageSubDistributor(DMC);
                if (dbresp.Code == 0)
                {
                    if (DMC.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 { ParentId = DistModel.ParentID }));
                }
                DistModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + DistModel.Msg);
            return(View(DistModel));
        }
        public SubDistributorManagementCommon GetSubDistributorById(string AgentId, string username)
        {
            string sql = "Exec sproc_agent_Detail_v3";

            sql += " @flag='ds'";
            sql += " ,@agent_type='Distributor'";
            sql += ", @agent_id=" + dao.FilterString(AgentId);
            sql += ", @action_user="******"agent_type"].ToString();
                SMC.AgentID            = dt["agent_id"].ToString();
                SMC.ParentID           = dt["parent_id"].ToString();
                SMC.AgentOperationType = dt["agent_operation_type"].ToString();
                //string test = dt["is_auto_commission"].ToString();
                SMC.AgentCommissionType = dt["is_auto_commission"].ToString().ToUpper() == "TRUE" ? true : false;//dt[""].ToString();
                SMC.AgentName           = dt["agent_name"].ToString();
                SMC.AgentMobileNumber   = dt["agent_mobile_no"].ToString();
                //SMC.AgentMobileNumber = dt["agent_mobile_no"].ToString();
                SMC.AgentEmail = dt["agent_email_address"].ToString();
                // AC.AgentWebUrl = dt["agent_web_url"].ToString();
                SMC.AgentWebUrl             = dt["web_url"].ToString();
                SMC.AgentRegistrationNumber = dt["agent_registration_no"].ToString();
                SMC.AgentPanNumber          = dt["agent_pan_no"].ToString();
                SMC.AgentContractDate       = dt["agent_contract_local_date"].ToString();
                SMC.AgentContractDate_BS    = dt["agent_contract_nepali_date"].ToString();
                SMC.AgentCountry            = dt["agent_country"].ToString();
                //AC.AgentProvince = dt["agent_province"].ToString();
                //AC.AgentDistrict = dt["agent_district"].ToString();
                //AC.AgentVDC_Muncipality = dt["agent_localbody"].ToString();
                //AC.AgentWardNo = dt["agent_wardno"].ToString();
                //AC.AgentStreet = dt["agent_address"].ToString();

                SMC.AgentProvince        = dt["permanent_province"].ToString();
                SMC.AgentDistrict        = dt["permanent_district"].ToString();
                SMC.AgentVDC_Muncipality = dt["permanent_localbody"].ToString();
                SMC.AgentWardNo          = dt["permanent_wardno"].ToString();
                SMC.AgentStreet          = dt["permanent_address"].ToString();

                SMC.AgentCreditLimit = dt["agent_credit_limit"].ToString();
                SMC.AgentBalance     = dt["available_balance"].ToString();
                SMC.AgentLogo        = dt["agent_logo_img"].ToString();
                //AC.AgentRegistrationCertificate = dt["agent_registeration_cert_image"].ToString();
                //AC.AgentPanCertificate = dt["agent_pan_cert_image"].ToString();
                SMC.AgentRegistrationCertificate = dt["agent_document_img_back"].ToString();
                SMC.AgentPanCertificate          = dt["agent_document_img_front"].ToString();
                SMC.UserID   = dt["user_id"].ToString();
                SMC.UserName = dt["user_name"].ToString();
                //AC.Password = dt[""].ToString();
                //AC.ConfirmPassword = dt[""].ToString();
                SMC.FirstName        = dt["first_name"].ToString();
                SMC.MiddleName       = dt["middle_name"].ToString();
                SMC.LastName         = dt["last_name"].ToString();
                SMC.UserMobileNumber = dt["user_mobile_no"].ToString();
                SMC.UserEmail        = dt["user_email"].ToString();

                SMC.ContactPersonName         = dt["contact_person_name"].ToString();
                SMC.ContactPersonIdType       = dt["contact_person_id_type"].ToString();
                SMC.ContactPersonIdNumber     = dt["contact_person_id_no"].ToString();
                SMC.ContactPersonMobileNumber = dt["contact_person_mobile_no"].ToString();

                //AC.ContactPersonIdIssueCountry = dt[""].ToString();
                SMC.ContactPersonIdIssueDistrict = dt["contact_id_issued_district"].ToString();
                SMC.ContactPersonIdIssueDate     = dt["contact_id_issue_local_date"].ToString();
                SMC.ContactPersonIdIssueDate_BS  = dt["contact_id_issued_bs_date"].ToString();
                //AC.ContactPersonIdExpiryDate = dt["contact_id_expiry_local_date"].ToString();
                //AC.ContactPersonIdExpiryDate_BS = dt["contact_id_expiry_bs_date"].ToString();
            }
            return(SMC);
        }
示例#4
0
 public CommonDbResponse Disable_EnableSubDistributorUser(SubDistributorManagementCommon DMC)
 {
     return(repo.Disable_EnableSubDistributorUser(DMC));
 }
示例#5
0
 public CommonDbResponse ManageUser(SubDistributorManagementCommon discomm)
 {
     return(repo.ManageUser(discomm));
 }
示例#6
0
 public CommonDbResponse ManageSubDistributor(SubDistributorManagementCommon DC)
 {
     return(repo.ManageSubDistributor(DC));
 }