示例#1
0
    protected void btnPwdInit_Click(object sender, EventArgs e)
    {
        //取得选中的数据
        ArrayList list = GetSelectedKeyValues(out isDelete);

        //修改数据
        if (list.Count == 1)
        {
            //进行密码的修改
            try
            {
                string     strNewPwd = Guid.NewGuid().ToString().Substring(0, 6);
                CSSysStaff Modistaff = new CSSysStaff(config.DBConn);
                Modistaff.Staff_Id = list[0].ToString();
                Modistaff.Password = strNewPwd;
                Modistaff.Update();
                Response.Write("<script type='text/javascript'>alert('员工" + Function.GetStaffNameById(list[0].ToString(), config) + "初始化密码成功,新密码为 " + strNewPwd + "!');</script>");
            }
            catch (Exception exc)
            {
                Response.Write("<script type='text/javascript'>alert('初始化密码失败!');</script>");
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('请选择一个要初始化密码的员工!');</script>");
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //////////////
        CSSysStaff staff = new CSSysStaff(config.DBConn);

        staff.Staff_Id = "00000001";
        config.Staff   = staff;
        //////////////

        btnSelect.Attributes.Add("onclick", "PopWindow();");
        btnSelectDepartment.Attributes.Add("onclick", "SelectDept();");

        if (!IsPostBack)
        {
            if (Function.CheckStaff(config) == "Yes")//为系统管理员
            {
                GetWorkPlan("");
                BindData();

                //可以选择员工和部门
                btnSelect.Enabled           = true;
                btnSelectDepartment.Enabled = true;
            }
            else if (Function.CheckStaff(config) == "No")//不是管理员
            {
                GetWorkPlan("select a.*,b.UserName As UserName,b.Name As Name from SPsnWorkTime a Left Join SSysStaff b On a.Staff_Id=b.Staff_Id Where a.StatusId=0 And Staff_Id='" + config.Staff.Staff_Id + "' And a.Day Between '" + DateTime.Now.AddDays(-7) + "' And '" + DateTime.Now + "'");
                BindData();

                //不可以选择
                btnSelect.Enabled           = false;
                btnSelectDepartment.Enabled = false;
            }
            else//是部门的管理员
            {
                //得到其所属的员工staff_Id
                db = new MDataBase(config.DBConn);
                string    sqlStaff = "Select Staff_Id From SSysStaff Where Dept_Id='" + Function.CheckStaff(config) + "'";
                DataTable dtStaff  = new DataTable();
                db.GetDataTable(sqlStaff, out dtStaff);
                string strStaffs = "";
                for (int i = 0; i < dtStaff.Rows.Count; i++)
                {
                    strStaffs += dtStaff.Rows[i][0].ToString() + "','";
                }
                strStaffs = strStaffs.TrimEnd('\'').TrimEnd(',');

                GetWorkPlan("select a.*,b.UserName As UserName,b.Name As Name from SPsnWorkTime a Left Join SSysStaff b On a.Staff_Id=b.Staff_Id Where a.StatusId=0 And a.Staff_Id in('" + strStaffs + ") And a.Day Between '" + DateTime.Now.AddDays(-7) + "' And '" + DateTime.Now + "'");
                BindData();

                //可以选择其所属部门员工
                btnSelect.Enabled           = true;
                btnSelectDepartment.Enabled = false;
            }
        }

        txtSelect.Text     = Function.GetStaffNameById(hfStaffId.Value.TrimEnd(','), config);
        txtDepartment.Text = Function.GetDeptNameById(hfDeptId.Value.TrimEnd(','), config);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        staff          = new CSSysStaff(config.DBConn);
        staff.Password = "******";
        config.Staff   = staff;

        if (!IsPostBack)
        {
            if (Request.QueryString["oldPwd"] != null)
            {
                string strOldPwd = Request.QueryString["oldPwd"].ToString();
                txtOldPwd.Text = strOldPwd;
            }
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strStaffId = "";

        if (!IsPostBack)
        {
            //config = (Config)Session["Config"];

            /////////测试
            CSSysStaff staff = new CSSysStaff(config.DBConn);
            staff.Staff_Id = "38b47ee3";
            config.Staff   = staff;
            /////////

            hfPower.Value = Function.CheckStaff(config);


            //取得前个页面传过来的值
            if (Request.QueryString["StaffId"] != null)
            {
                strStaffId = Request.QueryString["StaffId"].ToString();
            }

            //根据StaffId取得相应的工作日程( 时间条件待补 )
            db = new MDataBase(config.DBConn);
            //数据绑定
            BindData("");

            //添加删除确认事件
            this.btnDelete.Attributes.Add("onclick", "return confirm('您确认要删除所有选中的记录吗?');");

            //显示当前页索引
            lblCurrentPage.Text = "1";
            //取得该日程的所属人
            //lblEmployeeName.Text = dtWorkPlan.Rows[0]["Name"].ToString();

            //加载部门下拉框
            Function.BindDeptToDdl(ddlDept, config);

            //选择人员
            btnSelect.Attributes.Add("onclick", "SelectStaff();");
        }

        txtStaff.Text = Function.GetStaffNameById(hfStaff.Value, config).TrimEnd(',');
    }
示例#5
0
    private void GetConfig()
    {
        Config config = new Config();
        bool   blnGet = config.GetParameter("OA");

        if (blnGet == false)
        {
            JS.alert(config.ErrMessage);
            return;
        }
        CSSysStaff staff = new CSSysStaff(config.DBConn);

        staff.Staff_Id    = txtLoginName.Text;
        config.LoginTime  = DateTime.Now;
        config.Staff      = staff;
        config.ProjectId  = "00000001";
        Session["Config"] = config;
    }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //////////////////
            CSSysStaff staff = new CSSysStaff();
            config.Staff   = staff;
            staff.Staff_Id = "00000001";
            //////////////////


            db = new MDataBase(config.DBConn);
            string    strDept = "Select * From SSysRole";
            DataTable dtDept  = new DataTable();

            db.GetDataTable(strDept, out dtDept);

            //动态创建表来显示部门
            TableRow tr = new TableRow();
            for (int i = 0; i < dtDept.Rows.Count; i++)
            {
                if (i % 3 == 0)
                {
                    tr = new TableRow();
                }
                TableCell tc = new TableCell();
                CheckBox  cb = new CheckBox();
                cb.Text = dtDept.Rows[i]["Name"].ToString();
                cb.ID   = dtDept.Rows[i]["Role_Id"].ToString();
                tc.Controls.Add(cb);
                tc.Width = 100;
                tr.Cells.Add(tc);
                tabDept.Rows.Add(tr);
            }
        }
    }
示例#7
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //////////////////
            CSSysStaff staff = new CSSysStaff();
            config.Staff   = staff;
            staff.Staff_Id = "00000001";
            //////////////////

            //判断权限
            string strPower = Function.CheckStaff(config);

            //得到所有员工姓名、部门、是否在线等信息
            db = new MDataBase(config.DBConn);
            DataTable dt  = new DataTable();
            string    sql = "select a.Staff_Id,a.Name,b.Name AS Department,a.IsMonitor,LastLoginTime - LastLogoutTime AS IsOnline,a.Dept_Id From SSysStaff a Left Join SSysdepartment b on a.Dept_Id = b.Dept_Id Where a.StatusId=0 ORDER BY b.Name,a.IsMonitor DESC";
            db.GetDataTable(sql, out dt);

            TableRow  tr1;
            TableCell tcJob;

            ////插入第一行
            //tr1 = new TableRow();
            //tcJob = new TableCell();
            //tcJob.Text = "局长";
            //tcJob.HorizontalAlign = HorizontalAlign.Right;
            //tcJob.Width = 50;
            //tr1.Cells.Add(tcJob);
            //tlbIsOnline.Rows.Add(tr1);

            ////插入局长名字及在线状态
            //tr1 = new TableRow();
            //tcJob = new TableCell();
            //tcJob.Text = "  ";
            //tcJob.Width = 50;
            //tr1.Cells.Add(tcJob);

            //tcJob = new TableCell();
            //tcJob.Text = "***" + " ●";
            ////根据条件判断应该经什么颜色显示
            //tcJob.ForeColor = Color.Red;
            //tcJob.Width = 50;
            //tr1.Cells.Add(tcJob);
            //tlbIsOnline.Rows.Add(tr1);

            ////插入第三行
            //tr1 = new TableRow();
            //tcJob = new TableCell();
            //tcJob.Text = "副局长";
            //tcJob.HorizontalAlign = HorizontalAlign.Right;
            //tcJob.Width = 50;
            //tr1.Cells.Add(tcJob);
            //tlbIsOnline.Rows.Add(tr1);

            //插入副局长的名字


            //插入各部门
            //得到各个部门
            db = new MDataBase(config.DBConn);
            DataTable dtDept     = new DataTable();
            string    strDeptSql = "select b.Name AS Department,b.Dept_Id As DeptId,MIN(b.OrderIndex) AS [Index] From SSysStaff a Left Join SSysdepartment b on a.Dept_Id = b.Dept_Id Where a.StatusId=0 And b.Name!='' Group by b.Name,b.Dept_Id Order by [Index]";
            db.GetDataTable(strDeptSql, out dtDept);

            for (int i = 0; i < dtDept.Rows.Count; i++)
            {
                //添加部门行
                tr1              = new TableRow();
                tcJob            = new TableCell();
                tcJob.ColumnSpan = 2;
                CheckBox cbf = new CheckBox();
                cbf.Text = dtDept.Rows[i][0].ToString();
                cbf.ID   = dtDept.Rows[i][1].ToString();
                tcJob.Controls.Add(cbf);

                //判断权限确定能够选择哪些员工
                if (strPower == "Yes")
                {
                    cbf.Enabled = true;
                }
                else if (strPower == dtDept.Rows[i][1].ToString())
                {
                    cbf.Enabled = true;
                }
                else
                {
                    cbf.Enabled = false;
                }
                cbf.InputAttributes.Add("onclick", "AllSelect('tlb" + cbf.ID + "');");

                //tcJob.Text = dtDept.Rows[i][0].ToString();
                tcJob.HorizontalAlign = HorizontalAlign.Left;
                tcJob.Width           = 50;
                tr1.Cells.Add(tcJob);
                tlbIsOnline.Rows.Add(tr1);


                //添加部门人员行
                //得到相应部门的员工
                DataRow[] dr = dt.Select("Department='" + dtDept.Rows[i][0].ToString() + "'", "IsMonitor");
                if (dr.Length > 0)
                {
                    tr1       = new TableRow();
                    tr1.Width = 600;
                    TableCell tcBlank = new TableCell();
                    tcBlank.Width = 50;
                    tr1.Cells.Add(tcBlank);

                    TableCell tc1 = new TableCell();
                    tc1.Width = 600;


                    //新建个表,存放员工信息
                    Table tab = new Table();
                    tab.ID = "tlb" + dtDept.Rows[i][1].ToString();

                    //创建新表的行
                    TableRow tr2 = new TableRow();

                    //如果没有主官,则首个单元格为空
                    if ((dt.Select("Department='" + dtDept.Rows[i][0].ToString() + "' And IsMonitor='0'")).Length < 0)
                    {
                        tcJob       = new TableCell();
                        tcJob.Width = 50;
                        tcJob.Text  = "";
                        tr2.Cells.Add(tcJob);
                    }
                    for (int j = dr.Length - 1; j >= 0; j--)
                    {
                        //如果是三的整倍,则换行
                        if (tr2.Cells.Count > 3 || tr2.Cells.Count == 0)
                        {
                            tr2 = new TableRow();

                            //只有该部门有主官,或者是第一行,才要加空单元格
                            if ((dt.Select("Department='" + dtDept.Rows[i][0].ToString() + "' And IsMonitor='0'")).Length > 0 && j == (dr.Length - 1))
                            {
                            }
                            else
                            {
                                tcJob       = new TableCell();
                                tcJob.Width = 50;
                                tcJob.Text  = "";
                                tr2.Cells.Add(tcJob);
                            }
                        }

                        tcJob = new TableCell();
                        tcJob.HorizontalAlign = HorizontalAlign.Left;
                        tcJob.Width           = 140;


                        //显示复选框,使员工可以多选
                        CheckBox cb = new CheckBox();
                        cb.Text = dr[j][1].ToString() + "●   ";
                        cb.ID   = dr[j][0].ToString();
                        tcJob.Controls.Add(cb);
                        cb.LabelAttributes.Add("onclick", "return window.showModalDialog( 'PopPage/StaffWorkPlan.aspx?StaffId=" + dr[j][0].ToString() + "','工作日程页面','dialogHeight=450, dialogWidth=600, top='+(screen.AvailHeight-450)/2+', left='+ (screen.availWidth-600)/2 +', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')");
                        cb.LabelAttributes.Add("onmouseover", "return this.style.cursor='hand'");

                        //判断权限确定能够选择哪些员工
                        if (strPower == "Yes")
                        {
                            cb.Enabled = true;
                        }
                        else if (strPower == dtDept.Rows[i][1].ToString())
                        {
                            cb.Enabled = true;
                        }
                        else
                        {
                            cb.Enabled = false;
                        }

                        string s = dr[j][4].ToString();
                        if (dr[j][4].ToString() != "")
                        {
                            if (Convert.ToDateTime(dr[j][4]) < Convert.ToDateTime("1900-1-1"))
                            {
                                tcJob.ForeColor = Color.Red;
                            }
                            else
                            {
                                tcJob.ForeColor = Color.Silver;
                            }
                        }
                        tr2.Cells.Add(tcJob);
                        tab.Rows.Add(tr2);

                        tc1.Controls.Add(tab);

                        tr1.Cells.Add(tc1);
                        tlbIsOnline.Rows.Add(tr1);
                    }
                }
            }
        }
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //测试调用情况
        //Response.Write(this.Request.RawUrl);

        Config config = (Config)Session["Config"];

        string strUsername = Request["txtLoginName"].ToString();
        DataTable dtStaffRole;
        DataTable dtDelegateRole;
        string sql = "";
        string sql2 = "";
        string ReturnCode = "";
        //string strStaffId;

        CSSysStaff staff = new CSSysStaff(config.DBConn);
        staff.Username = strUsername;
        staff.GetInfo();

        //得到登录者所拥有的角色
        sql = "SELECT B.Name, B.Role_Id AS Id FROM SSysStaffProjectRole A LEFT OUTER JOIN SSysRole B ON A.Role_Id = B.Role_Id WHERE  A.Staff_Id = '" + staff.Staff_Id + "' AND A.Project_Id= '" + config.ProjectId + "' AND B.StatusId = 0";
        MDataBase db = new MDataBase(config.DBConn);
        db.GetDataTable(sql, out dtStaffRole);
        for (int i = 0; i < dtStaffRole.Rows.Count; i++)
        {
            ReturnCode += dtStaffRole.Rows[i][1] + "*" + dtStaffRole.Rows[i][0] + "#";
        }

        //得到登录者所代理的角色
        if (config.IsCommission)
        {
            sql2 = "";
            db.GetDataTable(sql2, out dtDelegateRole);
            for (int i = 0; i < dtDelegateRole.Rows.Count; i++)
            {
                ReturnCode += "(delegate)" + dtDelegateRole.Rows[i][1] + "*" + dtDelegateRole.Rows[i][0] + "#";
            }
        }

        Response.ContentType = "text/plain";
        Response.Write(ReturnCode);
        Response.End();

        //if (dtStaffRole != null)
        //{
        //    ReturnCode += "<select name='sltRole' id='sltRole' style='width:130px;'>";
        //    bool IsFrist = true;
        //    foreach (DataRow dr in dtStaffRole.Rows)
        //    {
        //        if (IsFrist == true)
        //        {
        //            ReturnCode += "<option selected=\"selected\" value=\"";
        //            IsFrist = false;
        //        }
        //        else
        //        {
        //            ReturnCode += "<option value=\"";
        //        }
        //        ReturnCode += dr["Id"].ToString() + "\">" + dr["Name"].ToString() + "</option>";
        //        ReturnCode += "</select>";
        //    }
        //}

        ////<option selected="selected" value="Value1">Text1</option>
        ////<option value="Value2">Text2</option>
        //Response.Write(ReturnCode);
    }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //////////////
        CSSysStaff staff = new CSSysStaff(config.DBConn);

        staff.Staff_Id = "00000001";
        config.Staff   = staff;
        //////////////

        if (!IsPostBack)
        {
            //添加弹出选择人员页面的属性
            btnSelect.Attributes.Add("onclick", "PopWindow();");

            //根据权限判断加载哪些记录
            if (Function.CheckStaff(config) == "Yes")//为系统管理员
            {
                BindData("");

                //加载部门下拉框数据
                db = new MDataBase(config.DBConn);
                string    strDept = "Select * from SSysDepartment Where StatusId=0";
                DataTable dtDept  = new DataTable();
                db.GetDataTable(strDept, out dtDept);
                ddlDept.Items.Clear();
                ddlDept.Items.Add(new ListItem("全部", "0"));
                ddlDept.AppendDataBoundItems = true;
                ddlDept.DataSource           = dtDept;
                ddlDept.DataTextField        = "Name";
                ddlDept.DataValueField       = "Dept_Id";
                ddlDept.DataBind();

                //可以选择员工和部门
                ddlDept.Enabled   = true;
                btnSelect.Enabled = true;
            }
            else if (Function.CheckStaff(config) == "No")//不是管理员
            {
                BindData("select a.*,b.UserName As UserName,b.Name As Name,c.Name AS StatusName from SPsnWorkTime a INNER JOIN  SC_WorkStatus c ON a.WorkStatusId = c.WorkStatusId Left Join SSysStaff b On a.Staff_Id=b.Staff_Id Where a.StatusId=0 And Staff_Id='" + config.Staff.Staff_Id + "' And a.Day Between '" + DateTime.Now.AddDays(-7) + "' And '" + DateTime.Now + "'");

                //不可以选择
                btnSelect.Enabled = false;
                ddlDept.Enabled   = false;
            }
            else//是部门的管理员
            {
                //得到其所属的员工staff_Id
                db = new MDataBase(config.DBConn);
                string    sqlStaff = "Select Staff_Id From SSysStaff Where Dept_Id='" + Function.CheckStaff(config) + "'";
                DataTable dtStaff  = new DataTable();
                db.GetDataTable(sqlStaff, out dtStaff);
                string strStaffs = "";
                for (int i = 0; i < dtStaff.Rows.Count; i++)
                {
                    strStaffs += dtStaff.Rows[i][0].ToString() + "','";
                }
                strStaffs = strStaffs.TrimEnd('\'').TrimEnd(',');

                BindData("select a.*,b.UserName As UserName,b.Name As Name,c.Name AS StatusName from SPsnWorkTime a INNER JOIN  SC_WorkStatus c ON a.WorkStatusId = c.WorkStatusId Left Join SSysStaff b On a.Staff_Id=b.Staff_Id Where a.StatusId=0 And a.Staff_Id in('" + strStaffs + ") And a.Day Between '" + DateTime.Now.AddDays(-7) + "' And '" + DateTime.Now + "'");

                //可以选择其所属部门员工
                btnSelect.Enabled = true;
                ddlDept.Enabled   = false;
            }
            lblCurrentPage.Text = "1";
        }

        txtSelect.Text = Function.GetStaffNameById(hfStaffId.Value.TrimEnd(','), config);
    }
示例#10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        CSSysStaff staff = new CSSysStaff(config.DBConn);

        if (hfIsUpdate.Value == "Insert")//执行插入操作
        {
            //设置部门为可写
            ddlDepartment.Enabled = true;

            //得到要插入的新的员工编号
            string strId = Guid.NewGuid().ToString().Substring(0, 8);

            try
            {
                staff.Staff_Id  = strId;
                staff.Username  = txtUserName.Text;
                staff.Password  = txtPwd.Text;
                staff.Name      = txtName.Text;
                staff.Dept_Id   = ddlDepartment.SelectedValue;
                staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);
                //staff.Name = "";
                staff.LoginTimes   = 0;
                staff.StatusId     = 0;
                staff.TotalUseTime = 0;
                staff.WorkStatusId = 0;
                staff.PasswordDate = DateTime.Now;
                staff.Insert();

                string[] strRole = hfSelectRole.Value.TrimEnd(',').Split(',');
                db = new MDataBase(config.DBConn);

                for (int i = 0; i < strRole.Length; i++)
                {
                    string strInsert = "insert into SSysStaffProjectRole values('" + strId + "','" + config.ProjectId + "','" + strRole[i] + "'," + 0 + ")";
                    db.executeInsert(strInsert);
                }

                Response.Write("<script type='text/javascript'>alert('添加成功!'); </script>");
            }
            catch (Exception exc)
            {
                Response.Write("<script type='text/javascript'>alert('添加失败!');</script>");
            }
        }
        else //执行更新操作
        {
            try
            {
                //设置更新条件
                staff.Staff_Id = hfIsUpdate.Value;

                if (hfRole.Value == "Adder") //
                {
                    //重置密码
                    //staff.Password = "******";

                    //修改部门
                    //staff.Dept_Id = ddlDepartment.SelectedValue;

                    //修改是否为主管
                    staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);


                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Self")
                {
                    //更改姓名
                    if (txtName.Text != "")
                    {
                        staff.Name = txtName.Text;
                    }

                    //更改生日
                    if (txtBirthday.Text != "")
                    {
                        staff.Birthday = Convert.ToDateTime(txtBirthday.Text);
                    }

                    //更改家庭电话
                    if (txtHomeTel.Text != "")
                    {
                        staff.StringField6 = txtHomeTel.Text;
                    }

                    //更改移动电话
                    if (txtMobileTel.Text != "")
                    {
                        staff.StringField5 = txtMobileTel.Text;
                    }

                    //更改家庭住址
                    if (txtAddress.Text != "")
                    {
                        staff.StringField8 = txtAddress.Text;
                    }

                    //更改办公电话1
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField3 = txtOfficeTel.Text;
                    }

                    //更改办公电话2
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField4 = txtOfficeTel2.Text;
                    }

                    //更改电话短号
                    if (txtShortTel.Text != "")
                    {
                        staff.StringField7 = txtShortTel.Text;
                    }

                    //更改短信号码
                    if (txtSMSCode.Text != "")
                    {
                        staff.StringField18 = txtSMSCode.Text;
                    }

                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Polity")
                {
                    //修改职务
                    if (txtBusiness.Text != "")
                    {
                        staff.StringField1 = txtBusiness.Text;
                    }

                    //修改军衔
                    //if (txtMilitary.Text != "")
                    //{
                    //    staff.StringField2 = txtMilitary.Text;
                    //}

                    //修改入伍时间
                    if (txtEnrollment.Text != "")
                    {
                        staff.StringField10 = Convert.ToDateTime(txtEnrollment.Text);
                    }

                    //进行更新
                    staff.Update();
                }
                else if (hfRole.Value == "Manager") //修改所有记录(密码不能修改)
                {
                    //重置密码
                    staff.Password = "******";

                    //修改部门
                    //staff.Dept_Id = ddlDepartment.SelectedValue;

                    //修改是否为主管
                    staff.IsMonitor = Int32.Parse(ddlIsManager.SelectedValue);
                    //更改姓名
                    if (txtName.Text != "")
                    {
                        staff.Name = txtName.Text;
                    }

                    //更改生日
                    if (txtBirthday.Text != "")
                    {
                        staff.Birthday = Convert.ToDateTime(txtBirthday.Text);
                    }

                    //更改家庭电话
                    if (txtHomeTel.Text != "")
                    {
                        staff.StringField6 = txtHomeTel.Text;
                    }

                    //更改移动电话
                    if (txtMobileTel.Text != "")
                    {
                        staff.StringField5 = txtMobileTel.Text;
                    }

                    //更改家庭住址
                    if (txtAddress.Text != "")
                    {
                        staff.StringField8 = txtAddress.Text;
                    }

                    //更改办公电话1
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField3 = txtOfficeTel.Text;
                    }

                    //更改办公电话2
                    if (txtOfficeTel.Text != "")
                    {
                        staff.StringField4 = txtOfficeTel2.Text;
                    }

                    //更改电话短号
                    if (txtShortTel.Text != "")
                    {
                        staff.StringField7 = txtShortTel.Text;
                    }

                    //更改短信号码
                    if (txtSMSCode.Text != "")
                    {
                        staff.StringField18 = txtSMSCode.Text;
                    }

                    //修改职务
                    if (txtBusiness.Text != "")
                    {
                        staff.StringField1 = txtBusiness.Text;
                    }

                    ////修改军衔
                    //if (txtMilitary.Text != "")
                    //{
                    //    staff.StringField2 = txtMilitary.Text;
                    //}

                    //修改入伍时间
                    if (txtEnrollment.Text != "")
                    {
                        staff.StringField10 = Convert.ToDateTime(txtEnrollment.Text);
                    }

                    //进行更新
                    staff.Update();
                }
                Response.Write("<script type='text/javascript'>alert('更新成功!'); </script>");
            }
            catch (Exception exc)
            {
                Response.Write("<script type='text/javascript'>alert('更新失败!'); </script>");
            }
        }
    }
示例#11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //////////////////
            CSSysStaff staff = new CSSysStaff();
            config.Staff   = staff;
            staff.Staff_Id = "00000001";
            //////////////////


            //如果是管理员,则让其选择员工,如果是普通员工则不能选择
            if (config.Staff.IsMonitor == 0)
            {
                btnSelect.Attributes.Add("onclick", "PopWindow();");
                btnSelect.Enabled = true;
            }
            else
            {
                btnSelect.Enabled = false;
                txtSelected.Text  = config.Staff.Name;
            }

            //为工作状态下拉框添加选项
            db = new MDataBase(config.DBConn);
            string    strWorkStatus = "Select * From SC_WorkStatus Where IsSystemStatus=-1";
            DataTable dtWorkStatus  = new DataTable();
            db.GetDataTable(strWorkStatus, out dtWorkStatus);
            ddlWordStatus.DataSource     = dtWorkStatus.DefaultView;
            ddlWordStatus.DataTextField  = "Name";
            ddlWordStatus.DataValueField = "WorkStatusId";
            ddlWordStatus.DataBind();

            //添加关闭本页面的事件
            btnWorkPlanSave.Attributes.Add("onclick", "closeWin();");

            if (Request.QueryString["WorkTimeId"] != null)
            {
                //保存上个页面传来的ID值,表示进行更新操作
                hfWorkTime.Value = Request.QueryString["WorkTimeId"].ToString();

                lblDayKey.Enabled   = true;
                lblDayValue.Enabled = true;

                //加载页面中的各项值
                db = new MDataBase(config.DBConn);
                DataTable dt = new DataTable();
                db.GetDataTable("Select * from SPsnWorkTime Where StatusId=0 And WorkTime_Guid='" + hfWorkTime.Value + "'", out dt);
                txtStart.Enabled  = false;
                txtEnd.Enabled    = false;
                btnSelect.Enabled = false;

                //显示工作日期
                lblDayValue.Text = dt.Rows[0]["Day"].ToString();

                txtAddress.Text = dt.Rows[0]["Address"].ToString();
                txtJob.Text     = dt.Rows[0]["Job"].ToString();
                for (int i = 0; i < ddlWordStatus.Items.Count; i++)
                {
                    if (ddlWordStatus.Items[i].Value == dt.Rows[0]["WorkStatusId"].ToString())
                    {
                        ddlWordStatus.SelectedIndex = i;
                    }
                }
            }
            else
            {
                //表示进行插入操作
                hfWorkTime.Value    = "Insert";
                lblDayKey.Enabled   = false;
                lblDayValue.Enabled = false;
            }
        }

        txtSelected.Text = Function.GetStaffNameById(hfStaffId.Value, config).TrimEnd(',');
        if (txtSelected.Text.Contains(","))
        {
            Response.Write("<script type='text/javascript'>alert('只能选择一个人员进行添加!'); </script>");
            txtSelected.Text = "";
        }
    }
示例#12
0
    protected void LogButton_Click(object sender, EventArgs e)
    {
        if (this.txtLoginName.Text.Trim().Length == 0)
        {
            JS.alert("登录名不能为空!");
            return;
        }

        bool blnLogin = false;

        try
        {
            if (Session["Config"] == null)
            {
                Response.Redirect("error2.htm");
            }
            Config     config = (Config)Session["Config"];
            CSSysStaff staff  = new CSSysStaff(config.DBConn);
            staff.Username = this.txtLoginName.Text.Trim();
            staff.GetInfo();


            if (staff.Staff_Id != null)
            {
                if (staff.Password == this.txtPwd.Text.Trim())
                {
                    blnLogin         = true;
                    config.Staff     = staff;
                    config.LoginTime = DateTime.Now;
                    config.LoginRole = HiRole.Value;//this.sltRole.SelectedValue;

                    //把Application付于Hashtable
                    Hashtable htLoginParam  = new Hashtable();
                    Hashtable htLoginParam1 = new Hashtable();
                    bool      IsLogin       = false;

                    htLoginParam1 = (Hashtable)Application["Hashtable"];
                    if (htLoginParam1 != null)
                    {
                        htLoginParam = htLoginParam1;
                    }

                    //判断是否已登陆
                    if (htLoginParam.Count != 0)
                    {
                        IsLogin = htLoginParam.ContainsKey(config.Staff.Username);
                    }
                    if (IsLogin == true && htLoginParam.Count != 0)
                    {
                        WebWindow.alert("该用户已登陆!");
                        return;
                    }

                    string LoginHistoryGuid = Guid.NewGuid().ToString().ToUpper();

                    #region
                }
            }
        }
        catch
        {
            Response.Redirect("error2.htm");
            return;
        }

        if (blnLogin == true)
        {
            Response.Redirect("index.aspx");
            return;
        }
        else
        {
            JS.alert("登录名或密码错误,请重输!");
            return;
        }
    }