Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
            }
            if (!IsPostBack)
            {
                int id        = WX.Request.rDepartmentId;
                int companyId = WX.Request.rCompanyId;
                if (id > 0)
                {
                    //string cmdText = "SELECT * FROM TE_Departments WHERE ID=" + id + " AND CompanyId=" + companyId;
                    Department.MODEL department = WX.Request.rDepartment; //Department.GetModel(cmdText);
                    Company.MODEL    company    = WX.Request.rCompany;
                    this.CompanyName.Text     = company.Name.ToString();  //XSql.GetValue("SELECT Name FROM TE_Companys WHERE ID=" + companyId).ToString();
                    this.txtDepartmentNO.Text = department.NO.f("{0}");
                    WX.Data.Dict.BindListCtrl_DeptList(this.ddlParentId, null, "0#无上级部门", department.ParentID.ToString());
                    this.txtDepartmentName.Text   = department.Name.ToString();
                    this.txtPhone.Text            = department.Tel.ToString();
                    this.txtFax.Text              = department.Fax.ToString();
                    this.txtAddress.Text          = department.Address.ToString();
                    this.txtSort.Text             = department.Sort.ToString();
                    this.txtContent.Text          = department.Content.ToString();
                    this.chkIsSubOrgan.Checked    = string.IsNullOrEmpty(department.IsSubOrgan.ToString()) ? false : true;
                    this.hidden_txtHost.Value     = department.Host.ToString();
                    this.txtHost.Text             = CommonUtils.GetRealNameListByUserIdList(department.Host.ToString());
                    this.hidden_txtSubHosts.Value = department.SubHosts.ToString();
                    this.txtSubHosts.Text         = CommonUtils.GetRealNameListByUserIdList(department.SubHosts.ToString());

                    this.hidden_txtAssistants.Value = department.Assistants.ToString();
                    this.txtAssistants.Text         = CommonUtils.GetRealNameListByUserIdList(department.Assistants.ToString());

                    this.hidden_txtUpHost.Value = department.UpHost.ToString();
                    this.txtUpHost.Text         = CommonUtils.GetRealNameListByUserIdList(department.UpHost.ToString());

                    this.hidden_txtUpSubHosts.Value = department.UpSubHosts.ToString();
                    this.txtUpSubHosts.Text         = CommonUtils.GetRealNameListByUserIdList(department.UpSubHosts.ToString());
                }
                else
                {
                    Response.Write("部门编号格式不正确!");
                    Response.End();
                    return;
                }
            }
        }
 private void FillDataCtrl()
 {
     Employee.MODEL      employee;
     WX.Model.User.MODEL usermodel;
     if (WX.Request.rUserId != null)
     {
         employee  = WX.Request.rEmpolyee;
         usermodel = WX.Request.rUser;
     }
     else
     {
         WX.Main.CurUser.LoadUserModel(false);
         employee  = Employee.GetModel("SELECT * FROM TU_Employees WHERE UserID='" + WX.Main.CurUser.UserID + "'");
         usermodel = WX.Main.CurUser.UserModel;
     }
     if (employee.LoadSucceed || true)
     {
         Department.MODEL dept = Department.GetCache(usermodel.DepartmentID.ToInt32());
         if (dept != null)
         {
             lblDeptName.Text = dept.Name.ToString();
         }
         DutyDetail.MODEL duty = DutyDetail.GetCache(usermodel.DutyId.ToInt32());
         if (duty != null)
         {
             lblDutyName.Text = duty.Name.ToString();
         }
         Company.MODEL cmp = Company.GetCache(usermodel.CompanyID.ToInt32());
         if (cmp != null)
         {
             lblCompanyName.Text = cmp.Name.ToString();
         }
         //this.ddlCompany.SelectedItem.Value = employee.CompanyID.ToString();
         deptId = usermodel.DepartmentID.ToString();
         this.lblRealName.Text = usermodel.RealName.ToString();
         this.lblIdCard.Text   = employee.IDCard.ToString();
         //this.ddlPosition.SelectedItem.Value = employee.DutyId.ToString();
         this.lblBirthday.Text  = employee.Birthday.f("{0:yyyy年MM月dd日}");
         this.lblMoblie.Text    = employee.Mobile.ToString();
         this.lblSex.Text       = employee.Sex.ToBoolean() ? "男" : "女";
         this.lblQQ.Text        = employee.QQ.ToString();
         this.lblEmail.Text     = employee.Email.ToString();
         this.lblTelephone.Text = employee.Tel.ToString();
         string[] addrarry = employee.Address.ToString().Split('|');
         if (addrarry.Length > 1)
         {
             this.lblAddress.Text  = addrarry[0].Split(':')[0] + "  " + addrarry[0].Split(':')[1];
             this.lblAddress2.Text = addrarry[1].Split(':')[0] + "  " + addrarry[1].Split(':')[1];
         }
         if (employee.UserFace.isEmpty)
         {
             this.liPreZoomImage.Text = "<img id=\"preZoomImage\" src=\"/Images/NoPhoto.gif\" alt=\"\" style=\"width: 100%; height: 100%;\" />";
         }
         else
         {
             this.liPreZoomImage.Text = "<img id=\"preZoomImage\" src=\"" + (employee.UserFace.ToString()) + "\" alt=\"\" style=\"width: 100%; height: 100%; \" />";
         }
         this.lblContent.Text = employee.Introduction.ToString();
         WX.Model.EmployeeCredential.MODEL model = WX.Model.EmployeeCredential.GetModel("Select top 1 * from [TU_Employees_Credentials] where Name='身份证扫描件'");
         if (model != null)
         {
             cardannex.Text = "<a href=\"javascript:PopupIFrame('Priv_CredentialsDetail.aspx?Id=" + model.Id.ToString() + "','查看详细','','',1000,800)\">查看扫描件</a>";
         }
     }
 }
Example #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            //2.取得用户变量
            //3.验证用户变量
            int id        = WX.Request.rDepartmentId;
            int companyId = WX.Request.rCompanyId;

            //4.处理业务
            Department.MODEL department = WX.Request.rDepartment;
            //List<Department.MODEL> childs = department.GetChilds();
            //Department.GetModel("SELECT * FROM TE_Departments WHERE ID=" + id);
            department.NO.set(this.txtDepartmentNO.Text);
            department.ParentID.value = this.ddlParentId.Text;
            department.Name.value     = this.txtDepartmentName.Text.Trim();
            department.Tel.value      = this.txtPhone.Text.Trim();
            department.Fax.value      = this.txtFax.Text.Trim();
            department.Address.value  = this.txtAddress.Text.Trim();
            department.Content.value  = this.txtContent.Text.Trim();
            department.Sort.value     = this.txtSort.Text.Trim();

            department.IsSubOrgan.value = Convert.ToInt32(this.chkIsSubOrgan.Checked);
            if (string.IsNullOrEmpty(this.hidden_txtHost.Value))
            {
                department.Host.set(Convert.DBNull);
            }
            else
            {
                department.Host.value = this.hidden_txtHost.Value;
            }
            department.SubHosts.value   = this.hidden_txtSubHosts.Value;
            department.Assistants.value = this.hidden_txtAssistants.Value;
            if (string.IsNullOrEmpty(this.hidden_txtUpHost.Value))
            {
                department.UpHost.set(Convert.DBNull);
            }
            else
            {
                department.UpHost.value = this.hidden_txtUpHost.Value;
            }
            department.UpSubHosts.value = this.hidden_txtUpSubHosts.Value;
            //bool idModified = department.ID.updated;
            int row = department.Update();

            department.SaveIntoCaches();
            if (row != 0)
            {
                //if (idModified)
                //{

                //    if (childs != null)
                //    {
                //        foreach (Department.MODEL dm in childs)
                //        {
                //            dm.ParentID.set(department.ID);
                //            dm.Update();
                //        }
                //    }
                //}
                //5.(用户及业务对象)统计与状态
                //WX.Main.CurUser.LoadMyDepartment(true);
                //6.登记日志
                WX.Main.AddLog(LogType.Default, "部门信息修改成功!", "");
                //7.返回页面
                //if (idModified)
                //    Response.Redirect("Dept_DepartmentList.aspx?companyId=" + Request.QueryString["Companyid"], true);
                //else
                ULCode.Debug.Confirm(this, "部门信息修改成功!是否返回部门列表页?", "Dept_DepartmentList.aspx?companyId=" + Request.QueryString["Companyid"], this.Request.RawUrl);
            }
            else
            {
                department.RestoreInitial();
                ULCode.Debug.Alert(this, "部门信息修改失败!可能是重复添加!");
            }
        }