Beispiel #1
0
        public ActionResult ViewAgentDetail(string User_Name, string agentId = "", string ParentId = "")
        {
            AgentManagementModel AM = new AgentManagementModel();

            if (!string.IsNullOrEmpty(ParentId) && string.IsNullOrEmpty(ParentId.DecryptParameter()))
            {
                return(RedirectToAction("Index", new { parent_id = ParentId }));
            }
            else
            {
                AM.ParentID = ParentId;
            }
            if (!string.IsNullOrEmpty(agentId))
            {
                AM.AgentID = agentId.DecryptParameter();
                if (!string.IsNullOrEmpty(AM.AgentID))
                {
                    AgentManagementCommon AC = buss.GetAgentById(AM.AgentID, User_Name.DecryptParameter());
                    AM          = AC.MapObject <AgentManagementModel>();
                    AM.AgentID  = AM.AgentID.EncryptParameter();
                    AM.UserID   = AM.UserID.EncryptParameter();
                    AM.ParentID = AM.ParentID.EncryptParameter();
                    var pprovince = LoadDropdownList("province") as Dictionary <string, string>;
                    AM.AgentProvince = pprovince.ContainsKey(AM.AgentProvince)
                        ? pprovince.FirstOrDefault(x => x.Key == AM.AgentProvince).Value : AM.AgentProvince;
                    return(View(AM));
                }
            }
            this.ShowPopup(1, "Error");
            return(RedirectToAction("Index"));
        }
        public CommonDbResponse ManageAgentUser(AgentManagementCommon amc)
        {
            string sql = "sproc_agent_Detail_v3 ";

            sql += "@flag ='" + (string.IsNullOrEmpty(amc.UserID) ? "id" : "ud") + "' ";
            sql += ",@user_id =" + dao.FilterString(amc.UserID);
            sql += ",@agent_id =" + dao.FilterString(amc.AgentID);
            sql += ",@full_name =" + dao.FilterString(amc.FullName);
            sql += ",@password  ="******",@action_user ="******",@action_ip =" + dao.FilterString(amc.IpAddress);
            sql += " ,@role_id='8'";
            if (string.IsNullOrEmpty(amc.UserID))
            {
                sql += ",@is_primary ='N'";
                sql += ",@user_status ='Y'";
                sql += ",@usr_type ='Agent'"; //+ dao.FilterString(amc.UserType);
                sql += ",@usr_type_id ='8'";  // + dao.FilterString(amc.UserType);

                sql += ",@user_mobile_number   =" + dao.FilterString(amc.UserMobileNumber);
                sql += ",@user_name = " + dao.FilterString(amc.UserName);
                sql += ",@user_email  =" + dao.FilterString(amc.UserEmail);
            }
            return(dao.ParseCommonDbResponse(sql));
        }
Beispiel #3
0
        public JsonResult ExtendCreditLimit(string agentid)
        {
            AgentManagementCommon amc  = new AgentManagementCommon();
            AgentCreditLimitModel aclm = new AgentCreditLimitModel();

            if (!string.IsNullOrEmpty(agentid))
            {
                string agent_id = agentid.DecryptParameter();
                if (!string.IsNullOrEmpty(agent_id))
                {
                    string username = ApplicationUtilities.GetSessionValue("UserName").ToString();
                    amc            = buss.GetAgentById(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);
        }
        public List <AgentManagementCommon> GetUserList(AgentManagementCommon amc)
        {
            var    Dis = new List <AgentManagementCommon>();
            string sql = "sproc_agent_Detail_v3 @flag ='aguser' ";

            sql += ",@agent_id=" + dao.FilterString(amc.AgentID);
            sql += ",@user_id=" + dao.FilterString(amc.UserID);
            sql += ",@action_user="******"agent_id"].ToString();
                    Distri.UserID           = dr["user_id"].ToString();
                    Distri.FirstName        = dr["first_name"].ToString();
                    Distri.MiddleName       = dr["middle_name"].ToString();
                    Distri.LastName         = dr["last_name"].ToString();
                    Distri.FullName         = dr["full_name"].ToString();
                    Distri.UserEmail        = dr["user_email"].ToString();
                    Distri.UserMobileNumber = dr["user_mobile_no"].ToString();
                    Distri.UserName         = dr["user_name"].ToString();
                    //Distri.UserPassword = dr["password"].ToString();
                    Distri.UserType   = dr["usr_type"].ToString();
                    Distri.IsPrimary  = dr["is_primary"].ToString();
                    Distri.UserStatus = dr["status"].ToString();
                    Dis.Add(Distri);
                }
            }
            return(Dis);
        }
        public List <AgentManagementCommon> GetAgentList(string AgentId, string username, string parentid = "")
        {
            string sql = "Exec sproc_agent_Detail_v3";

            sql += " @flag='s'";
            sql += " ,@agent_type='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(),
                        AgentBalance       = item["available_balance"].ToString()
                    };
                    lst.Add(AC);
                }
            }
            return(lst);
        }
Beispiel #6
0
 public ActionResult ManageAgentUser(AgentUserModel dcommon)
 {
     if (!string.IsNullOrEmpty(dcommon.UserID))
     {
         ModelState.Remove("Password");
         ModelState.Remove("ConfirmPassword");
         ModelState.Remove("UserEmail");
         ModelState.Remove("UserMobileNumber");
         ModelState.Remove("UserName");
     }
     if (ModelState.IsValid)
     {
         if (!string.IsNullOrEmpty(dcommon.UserID))
         {
             dcommon.UserID = dcommon.UserID.DecryptParameter();
         }
         if (!string.IsNullOrEmpty(dcommon.AgentID))
         {
             dcommon.AgentID = dcommon.AgentID.DecryptParameter();
         }
         AgentManagementCommon amcommon = new AgentManagementCommon();
         amcommon            = dcommon.MapObject <AgentManagementCommon>();
         amcommon.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
         amcommon.IpAddress  = ApplicationUtilities.GetIP();
         CommonDbResponse dbresp = buss.ManageAgentUser(amcommon);
         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));
 }
Beispiel #7
0
        public ActionResult ManageAgent(string User_Name, string agentId = "", string ParentId = "")
        {
            AgentManagementModel AM = new AgentManagementModel();

            if (!string.IsNullOrEmpty(ParentId) && string.IsNullOrEmpty(ParentId.DecryptParameter()))
            {
                return(RedirectToAction("Index", new { parent_id = ParentId }));
            }
            else
            {
                AM.ParentID = ParentId;
            }
            if (!string.IsNullOrEmpty(agentId))
            {
                AM.AgentID = agentId.DecryptParameter();
                if (!string.IsNullOrEmpty(AM.AgentID))
                {
                    AgentManagementCommon AC = buss.GetAgentById(AM.AgentID, User_Name.DecryptParameter());
                    AM          = AC.MapObject <AgentManagementModel>();
                    AM.AgentID  = AM.AgentID.EncryptParameter();
                    AM.UserID   = AM.UserID.EncryptParameter();
                    AM.ParentID = AM.ParentID.EncryptParameter();
                    RemoveupdateValidation(AM);
                }
            }
            if (string.IsNullOrEmpty(agentId))
            {
                AM.AgentCountry = "Nepal";
            }
            LoadDropDownList(AM);
            return(View(AM));
        }
Beispiel #8
0
        public ActionResult AssignRole(string AgentId, string UserId = "")
        {
            AgentManagementCommon amc = new AgentManagementCommon();
            var agent_id = AgentId.DecryptParameter();
            var user_id  = UserId.DecryptParameter();

            if (string.IsNullOrEmpty(agent_id))
            {
                return(RedirectToAction("Index"));
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                if (string.IsNullOrEmpty(user_id))
                {
                    return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
                }
            }

            amc.ActionUser = Session["UserName"].ToString();
            amc.UserID     = user_id;
            amc.AgentID    = agent_id;

            var arole = buss.getAgentUserRO(amc);

            if (arole != null)
            {
                AgentUserRole aur = new AgentUserRole();
                aur.AgentID   = arole.AgentID.EncryptParameter();
                aur.UserID    = arole.UserID.EncryptParameter();
                aur.RoleId    = arole.RoleId;
                aur.IsPrimary = arole.IsPrimary;
                return(View(aur));
            }
            return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
        }
        public CommonDbResponse ResetPassword(AgentManagementCommon Common)
        {
            string sql = "sproc_agent_Detail_v3 @flag = 'rpass'";

            sql += ", @agent_id=" + dao.FilterString(Common.AgentID);
            sql += ", @user_id=" + dao.FilterString(Common.UserID);
            sql += ", @action_user="******", @created_ip=" + DAO.FilterString(Common.ActionIP);
            return(dao.ParseCommonDbResponse(sql));
        }
        public CommonDbResponse Disable_EnableAgent(AgentManagementCommon 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));
        }
        public CommonDbResponse AssignAgentUserRole(AgentManagementCommon amc)
        {
            string sql = "Exec sproc_agent_detail";

            sql += " @flag='drole'";
            sql += " ,@user_id=" + dao.FilterString(amc.UserID);
            sql += " ,@agent_id=" + dao.FilterString(amc.AgentID);
            sql += " ,@is_primary=" + dao.FilterString(amc.IsPrimary);
            sql += " ,@role_id='8'";// + dao.FilterString(RoleId);
            return(dao.ParseCommonDbResponse(sql));
        }
Beispiel #12
0
        public ActionResult ViewAgentUser(string AgentId = "", string ParentId = "")
        {
            string parentID = ParentId.DecryptParameter();
            string agentId  = AgentId.DecryptParameter();

            if (!string.IsNullOrEmpty(ParentId))
            {
                if (string.IsNullOrEmpty(parentID))
                {
                    return(RedirectToAction("Index", new { parent_id = parentID.EncryptParameter() }));
                }
            }
            if (!string.IsNullOrEmpty(AgentId))
            {
                if (string.IsNullOrEmpty(agentId))
                {
                    return(RedirectToAction("Index", new { parent_id = parentID.EncryptParameter(), AgentId = agentId.EncryptParameter() }));
                }
            }

            AgentManagementCommon amc = new AgentManagementCommon();

            amc.AgentID    = agentId;
            amc.ActionUser = Session["UserName"].ToString();
            var AgentCommon = buss.GetUserList(amc);

            //Actions
            foreach (var item in AgentCommon)
            {
                item.Action     = StaticData.GetActions("ViewAgentUser", item.UserID.EncryptParameter(), this, "", "", item.AgentID.EncryptParameter(), item.UserStatus, parentID.EncryptParameter(), item.IsPrimary.Trim());
                item.UserStatus = "<span class='badge badge-" + (item.UserStatus.Trim().ToUpper() == "Y" ? "success" : "danger") + "'>" + (item.UserStatus.Trim().ToUpper() == "Y" ? "Active" : "Blocked") + "</span>";
                item.IsPrimary  = "<span class='badge badge-" + (item.IsPrimary.Trim().ToUpper() == "Y" ? "success" : "danger") + "'>" + (item.IsPrimary.Trim().ToUpper() == "Y" ? "Primary" : "Secondary") + "</span>";
            }
            //Column Creator
            IDictionary <string, string> param = new Dictionary <string, string>();

            //param.Add("AgentId", "Agent Id");
            param.Add("FullName", "Full Name");
            param.Add("UserName", "User Name");
            param.Add("UserEmail", "Email");
            param.Add("UserMobileNumber", "Mobile Number");
            //param.Add("UserType", "User Type");
            param.Add("IsPrimary", "Is primary");
            param.Add("UserStatus", "Status");
            param.Add("Action", "Action");
            ProjectGrid.column = param;
            //Ends
            //Add New
            var grid = ProjectGrid.MakeGrid(AgentCommon, "Agent Users", "", 0, true, "", "", "Home", "Agent", "/Admin/AgentManagement/ManageAgentUser", "/Admin/AgentManagement/ManageAgentUser?AgentId=" + agentId.EncryptParameter());

            ViewData["grid"] = grid;
            return(View());
        }
Beispiel #13
0
        public JsonResult ResetPassword(string userid, string agentid)
        {
            var  data  = new CommonDbResponse();
            bool valid = true;

            if (!string.IsNullOrEmpty(userid))
            {
                userid = userid.DecryptParameter();
                if (string.IsNullOrEmpty(userid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }

            if (!string.IsNullOrEmpty(agentid))
            {
                agentid = agentid.DecryptParameter();
                if (string.IsNullOrEmpty(agentid))
                {
                    data = new CommonDbResponse {
                        ErrorCode = 1, Message = "Invalid User."
                    };
                    valid = false;
                }
            }
            if (valid)
            {
                AgentManagementCommon DMC = new AgentManagementCommon()
                {
                    UserID     = userid,
                    AgentID    = agentid,
                    UserStatus = "Y",
                    ActionUser = ApplicationUtilities.GetSessionValue("username").ToString(),
                    IpAddress  = ApplicationUtilities.GetIP()
                };
                data = buss.ResetPassword(DMC);
                //if (data.ErrorCode == 0)
                //{
                //    data.Message = "User Password Reset Successfully";
                //}
            }

            data.SetMessageInTempData(this);
            return(Json(data));
        }
Beispiel #14
0
        public ActionResult ManageAgentUser(string AgentId, string UserId = "")
        {
            AgentUserModel Agentmodel = new AgentUserModel();
            var            Agent_id   = AgentId.DecryptParameter();
            var            user_id    = UserId.DecryptParameter();

            if (string.IsNullOrEmpty(Agent_id))
            {
                return(RedirectToAction("Index"));
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                if (string.IsNullOrEmpty(user_id))
                {
                    return(RedirectToAction("ViewAgentUser", new { AgentId = AgentId }));
                }
                AgentManagementCommon amc = new AgentManagementCommon();
                amc.AgentID    = Agent_id;
                amc.ActionUser = Session["UserName"].ToString();
                amc.UserID     = user_id;

                var agentUserList = buss.GetUserList(amc);//.FirstOrDefault();
                if (agentUserList.Count > 0)
                {
                    var agentm = agentUserList.FirstOrDefault();
                    Agentmodel.UserID           = agentm.UserID.EncryptParameter();
                    Agentmodel.FullName         = agentm.FullName;
                    Agentmodel.UserEmail        = agentm.UserEmail;
                    Agentmodel.UserMobileNumber = agentm.UserMobileNumber;
                    Agentmodel.UserStatus       = agentm.UserStatus;
                    Agentmodel.UserName         = agentm.UserName;
                }
                else
                {
                    ApplicationUtilities.ShowPopup(this, 1, "User Not Found!");
                    return(RedirectToAction("ViewAgentUser", new { AgentId = AgentId }));
                }
            }

            Agentmodel.AgentID = AgentId;

            return(View(Agentmodel));
        }
        public AgentManagementCommon getAgentUserRO(AgentManagementCommon amc)
        {
            string sql = "Exec sproc_agent_detail_v3";

            sql += " @flag='grole'";
            sql += " ,@user_id=" + dao.FilterString(amc.UserID);
            sql += " ,@agent_id=" + dao.FilterString(amc.AgentID);
            sql += " ,@action_user="******"user_id"].ToString();
                RC.AgentID   = dt["Agent_id"].ToString();
                RC.RoleId    = dt["role_id"].ToString();
                RC.IsPrimary = dt["is_primary"].ToString();
            }
            return(RC);
        }
Beispiel #16
0
        public ActionResult AssignRole(AgentUserRole dcommon)
        {
            var agent_id = dcommon.AgentID.DecryptParameter();
            var user_id  = dcommon.UserID.DecryptParameter();

            if (string.IsNullOrEmpty(agent_id))
            {
                return(RedirectToAction("Index"));
            }
            if (!string.IsNullOrEmpty(dcommon.UserID))
            {
                if (string.IsNullOrEmpty(user_id))
                {
                    return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
                }
            }
            if (ModelState.IsValid)
            {
                var isPrimary = "n";
                if (dcommon.IsPrimary == "on")
                {
                    isPrimary = "y";
                }
                AgentManagementCommon amc = new AgentManagementCommon();
                amc.UserName  = Session["UserName"].ToString();
                amc.UserID    = user_id;
                amc.AgentID   = agent_id;
                amc.IsPrimary = isPrimary;
                amc.RoleId    = dcommon.RoleId;
                CommonDbResponse dbresp = buss.AssignAgentUserRole(amc);
                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, "Role Assigned Successfully.");
                    return(RedirectToAction("ViewAgentUser", new { AgentId = agent_id.EncryptParameter() }));
                }
            }
            this.ShowPopup(1, "Failed to assign role to user!");
            return(View(dcommon));
        }
Beispiel #17
0
 public JsonResult DisableAgent(string AgentId)
 {
     if (!string.IsNullOrEmpty(AgentId))
     {
         if (!string.IsNullOrEmpty(AgentId.DecryptParameter()))
         {
             AgentManagementCommon amc = new AgentManagementCommon();
             amc.AgentID    = AgentId.DecryptParameter();
             amc.IpAddress  = ApplicationUtilities.GetIP();
             amc.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
             amc.UserStatus = "N";
             CommonDbResponse dbresp = buss.Disable_EnableAgent(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 #18
0
 public CommonDbResponse ManageAgent(AgentManagementCommon AC)
 {
     return(repo.ManageAgent(AC));
 }
Beispiel #19
0
 public CommonDbResponse ManageAgentUser(AgentManagementCommon amc)
 {
     return(repo.ManageAgentUser(amc));
 }
Beispiel #20
0
 public CommonDbResponse Disable_EnableAgentUser(AgentManagementCommon amc)
 {
     return(repo.Disable_EnableAgentUser(amc));
 }
Beispiel #21
0
 public CommonDbResponse ResetPassword(AgentManagementCommon Common)
 {
     return(repo.ResetPassword(Common));
 }
Beispiel #22
0
 public CommonDbResponse AssignAgentUserRole(AgentManagementCommon amc)
 {
     return(repo.AssignAgentUserRole(amc));
 }
Beispiel #23
0
 public AgentManagementCommon getAgentUserRO(AgentManagementCommon amc)
 {
     return(repo.getAgentUserRO(amc));
 }
        public AgentManagementCommon GetAgentById(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["permanent_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 #25
0
 public List <AgentManagementCommon> GetUserList(AgentManagementCommon amc)
 {
     return(repo.GetUserList(amc));
 }
Beispiel #26
0
        public ActionResult ManageAgent(AgentManagementModel agentModel, 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(agentModel);
            if (!string.IsNullOrEmpty(agentModel.AgentID))
            {
                agentModel.AgentID = agentModel.AgentID.DecryptParameter();
                ModelState.Remove("userName");
                if (changepassword.ToUpper() != "ON")
                {
                    RemoveupdateValidation(agentModel);
                    agentModel.Password        = "";
                    agentModel.ConfirmPassword = "";
                }
            }
            if (agentModel.AgentOperationType.ToUpper() != "BUSINESS")
            {
                agentModel.AgentMobileNumber = agentModel.UserMobileNumber;
                agentModel.AgentEmail        = agentModel.UserEmail;
                RemoveBusinessValidation(agentModel);
            }
            if (ModelState.IsValid)
            {
                AgentManagementCommon AC = new AgentManagementCommon();
                AC = agentModel.MapObject <AgentManagementCommon>();
                if (!string.IsNullOrEmpty(AC.AgentID))
                {
                    if (string.IsNullOrEmpty(AC.AgentID))
                    {
                        return(View(agentModel));
                    }
                    //if (string.IsNullOrEmpty(changepassword))
                    //{
                    //    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(agentModel));
                    }
                    AC.ParentID = AC.ParentID.DecryptParameter();
                }

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

                if (Agent_Logo != null)
                {
                    var    contentType       = Agent_Logo.ContentType;
                    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 + ext.ToLower();
                        Agent_LogoPath = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                        AC.AgentLogo   = "/Content/userupload/Agent/" + 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 = "pan " + datet + ext.ToLower();
                            Pan_CertiticatePath    = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                            AC.AgentPanCertificate = "/Content/userupload/Agent/" + 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 = "reg" + datet + ext.ToLower();
                            Registration_CertificatePath    = Path.Combine(Server.MapPath("~/Content/userupload/Agent"), myfilename);
                            AC.AgentRegistrationCertificate = "/Content/userupload/Agent/" + 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)
                {
                    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 { parent_id = agentModel.ParentID }));
                }
                agentModel.Msg = dbresp.Message;
            }
            this.ShowPopup(1, "Error " + agentModel.Msg);
            return(View(agentModel));
        }
        public CommonDbResponse ManageAgent(AgentManagementCommon AC)
        {
            string sql = "sproc_agent_Detail_v3 ";

            sql += "@flag='" + (string.IsNullOrEmpty(AC.AgentID) ? "i" : "u") + "'";
            sql += " ,@agent_type='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 += " ,@agent_name=" + dao.FilterString(AC.AgentName);

            //user info
            sql += " ,@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);

            //contact Person
            sql += " ,@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 += " ,@role_id='8'";
            sql += " ,@usr_type='Agent'";
            sql += " ,@usr_type_id='8'";
            //sql += " ,@agent_mobile_no=" + dao.FilterString(AC.AgentMobileNumber);
            //sql += " ,@agent_email=" + dao.FilterString(AC.AgentEmail);
            if (!string.IsNullOrEmpty(AC.Password))
            {
                sql += " ,@password="******" ,@confirm_password="******"BUSINESS")
            {
                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);
                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.AgentID))
            {
                //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);
                sql += " ,@parent_id=" + dao.FilterString(AC.ParentID);
            }

            return(dao.ParseCommonDbResponse(sql));
        }