Example #1
0
 private void dataPC_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     if (dataPC.FocusedRowHandle >= 8)
     {
         FormPC pc = new FormPC(GetMABM(bomon));
         pc.ShowDialog();
         dataPC.SetFocusedRowCellValue("F12", pc.GetGV1());
         dataPC.SetFocusedRowCellValue("F13", pc.GetGV2());
         phancong(pc);
     }
 }
Example #2
0
        private void phancong(FormPC pc)
        {
            string mahp   = "";
            int    sotiet = 0;

            if (dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F2").ToString() == "")
            {
                int cur = dataPC.FocusedRowHandle;
                while (dataPC.GetRowCellValue(cur, "F2").ToString() == "")
                {
                    cur--;
                }
                mahp   = dataPC.GetRowCellValue(cur, "F2").ToString();
                sotiet = Convert.ToInt32(dataPC.GetRowCellValue(cur, "F6"));
            }
            else
            {
                mahp   = dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F2").ToString();
                sotiet = Convert.ToInt32(dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F6"));
            }
            string       magv1    = pc.GetMAGV1();
            string       magv2    = pc.GetMAGV2();
            string       kip      = dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F8").ToString();
            string       malop    = GetMALHP(mahp, dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F10").ToString());
            string       diadiem  = dataPC.GetRowCellValue(dataPC.FocusedRowHandle, "F11").ToString();
            string       ky       = dataPC.GetRowCellValue(2, "BẢNG PHÂN CÔNG GIẢNG DẠY").ToString();
            string       nam      = dataPC.GetRowCellValue(2, "F6").ToString();
            DAL_PHANCONG phancong = new DAL_PHANCONG(malop, magv1, magv2, kip, diadiem, sotiet, ky, nam);

            DAO_PC.Delete_PC(phancong);
            int dem = 0;

            try
            {
                int check2 = DAO_PC.Insert_PC(phancong);
                if (check2 == 0)
                {
                    MessageBox.Show("Không thêm được dòng này");
                    dem++;
                }
            }
            catch
            {
                MessageBox.Show("Lỗi cập nhật");
                dem++;
            }
            finally
            {
                Display_sotietday();
            }
        }