예제 #1
0
        private void btn_Edit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.btn_Ghi.Tag   = "EDIT";
            this.btn_Thoat.Tag = "EDIT";



            this.txtNgayThi.MinDate = DateTime.Now;
            DateTime currentDateTime = DateTime.Now;

            this.txtNgayThi.MaxDate = currentDateTime.AddDays(60);
            gcGVDK.Enabled          = false;

            vitri = bs_GVDK.Position;


            DataRowView current = (DataRowView)bs_GVDK.Current;

            String maMH  = current["MAMH"].ToString();
            String maLOP = current["MALOP"].ToString();
            int    lan   = Int16.Parse(current["LAN"].ToString());

            String daThi = SqlRequestFunction.GetRegisterExamed(maMH, maLOP, lan);

            if (daThi.Equals("X"))
            {
                MessageBox.Show("Phần đăng kí này đã thi rồi!!!", "", MessageBoxButtons.OK);
                set();
                return;
            }

            if (Program.mGroup.Equals("GIANGVIEN"))
            {
                magv1 = current["MAGV"].ToString();
                string m = magv1.Trim();
                if (m == magv)
                {
                    this.btn_Add.Enabled    = false;
                    this.btn_Edit.Enabled   = false;
                    this.btn_Delete.Enabled = false;
                    this.btn_Ghi.Enabled    = true;
                    this.btn_Reload.Enabled = false;
                    this.btn_Reset.Enabled  = false;
                    this.groupBox1.Enabled  = true;

                    this.txtMaMH.Enabled   = false;
                    this.txtMaLop.Enabled  = false;
                    this.txtLan.Enabled    = false;
                    this.txtMaLop1.Enabled = false;
                    this.txtMH2.Enabled    = false;

                    y    = current["SOCAUTHI"].ToString();
                    z    = current["TRINHDO"].ToString();
                    t    = Int16.Parse(current["LAN"].ToString());
                    t_do = 0;
                }
                else
                {
                    MessageBox.Show("Bạn không sửa phần đăng kí này!!!", "", MessageBoxButtons.OK);
                }
            }
            else
            {
                this.btn_Add.Enabled    = false;
                this.btn_Edit.Enabled   = false;
                this.btn_Delete.Enabled = false;
                this.btn_Ghi.Enabled    = true;
                this.btn_Reload.Enabled = false;
                this.btn_Reset.Enabled  = false;
                this.groupBox1.Enabled  = true;

                this.txtMaMH.Enabled   = false;
                this.txtMaLop.Enabled  = false;
                this.txtLan.Enabled    = false;
                this.txtMaLop1.Enabled = false;
                this.txtMH2.Enabled    = false;

                y    = current["SOCAUTHI"].ToString();
                z    = current["TRINHDO"].ToString();
                t    = Int16.Parse(current["LAN"].ToString());
                t_do = 0;
            }
        }