예제 #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                txtDepartmentName.Text = "";
                OnDutyTime = "";
                OffDutyTime = "";

                SqlDataReader dr;

                //�õ�����ID
                DeptID=(Request.QueryString["DeptID"]==null?0:Int32.Parse(Request.QueryString["DeptID"].ToString()));

                UDS.Components.Department dp = new UDS.Components.Department();

                dr = dp.GetDepartmentInfo(DeptID);

                if(dr.Read())
                {
                    DepartmentName = dr["Department_Name"].ToString();
                    DepartmentDescription = dr["Department_Description"].ToString();
                }

                dr.Close();

                dr = dp.GetDepartmentDutyTime(DeptID);
                if(dr.Read())
                {
                    OnDutyTime = DateTime.Parse(dr["OnDutyTime"].ToString()).ToShortTimeString();
                    OffDutyTime = DateTime.Parse(dr["OffDutyTime"].ToString()).ToShortTimeString();
                }

                if(Request.QueryString["DisplayType"] !=null)
                    DisplayType = Int32.Parse(Request.QueryString["DisplayType"].ToString());
                else
                    DisplayType = 0;
                // ��ʾ��ͬ���
                switch(DisplayType)
                {
                    case 0:
                        tabAdd.Visible = true;
                        tabDelete.Visible = false;
                        tabModify.Visible = false;
                        tabMove.Visible =false;

                        lbAddDepartment.BackColor = Color.FromArgb(0xf0f0f0);
                        lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbMoveDepartment.BackColor  = Color.FromArgb(0xffffff);

                        addDepartmentName.Text = DepartmentName;
                        break;
                    case 1:
                        tabAdd.Visible = false;
                        tabDelete.Visible = true;
                        tabModify.Visible = false;
                        tabMove.Visible =false;
                        lbAddDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbDeleteDepartment.BackColor = Color.FromArgb(0xf0f0f0);
                        lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbMoveDepartment.BackColor  = Color.FromArgb(0xffffff);

                        delDepartmentName.Text  = DepartmentName;
                        break;
                    case 2:
                        tabAdd.Visible = false;
                        tabDelete.Visible = false;
                        tabModify.Visible = true;
                        tabMove.Visible =false;

                        txtDepartmentName.Text = DepartmentName;
                        txtMDepartmentRemark.Text = DepartmentDescription;

                        lbAddDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbModifyDepartment.BackColor = Color.FromArgb(0xf0f0f0);
                        lbMoveDepartment.BackColor  = Color.FromArgb(0xffffff);

                        txtuOnDutyTime.Text  = OnDutyTime;
                        txtuOffDutyTime.Text  = OffDutyTime;
                        break;
                    case 3:
                        tabAdd.Visible = false;
                        tabDelete.Visible = false;
                        tabModify.Visible = false;
                        tabMove.Visible =true;

                        lbAddDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                        lbMoveDepartment.BackColor  = Color.FromArgb(0xf0f0f0);

                        lblDepartment.Text = DepartmentName;
                        BindDepartment();
                        break;
                    default:
                        break;
                }

            }
        }
예제 #2
0
        private static string OffDutyTime = "";                   //下班时间

        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                txtDepartmentName.Text = "";
                OnDutyTime             = "";
                OffDutyTime            = "";

                SqlDataReader dr;

                //得到部门ID
                DeptID = (Request.QueryString["DeptID"] == null?0:Int32.Parse(Request.QueryString["DeptID"].ToString()));

                UDS.Components.Department dp = new UDS.Components.Department();

                dr = dp.GetDepartmentInfo(DeptID);

                if (dr.Read())
                {
                    DepartmentName        = dr["Department_Name"].ToString();
                    DepartmentDescription = dr["Department_Description"].ToString();
                }

                dr.Close();

                dr = dp.GetDepartmentDutyTime(DeptID);
                if (dr.Read())
                {
                    OnDutyTime  = DateTime.Parse(dr["OnDutyTime"].ToString()).ToShortTimeString();
                    OffDutyTime = DateTime.Parse(dr["OffDutyTime"].ToString()).ToShortTimeString();
                }

                if (Request.QueryString["DisplayType"] != null)
                {
                    DisplayType = Int32.Parse(Request.QueryString["DisplayType"].ToString());
                }
                else
                {
                    DisplayType = 0;
                }
                // 显示不同表格
                switch (DisplayType)
                {
                case 0:
                    tabAdd.Visible    = true;
                    tabDelete.Visible = false;
                    tabModify.Visible = false;
                    tabMove.Visible   = false;

                    lbAddDepartment.BackColor    = Color.FromArgb(0xf0f0f0);
                    lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbMoveDepartment.BackColor   = Color.FromArgb(0xffffff);

                    addDepartmentName.Text = DepartmentName;
                    break;

                case 1:
                    tabAdd.Visible               = false;
                    tabDelete.Visible            = true;
                    tabModify.Visible            = false;
                    tabMove.Visible              = false;
                    lbAddDepartment.BackColor    = Color.FromArgb(0xffffff);
                    lbDeleteDepartment.BackColor = Color.FromArgb(0xf0f0f0);
                    lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbMoveDepartment.BackColor   = Color.FromArgb(0xffffff);

                    delDepartmentName.Text = DepartmentName;
                    break;

                case 2:
                    tabAdd.Visible    = false;
                    tabDelete.Visible = false;
                    tabModify.Visible = true;
                    tabMove.Visible   = false;

                    txtDepartmentName.Text    = DepartmentName;
                    txtMDepartmentRemark.Text = DepartmentDescription;

                    lbAddDepartment.BackColor    = Color.FromArgb(0xffffff);
                    lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbModifyDepartment.BackColor = Color.FromArgb(0xf0f0f0);
                    lbMoveDepartment.BackColor   = Color.FromArgb(0xffffff);

                    txtuOnDutyTime.Text  = OnDutyTime;
                    txtuOffDutyTime.Text = OffDutyTime;
                    break;

                case 3:
                    tabAdd.Visible    = false;
                    tabDelete.Visible = false;
                    tabModify.Visible = false;
                    tabMove.Visible   = true;

                    lbAddDepartment.BackColor    = Color.FromArgb(0xffffff);
                    lbDeleteDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbModifyDepartment.BackColor = Color.FromArgb(0xffffff);
                    lbMoveDepartment.BackColor   = Color.FromArgb(0xf0f0f0);

                    lblDepartment.Text = DepartmentName;
                    BindDepartment();
                    break;

                default:
                    break;
                }
            }
        }