Exemplo n.º 1
0
        /// <summary>
        /// 保存用户信息
        /// </summary>
        private void Save()
        {
            string _wrong = string.Empty;

            user = userbll.GetUserInfo(this.SiteUserInfo.ID);
            user.PersonInfo.ContactName = Utils.GetFormValue("name");
            user.PersonInfo.ContactSex  = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Utils.GetInt(Utils.GetFormValue("sex"), 0);
            user.PersonInfo.ContactFax  = Utils.GetFormValue("fax");
            //电话号码
            if (Utils.IsPhone(Utils.GetFormValue("phone").Trim()) || Utils.GetFormValue("phone").Trim() == "")
            {
                user.PersonInfo.ContactTel = Utils.GetFormValue("phone");
            }
            else
            {
                _wrong = "请输入正确的电话号码!";
            }
            //手机
            if (Utils.IsMobile(Utils.GetFormValue("mobile").Trim()) || Utils.GetFormValue("mobile").Trim() == "")
            {
                user.PersonInfo.ContactMobile = Utils.GetFormValue("mobile");
            }
            else
            {
                _wrong += "请输入正确的手机号码!";
            }
            user.PersonInfo.QQ           = Utils.GetFormValue("QQ").Trim();
            user.PersonInfo.MSN          = Utils.GetFormValue("msn").Trim();
            user.PersonInfo.ContactEmail = Utils.GetFormValue("email").Trim();

            if (string.IsNullOrEmpty(_wrong))
            {
                bool res = userbll.Update(user);



                if (user.PassWordInfo.NoEncryptPassword != Utils.GetFormValue("psd"))
                {
                    userbll.UpdatePassWord(user.ID, new EyouSoft.Model.CompanyStructure.PassWord(Utils.GetFormValue("psd")));
                }


                if (res)
                {
                    MessageBox.ResponseScript(this, "; alert('保存成功');location.href='/UserCenter/UserInfo/UserInfo.aspx';");
                }
                else
                {
                    MessageBox.ShowAndReturnBack(this, "操作失败", 1);
                }
            }
            else
            {
                MessageBox.ShowAndReturnBack(this, _wrong, 1);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EyouSoft.BLL.CompanyStructure.CompanyUser   CompanyUser      = null;
            EyouSoft.Model.CompanyStructure.CompanyUser ModelCompanyUser = new EyouSoft.Model.CompanyStructure.CompanyUser();

            string hidMethod = Utils.GetFormValue("hidMethod");

            if (hidMethod == "save")
            {
                ModelCompanyUser.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord();
                ModelCompanyUser.PassWordInfo.NoEncryptPassword = this.Txt_PassWord.Text;
                ModelCompanyUser.UserName                 = Utils.GetFormValue(this.txtUserName.UniqueID);
                ModelCompanyUser.PersonInfo               = new EyouSoft.Model.CompanyStructure.ContactPersonInfo();
                ModelCompanyUser.PersonInfo.ContactName   = this.Txt_Name.Value;
                ModelCompanyUser.PersonInfo.ContactSex    = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Enum.Parse(typeof(EyouSoft.Model.EnumType.CompanyStructure.Sex), this.ddlSex.SelectedValue);
                ModelCompanyUser.PersonInfo.JobName       = this.Txt_Position.Value;
                ModelCompanyUser.PersonInfo.ContactTel    = this.Txt_Phone.Value;
                ModelCompanyUser.PersonInfo.ContactFax    = this.Txt_Fox.Value;
                ModelCompanyUser.PersonInfo.ContactMobile = this.Txt_Moblie.Value;
                ModelCompanyUser.PersonInfo.QQ            = this.Txt_QQNumber.Value;
                ModelCompanyUser.PersonInfo.ContactEmail  = this.Txt_Email.Value;
                ModelCompanyUser.PersonInfo.Remark        = this.Txt_Remiks.Value;

                bool result = true;
                ModelCompanyUser.ID            = SiteUserInfo.ID;
                ModelCompanyUser.TourCompanyId = SiteUserInfo.TourCompany.TourCompanyId;
                CompanyUser = new EyouSoft.BLL.CompanyStructure.CompanyUser();
                result      = CompanyUser.UpdateZuTuan(ModelCompanyUser);
                MessageBox.ShowAndRedirect(this, result ? "用户信息修改成功!" : "用户信息修改失败!", "/GroupEnd/SystemSetting/AccountManager.aspx");
                return;
            }
            CompanyUser      = new EyouSoft.BLL.CompanyStructure.CompanyUser();
            ModelCompanyUser = CompanyUser.GetUserInfo(SiteUserInfo.ID);
            if (ModelCompanyUser != null)
            {
                this.Txt_UserName.Text = ModelCompanyUser.UserName;
                this.txtUserName.Value = ModelCompanyUser.UserName;
                this.Txt_Name.Value    = ModelCompanyUser.PersonInfo.ContactName;
                this.Txt_PassWord.Text = ModelCompanyUser.PassWordInfo.NoEncryptPassword;
                if (this.ddlSex.Items.FindByValue(((int)ModelCompanyUser.PersonInfo.ContactSex).ToString()) != null)
                {
                    this.ddlSex.Items.FindByValue(((int)ModelCompanyUser.PersonInfo.ContactSex).ToString()).Selected = true;
                }
                this.Txt_Position.Value = ModelCompanyUser.PersonInfo.JobName;
                this.Txt_Phone.Value    = ModelCompanyUser.PersonInfo.ContactTel;
                this.Txt_Fox.Value      = ModelCompanyUser.PersonInfo.ContactFax;
                this.Txt_Moblie.Value   = ModelCompanyUser.PersonInfo.ContactMobile;
                this.Txt_QQNumber.Value = ModelCompanyUser.PersonInfo.QQ;
                this.Txt_Email.Value    = ModelCompanyUser.PersonInfo.ContactEmail;
                this.Txt_Remiks.Value   = ModelCompanyUser.PersonInfo.Remark;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 初使化用户信息
 /// </summary>
 private void cominit()
 {
     cModel   = csBll.GetUserInfo(SiteUserInfo.ID);
     cptModel = cBll.GetCustomerConfigModel(CurrentUserCompanyID);
     if (cModel == null)
     {
         cModel = new EyouSoft.Model.CompanyStructure.CompanyUser();
     }
     if (cptModel == null)
     {
         cptModel = new EyouSoft.Model.CompanyStructure.CustomerConfig();
     }
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断权限
            if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目, false);
                return;
            }
            empId = Utils.GetInt(Utils.GetQueryStringValue("empId")); //获取员工Id
            string method = Utils.GetFormValue("hidMethod");          //获取当前操作(保存/继续)

            method2 = Utils.GetQueryStringValue("copy");              //是否复制数据
            string showMess = "数据保存成功!";                              //提示消息

            //如果当前操作无则初始加载(否则保存操作)
            EyouSoft.BLL.CompanyStructure.CompanyUser userBll   = new EyouSoft.BLL.CompanyStructure.CompanyUser(SiteUserInfo); //初始化bll
            EyouSoft.BLL.CompanyStructure.Department  departBll = new EyouSoft.BLL.CompanyStructure.Department();              //初始化bll
            if (method == "")
            {
                #region 初始化员工信息
                //所属部门
                IList <EyouSoft.Model.CompanyStructure.Department> departList = departBll.GetAllDept(CurrentUserCompanyID);
                selBdepart.DataTextField  = "DepartName";
                selBdepart.DataValueField = "Id";
                selBdepart.DataSource     = departList;
                selBdepart.DataBind();
                selBdepart.Items.Insert(0, new ListItem("选择部门", ""));
                //监管部门
                selMdepart.DataTextField  = "DepartName";
                selMdepart.DataValueField = "Id";
                selMdepart.DataSource     = departList;
                selMdepart.DataBind();
                selMdepart.Items.Insert(0, new ListItem("选择部门", ""));
                if (empId != 0) //如果员工Id不为空则加载数据
                {
                    EyouSoft.Model.CompanyStructure.CompanyUser userModel = userBll.GetUserInfo(empId);
                    if (userModel != null)
                    {
                        txtEmail.Value       = userModel.PersonInfo.ContactEmail;
                        txtFax.Value         = userModel.PersonInfo.ContactFax;
                        txtIntroduce.Value   = userModel.PersonInfo.PeopProfile;
                        txtMoible.Value      = userModel.PersonInfo.ContactMobile;
                        txtMSN.Value         = userModel.PersonInfo.MSN;
                        txtQQ.Value          = userModel.PersonInfo.QQ;
                        txtRemark.Value      = userModel.PersonInfo.Remark;
                        txtTel.Value         = userModel.PersonInfo.ContactTel;
                        rdiSex.SelectedValue = ((int)userModel.PersonInfo.ContactSex).ToString();
                        selMdepart.Value     = userModel.SuperviseDepartId.ToString();
                        selBdepart.Value     = userModel.DepartId.ToString();
                        txtDuty.Value        = userModel.PersonInfo.JobName;
                        if (method2 != "copy") //如果不是复制则显示用户名,密码,姓名
                        {
                            txtUserName.Value = userModel.UserName;
                            txtUserName.Attributes.Add("readonly", "readonly");
                            txtPass.Value = userModel.PassWordInfo.NoEncryptPassword;
                            pass          = userModel.PassWordInfo.NoEncryptPassword;
                            txtName.Value = userModel.PersonInfo.ContactName;
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region 保存员工信息
                bool result = false;
                //判断用户名是否已经存在
                if (method == "isexist")
                {
                    string uName = Utils.GetFormValue("uName");
                    if (method2 == "copy")
                    {
                        empId = 0;
                    }
                    result = userBll.IsExists(empId, uName, CurrentUserCompanyID);
                    Utils.ResponseMeg(true, result ? "isExist" : "noisExist");
                    return;
                }
                //验证数据完整性
                if (Utils.InputText(txtUserName.Value) == "" || Utils.InputText(txtPass.Value) == "" || Utils.InputText(txtName.Value) == "")
                {
                    MessageBox.Show(this, "数据请填写完整!");
                    return;
                }
                EyouSoft.Model.CompanyStructure.CompanyUser userModel = new EyouSoft.Model.CompanyStructure.CompanyUser();
                //如果员工编号不为空且不是复制操作则修改操作(否则为新增)
                EyouSoft.Model.CompanyStructure.ContactPersonInfo PersonInfo = new EyouSoft.Model.CompanyStructure.ContactPersonInfo();

                PersonInfo.JobName            = Utils.InputText(txtDuty.Value);
                PersonInfo.ContactEmail       = Utils.InputText(txtEmail.Value);
                PersonInfo.ContactFax         = Utils.InputText(txtFax.Value);
                PersonInfo.PeopProfile        = Utils.InputText(txtIntroduce.Value, 250);
                PersonInfo.ContactMobile      = Utils.InputText(txtMoible.Value);
                PersonInfo.UserType           = EyouSoft.Model.EnumType.CompanyStructure.CompanyUserType.专线用户;
                PersonInfo.MSN                = Utils.InputText(txtMSN.Value);
                PersonInfo.ContactName        = Utils.InputText(txtName.Value);
                PersonInfo.QQ                 = Utils.InputText(txtQQ.Value);
                PersonInfo.Remark             = Utils.InputText(txtRemark.Value, 250);
                PersonInfo.ContactTel         = Utils.InputText(txtTel.Value);
                PersonInfo.ContactSex         = (EyouSoft.Model.EnumType.CompanyStructure.Sex)Utils.GetInt(rdiSex.SelectedValue);
                userModel.PersonInfo          = PersonInfo;
                userModel.IsEnable            = true;
                userModel.LastLoginTime       = DateTime.Now;
                userModel.CompanyId           = CurrentUserCompanyID;
                userModel.DepartId            = Utils.GetInt(Utils.GetFormValue(selBdepart.UniqueID));
                userModel.SuperviseDepartName = Utils.GetFormValue("selMName");
                if (userModel.SuperviseDepartName == "选择部门")
                {
                    userModel.SuperviseDepartName = "";
                }
                userModel.DepartName   = Utils.GetFormValue("selBName");
                userModel.IssueTime    = DateTime.Now;
                userModel.PassWordInfo = new EyouSoft.Model.CompanyStructure.PassWord {
                    NoEncryptPassword = Utils.InputText(txtPass.Value)
                };
                userModel.SuperviseDepartId = Utils.GetInt(Utils.GetFormValue(selMdepart.UniqueID));
                userModel.UserName          = Utils.InputText(txtUserName.Value);
                if (empId != 0 && method2 != "copy")//修改
                {
                    userModel.ID = empId;
                    result       = userBll.Update(userModel);
                }
                else
                {
                    result = userBll.Add(userModel);//添加
                }
                if (!result)
                {
                    showMess = "数据保存失败!";
                }
                //继续添加则刷新页面,否则关闭当前窗口
                if (method == "continue")
                {
                    MessageBox.ShowAndRedirect(this, showMess, "EmployeeEdit.aspx");
                }
                else
                {
                    MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.location='/systemset/organize/DepartEmployee.aspx';window.parent.Boxy.getIframeDialog('{1}').hide()", showMess, Utils.GetQueryStringValue("iframeId")));
                }
                #endregion
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断权限
            if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_组织机构_部门人员栏目, false);
                return;
            }
            this.cu_perList.SysId = SiteUserInfo.SysId;
            string method = Utils.GetQueryStringValue("method");                                                             //获取当期操作

            empId   = Utils.GetInt(Utils.GetQueryStringValue("empId"));                                                      //获取要设置的员工Id
            roleBll = new EyouSoft.BLL.CompanyStructure.SysRoleManage();
            EyouSoft.BLL.CompanyStructure.CompanyUser userBll = new EyouSoft.BLL.CompanyStructure.CompanyUser(SiteUserInfo); //初始化bll
            if (method == "setPermit")
            {
                #region 设置权限
                //设置权限
                roleId = Utils.GetInt(Utils.GetFormValue("roleId"));
                string[] perIds = Utils.GetFormValue("perIds").Split(',');//获取选中的权限
                if (userBll.SetPermission(empId, roleId, perIds))
                {
                    Utils.ResponseMegSuccess();
                }
                else
                {
                    Utils.ResponseMegError();
                }
                return;

                #endregion
            }
            else
            {
                #region 初始化数据或切换角色
                int recordCount = 0;
                //绑定角色下拉框
                IList <EyouSoft.Model.CompanyStructure.SysRoleManage> roleList = roleBll.GetList(100000, 1, ref recordCount, CurrentUserCompanyID);
                if (roleList != null)
                {
                    selRole.DataTextField  = "RoleName";
                    selRole.DataValueField = "Id";
                    selRole.DataSource     = roleList;
                    selRole.DataBind();
                    selRole.Attributes.Add("onchange", "SepPermit.changeRole(this);");
                }
                if (method == "getPermit")                                      //切换角色
                {
                    roleId = Utils.GetInt(Utils.GetQueryStringValue("roleId")); //获取角色
                    if (roleId != 0)
                    {
                        //获取角色拥有的权限
                        BindPermit(roleId);
                    }
                }
                else if (method == "")//初始化数据
                {
                    EyouSoft.Model.CompanyStructure.CompanyUser userModel = userBll.GetUserInfo(empId);
                    selRole.Value = userModel.RoleID.ToString();
                    if (userModel != null)
                    {
                        if (!string.IsNullOrEmpty(userModel.PermissionList))
                        {
                            string[] permits = userModel.PermissionList.Split(',');
                            cu_perList.SetPermitList = permits;
                        }
                        else
                        {
                            if (userModel.RoleID == 0)
                            {
                                BindPermit(roleList != null && roleList.Count > 0 ? roleList[0].Id : 0);
                            }
                        }
                    }
                    else
                    {
                        BindPermit(roleList != null && roleList.Count > 0 ? roleList[0].Id : 0);
                    }
                }
                #endregion
            }
        }
Exemplo n.º 6
0
        private void onInit()
        {
            string name                 = Utils.GetQueryStringValue("OperName");
            string departID             = Utils.GetQueryStringValue("departID");
            string departName           = Utils.GetQueryStringValue("departName");
            string topId                = Utils.GetQueryStringValue("topIID");
            string iframeId             = Utils.GetQueryStringValue("iframeId");
            string txtname              = Utils.GetQueryStringValue("txtname");
            string lblID                = Utils.GetQueryStringValue("lblID");
            string hdid                 = Utils.GetQueryStringValue("hdid");
            string selectedPeopleIdList = GetSelectedIdList();

            this.UCSelectDepartment1.GetDepartmentName = departName;
            this.UCSelectDepartment1.GetDepartId       = departID;
            pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1);//分页索引
            EyouSoft.BLL.CompanyStructure.CompanyUser bll = new EyouSoft.BLL.CompanyStructure.CompanyUser(SiteUserInfo);

            //初始化已选择人员列表
            if (selectedPeopleIdList != "")
            {
                System.Text.StringBuilder str1 = new System.Text.StringBuilder();
                IList <EyouSoft.Model.CompanyStructure.CompanyUser> selectedList =
                    new List <EyouSoft.Model.CompanyStructure.CompanyUser>();
                EyouSoft.Model.CompanyStructure.CompanyUser companyUser = null;
                string[] idArr = selectedPeopleIdList.Split(',');
                int      id    = 0;
                for (int i = 0; i < idArr.Length; i++)
                {
                    if (Int32.TryParse(idArr[i], out id))
                    {
                        companyUser = bll.GetUserInfo(id);
                        if (companyUser != null)
                        {
                            selectedList.Add(companyUser);
                        }
                    }
                }

                if (selectedList.Count > 0)
                {
                    int k = 1;
                    //循环列表,输出
                    foreach (EyouSoft.Model.CompanyStructure.CompanyUser model in selectedList)
                    {
                        //判断是不是一行的第一个
                        if (k % 5 == 1)//是
                        {
                            //输出TR BEGIN TAG
                            str1.Append("<tr class=\"odd\">");
                        }
                        str1.Append("<td height=\"28\" bgcolor=\"#e3f1fc\" width=\"20%\" class=\"pandl3\">");
                        str1.AppendFormat("<input checked type=\"checkbox\" id=\"{0}\" value=\"{0}\">", model.ID);
                        str1.AppendFormat("<label id=\"for_{0}\" for=\"{0}\">{1}</label>", model.ID, model.PersonInfo.ContactName);
                        str1.Append("</td>");

                        //判断是不是一行的第五个并且不是最后一个
                        if (k % 5 == 0 && k <= selectedList.Count)//是一行的第五个
                        {
                            str1.Append("</tr>");
                        }
                        else if (k == selectedList.Count)
                        {
                            int i = k % 5;
                            //计算当前是第几个TD,然后往后补空。
                            for (++i; i <= 5; i++)
                            {
                                str1.Append("<td height=\"28\" bgcolor=\"#e3f1fc\" width=\"20%\" class=\"pandl3\">");
                                str1.Append("&nbsp;");
                                str1.Append("</td>");
                            }
                            str1.Append("</tr>");
                        }
                        k++;
                    }
                    //str.Append("</tr>");
                    strSelectedPeopleHtml = str1.ToString();
                }
            }

            //初始化人员列表
            System.Text.StringBuilder str = new System.Text.StringBuilder();
            System.Collections.Generic.IList <EyouSoft.Model.CompanyStructure.CompanyUser> Ilist = null;
            if (!string.IsNullOrEmpty(departID) || !string.IsNullOrEmpty(name))
            {
                Ilist = bll.GetListByContactName(pageSize, pageIndex, ref recordCount, Utils.GetInt(departID, -1), name);
            }
            else
            {
                Ilist = bll.GetUserInfo(SiteUserInfo.CompanyID, pageSize, pageIndex, ref recordCount);
            }
            selectedPeopleIdList = "," + selectedPeopleIdList + ",";
            bool isSelected = false;

            if (Ilist != null && Ilist.Count > 0)
            {
                int k = 1;
                //循环列表,输出
                foreach (EyouSoft.Model.CompanyStructure.CompanyUser model in Ilist)
                {
                    //判断是不是一行的第一个
                    if (k % 5 == 1)//是
                    {
                        //输出TR BEGIN TAG
                        str.Append("<tr class=\"odd\">");
                    }

                    isSelected = false;
                    if (selectedPeopleIdList.IndexOf("," + model.ID.ToString() + ",") != -1)
                    {
                        isSelected = true;
                    }
                    str.Append("<td height=\"28\" bgcolor=\"#e3f1fc\" width=\"20%\" class=\"pandl3\">");
                    str.AppendFormat("<input " + (isSelected?"checked":"") + " type=\"checkbox\" id=\"{0}\" value=\"{0}\">", model.ID);
                    str.AppendFormat("<label id=\"for_{0}\" for=\"{0}\">{1}</label>", model.ID, model.PersonInfo.ContactName);
                    str.Append("</td>");

                    //判断是不是一行的第五个并且不是最后一个
                    if (k % 5 == 0 && k <= Ilist.Count)//是一行的第五个
                    {
                        str.Append("</tr>");
                    }
                    else if (k == Ilist.Count)
                    {
                        int i = k % 5;
                        //计算当前是第几个TD,然后往后补空。
                        for (++i; i <= 5; i++)
                        {
                            str.Append("<td height=\"28\" bgcolor=\"#e3f1fc\" width=\"20%\" class=\"pandl3\">");
                            str.Append("&nbsp;");
                            str.Append("</td>");
                        }
                        str.Append("</tr>");
                    }
                    k++;
                }
                //str.Append("</tr>");
                strHtml = str.ToString();
            }
            str   = null;
            bll   = null;
            Ilist = null;

            //分页控件初始化
            BindPage(name, departID, topId, iframeId, txtname, lblID, hdid);
        }