예제 #1
0
        private void SavePhongMon()
        {
            cBXL_PhongHoc_MonHoc   oBXL_PhongHoc_MonHoc    = new cBXL_PhongHoc_MonHoc();
            XL_PhongHoc_MonHocInfo pXL_PhongHoc_MonHocInfo = new XL_PhongHoc_MonHocInfo();

            pXL_PhongHoc_MonHocInfo.IDDM_MonHoc = pDM_MonHocInfo.DM_MonHocID;
            string[] arrPhong = strPhongThem.Split(',');
            foreach (string strIDPhongHoc in arrPhong)
            {
                pXL_PhongHoc_MonHocInfo.IDDM_PhongHoc = int.Parse(strIDPhongHoc);
                oBXL_PhongHoc_MonHoc.Add(pXL_PhongHoc_MonHocInfo);
            }
        }
예제 #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            int IDDM_PhongHoc;

            if (edit == EDIT_MODE.THEM)
            {
                for (int i = 0; i < grvPhong.DataRowCount; i++)
                {
                    if (bool.Parse(grvPhong.GetDataRow(i)["Chon"].ToString()) == true)
                    {
                        IDDM_PhongHoc = int.Parse(grvPhong.GetDataRow(i)["IDDM_PhongHoc"].ToString());
                        dtPhong.Rows.Remove(grvPhong.GetDataRow(i));
                        string[] arr = strPhongThem.Split(',');
                        strPhongThem = "";
                        for (int j = 0; j < arr.Length; j++)
                        {
                            if (arr[j] == IDDM_PhongHoc.ToString())
                            {
                                arr[j] = "";
                            }
                            else
                            {
                                strPhongThem += arr[j] + ",";
                            }
                        }
                    }
                }
                strPhongThem = strPhongThem.Substring(0, strPhongThem.Length - 1);
            }
            else
            {
                cBXL_PhongHoc_MonHoc oBXL_PhongHoc_MonHoc = new cBXL_PhongHoc_MonHoc();
                for (int i = 0; i < grvPhong.DataRowCount; i++)
                {
                    if (bool.Parse(grvPhong.GetDataRow(i)["Chon"].ToString()) == true)
                    {
                        IDDM_PhongHoc = int.Parse(grvPhong.GetDataRow(i)["IDDM_PhongHoc"].ToString());
                        oBXL_PhongHoc_MonHoc.DeleteByMonPhong(IDDM_PhongHoc, pDM_MonHocInfo.DM_MonHocID);
                        dtPhong.Rows.Remove(grvPhong.GetDataRow(i));
                    }
                }
            }
        }
예제 #3
0
 private void radiogroupSuDungPhong_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (radiogroupSuDungPhong.SelectedIndex == 2)
     {
         cBXL_PhongHoc_MonHoc oBXL_PhongHoc_MonHoc = new cBXL_PhongHoc_MonHoc();
         dtPhong             = oBXL_PhongHoc_MonHoc.GetByIDDM_MonHoc(pDM_MonHocInfo.DM_MonHocID);
         grdPhong.DataSource = dtPhong;
         grdPhong.Enabled    = true;
         if (Active == true)
         {
             btnThem.Enabled = true;
             btnXoa.Enabled  = true;
         }
     }
     else
     {
         grdPhong.DataSource = null;
         grdPhong.Enabled    = false;
         btnThem.Enabled     = false;
         btnXoa.Enabled      = false;
     }
 }