Beispiel #1
0
        public List <SubAgentManagementCommon> GetSubAgentList(string ParentId, string username, string AgentId = "")
        {
            string sql = "Exec sproc_agent_Detail_v3";

            sql += " @flag='s'";
            sql += " ,@agent_type='sub-Agent'";
            sql += " ,@parent_Id=" + dao.FilterParameter(ParentId);
            sql += " ,@agent_id=" + dao.FilterParameter(AgentId);
            sql += " ,@action_user="******"parent_id"].ToString(),
                        AgentID            = item["agent_id"].ToString(),
                        AgentName          = item["agent_name"].ToString(),
                        AgentOperationType = item["agent_operation_type"].ToString(),



                        AgentStatus       = item["agent_status"].ToString(),
                        AgentCreditLimit  = item["agent_credit_limit"].ToString(),
                        AgentMobileNumber = item["agent_mobile_no"].ToString()
                    };

                    lst.Add(SAC);
                }
            }
            return(lst);
        }
Beispiel #2
0
        public JsonResult ExtendCreditLimit(string agentid)
        {
            SubAgentManagementCommon amc  = new SubAgentManagementCommon();
            SubAgentCreditLimitModel aclm = new SubAgentCreditLimitModel();

            if (!string.IsNullOrEmpty(agentid))
            {
                string agent_id = agentid.DecryptParameter();
                if (!string.IsNullOrEmpty(agent_id))
                {
                    string username = ApplicationUtilities.GetSessionValue("UserName").ToString();
                    amc            = buss.GetSubAgentById(agent_id, username);
                    aclm.AgentId   = amc.AgentID.EncryptParameter();
                    aclm.AgentName = amc.AgentName;
                    aclm.AgentCurrentCreditLimit = amc.AgentCreditLimit;

                    string value = string.Empty;
                    value = JsonConvert.SerializeObject(aclm, Formatting.Indented, new JsonSerializerSettings
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    return(Json(value, JsonRequestBehavior.AllowGet));
                }
            }
            this.ShowPopup(1, "Error");
            return(null);
        }
Beispiel #3
0
        public CommonDbResponse Disable_EnableSubAgent(SubAgentManagementCommon amc)
        {
            string sql = "sproc_agent_Detail_v3 ";

            sql += " @flag='eau'";
            sql += ",@agent_id=" + dao.FilterString(amc.AgentID);
            sql += ",@action_user="******",@user_status=" + dao.FilterString(amc.UserStatus);

            return(dao.ParseCommonDbResponse(sql));
        }
Beispiel #4
0
        public ActionResult ManageSubAgent(string UserName, string parentid = "", string agentId = "")
        {
            SubAgentClientModel SAM = new SubAgentClientModel();

            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 <SubAgentClientModel>();
                    SAM.AgentID  = SAM.AgentID.EncryptParameter();
                    SAM.UserID   = SAM.UserID.EncryptParameter();
                    SAM.ParentID = SAM.ParentID.EncryptParameter();
                }
            }


            LoadDropDownList(SAM);
            return(View(SAM));
        }
Beispiel #5
0
 public JsonResult DisableSubAgent(string AgentId)
 {
     if (!string.IsNullOrEmpty(AgentId))
     {
         if (!string.IsNullOrEmpty(AgentId.DecryptParameter()))
         {
             SubAgentManagementCommon amc = new SubAgentManagementCommon();
             amc.AgentID    = AgentId.DecryptParameter();
             amc.IpAddress  = ApplicationUtilities.GetIP();
             amc.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
             amc.UserStatus = "N";
             CommonDbResponse dbresp = buss.Disable_EnableSubAgent(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."
     }));
 }
Beispiel #6
0
        public SubAgentManagementCommon GetSubAgentById(string AgentId, string username)
        {
            string sql = "Exec sproc_agent_Detail_v3";

            sql += " @flag='ds'";
            sql += ", @agent_id=" + dao.FilterString(AgentId);
            sql += ", @action_user="******"agent_type"].ToString();
                AC.AgentID            = dt["agent_id"].ToString();
                AC.ParentID           = dt["parent_id"].ToString();
                AC.AgentOperationType = dt["agent_operation_type"].ToString();
                //string test = dt["is_auto_commission"].ToString();
                AC.AgentCommissionType = dt["is_auto_commission"].ToString().ToUpper() == "TRUE" ? true : false;//dt[""].ToString();
                AC.AgentName           = dt["agent_name"].ToString();
                AC.AgentPhoneNumber    = dt["agent_phone_no"].ToString();
                AC.AgentMobileNumber   = dt["agent_mobile_no"].ToString();
                AC.AgentEmail          = dt["agent_email_address"].ToString();
                // AC.AgentWebUrl = dt["agent_web_url"].ToString();
                AC.AgentWebUrl             = dt["web_url"].ToString();
                AC.AgentRegistrationNumber = dt["agent_registration_no"].ToString();
                AC.AgentPanNumber          = dt["agent_pan_no"].ToString();
                AC.AgentContractDate       = dt["agent_contract_local_date"].ToString();
                AC.AgentContractDate_BS    = dt["agent_contract_nepali_date"].ToString();
                AC.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();

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

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

                AC.ContactPersonName         = dt["contact_person_name"].ToString();
                AC.ContactPersonMobileNumber = dt["contact_person_mobile_no"].ToString();
                AC.ContactPersonIdType       = dt["contact_person_id_type"].ToString();
                AC.ContactPersonIdNumber     = dt["contact_person_id_no"].ToString();
                //AC.ContactPersonIdIssueCountry = dt[""].ToString();
                AC.ContactPersonIdIssueDistrict = dt["contact_id_issued_district"].ToString();
                AC.ContactPersonIdIssueDate     = dt["contact_id_issue_local_date"].ToString();
                AC.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(AC);
        }
Beispiel #7
0
        public CommonDbResponse ManageSubAgent(SubAgentManagementCommon AC)
        {
            string sql = "sproc_agent_Detail_v3 ";

            sql += "@flag='" + (string.IsNullOrEmpty(AC.AgentID) ? "i" : "u") + "'";
            sql += " ,@agent_type='Sub-Agent'";
            sql += " ,@agent_id=" + dao.FilterString(AC.AgentID);

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

            //sql += " ,@agent_mobile_no=" + dao.FilterString(AC.AgentMobileNumber);
            //sql += " ,@agent_email=" + dao.FilterString(AC.AgentEmail);
            sql += " ,@agent_web_url=" + dao.FilterString(AC.AgentWebUrl);
            sql += " ,@agent_registration_no=" + dao.FilterString(AC.AgentRegistrationNumber);
            sql += " ,@agent_Pan_no=" + dao.FilterString(AC.AgentPanNumber);
            sql += " ,@agent_contract_date=" + dao.FilterString(AC.AgentContractDate);
            sql += " ,@agent_reg_certificate=" + dao.FilterString(AC.AgentRegistrationCertificate);
            sql += " ,@agent_pan_Certificate=" + dao.FilterString(AC.AgentPanCertificate);
            //if (AC.AgentOperationType.ToUpper() == "BUSINESS")
            //{
            //    sql += " ,@agent_mobile_no=" + dao.FilterString(AC.AgentMobileNumber);
            //    sql += " ,@agent_email=" + dao.FilterString(AC.AgentEmail);
            //    sql += " ,@agent_web_url=" + dao.FilterString(AC.AgentWebUrl);
            //    sql += " ,@agent_registration_no=" + dao.FilterString(AC.AgentRegistrationNumber);
            //    sql += " ,@agent_Pan_no=" + dao.FilterString(AC.AgentPanNumber);
            //    sql += " ,@agent_contract_date=" + dao.FilterString(AC.AgentContractDate);
            //    sql += " ,@agent_reg_certificate=" + dao.FilterString(AC.AgentRegistrationCertificate);
            //    sql += " ,@agent_pan_Certificate=" + dao.FilterString(AC.AgentPanCertificate);
            //}
            if (AC.AgentOperationType.ToUpper() == "BUSINESS")
            {
                sql += " ,@agent_mobile_no=" + dao.FilterString(AC.AgentMobileNumber);
                sql += " ,@agent_email=" + dao.FilterString(AC.AgentEmail);
            }
            else
            {
                sql += " ,@agent_mobile_no=" + dao.FilterString(AC.UserMobileNumber);
                sql += " ,@agent_email=" + dao.FilterString(AC.UserEmail);
            }

            if (!string.IsNullOrEmpty(AC.Password))
            {
                sql += " ,@password="******" ,@confirm_password="******" ,@parent_id=" + dao.FilterString(AC.ParentID);
                //user Information
                sql += " ,@agent_name=" + dao.FilterString(AC.AgentName);
                sql += " ,@agent_credit_limit=" + dao.FilterString(AC.AgentCreditLimit);
                sql += " ,@user_name=" + dao.FilterString(AC.UserName);
                sql += " ,@user_mobile_number=" + dao.FilterString(AC.UserMobileNumber);
                sql += " ,@user_email=" + dao.FilterString(AC.UserEmail);
            }

            return(dao.ParseCommonDbResponse(sql));
        }
Beispiel #8
0
        public ActionResult ManageSubAgent(SubAgentClientModel 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");
            ModelState.Remove("AgentBalance");
            ModelState.Remove("UserMobileNumber");
            ModelState.Remove("UserEmail");
            subagentModel.UserMobileNumber = subagentModel.AgentMobileNumber;
            subagentModel.UserEmail        = subagentModel.AgentEmail;
            //ModelState.Remove("AgentCreditLimit");
            LoadDropDownList(subagentModel);

            if (!string.IsNullOrEmpty(subagentModel.AgentID.DecryptParameter()))
            {
                ModelState.Remove("userName");
                if (string.IsNullOrEmpty(changepassword))
                {
                    ModelState.Remove("Password");
                    ModelState.Remove("confirmPassword");
                }
            }
            else
            {
                subagentModel.AgentBalance = "0";
            }

            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();
                }

                AC.ParentID = Session["AgentId"].ToString();

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

                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));
        }
 public CommonDbResponse Disable_EnableSubAgent(SubAgentManagementCommon amc)
 {
     return(repo.Disable_EnableSubAgent(amc));
 }
 public CommonDbResponse ManageSubAgent(SubAgentManagementCommon AC)
 {
     return(repo.ManageSubAgent(AC));
 }