Example #1
0
 public NV_MoHinh_HinhThuc()
 {
     InitializeComponent();
     oMoHinhDaoTao = new MoHinhDaoTao();
     oHinhThucDaoTao = new HinhThucDaoTao();
     oBaoCao = new Business.BaoCao();
 }
Example #2
0
 public NV_MoHinh_HinhThuc()
 {
     InitializeComponent();
     oMoHinhDaoTao   = new MoHinhDaoTao();
     oHinhThucDaoTao = new HinhThucDaoTao();
     oBaoCao         = new Business.BaoCao();
 }
Example #3
0
        private void RefreshDataSource()
        {
            hinhthuc = new HinhThucDaoTao();
            DataTable dt = hinhthuc.GetHinhThucList();

            if (dt != null)
            {
                PrepareDataSource(dt);
                EditDtgInterface();
            }
        }
Example #4
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (dtgv_DSHinhThuc.CurrentRow != null)
     {
         if (MessageBox.Show("Bạn thực sự muốn xoá ngành này? TOÀN BỘ CÁC SINH VIÊN THUỘC NGÀNH NÀY SẼ BỊ XOÁ THEO.", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //vanbang = ToDepartmentObject(dtg_DepartmentList.CurrentRow);
             hinhthuc = new HinhThucDaoTao(Convert.ToInt16(dtgv_DSHinhThuc.CurrentRow.Cells[0].Value.ToString()));
             try
             {
                 hinhthuc.Delete();
                 RefreshDataSource();
                 MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return;
 }
Example #5
0
        bool AddFlag;   // xac dinh thao tac add hay edit

        public QLNS_HinhThucDaoTao()
        {
            InitializeComponent();
            hinhthuc = new HinhThucDaoTao();
        }
Example #6
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (txt_Ten.Text != "")
            {
                #region thao tac them
                if (AddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //Department = ToDepartmentObject();
                        int? id    = null;
                        bool saudh = false;
                        if (cb_SauDH.Checked == true)
                        {
                            saudh = true;
                        }
                        hinhthuc = new HinhThucDaoTao(id, txt_Ten.Text, saudh, rtb_MoTa.Text);
                        try
                        {
                            hinhthuc.Add();
                            MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
                #region thao tac sua
                else                // thao tac sua
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int  id    = Convert.ToInt16(dtgv_DSHinhThuc.CurrentRow.Cells[0].Value.ToString());
                        bool saudh = false;
                        if (cb_SauDH.Checked == true)
                        {
                            saudh = true;
                        }
                        hinhthuc = new HinhThucDaoTao(id, txt_Ten.Text, saudh, rtb_MoTa.Text);
                        try
                        {
                            hinhthuc.Update();
                            MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
            }
            else
            {
                MessageBox.Show("Tên ngành không được rỗng, xin vui lòng cung cấp tên ngành", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #7
0
 private void RefreshDataSource()
 {
     hinhthuc = new HinhThucDaoTao();
     DataTable dt = hinhthuc.GetHinhThucList();
     if (dt != null)
     {
         PrepareDataSource(dt);
         EditDtgInterface();
     }
 }
Example #8
0
        bool AddFlag;   // xac dinh thao tac add hay edit

        public QLNS_HinhThucDaoTao()
        {
            InitializeComponent();
            hinhthuc = new HinhThucDaoTao();
        }
Example #9
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (txt_Ten.Text != "")
            {
                #region thao tac them
                if (AddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //Department = ToDepartmentObject();
                        int? id = null;
                        bool saudh = false;
                        if (cb_SauDH.Checked == true)
                            saudh = true;
                        hinhthuc = new HinhThucDaoTao(id, txt_Ten.Text, saudh, rtb_MoTa.Text);
                        try
                        {
                            hinhthuc.Add();
                            MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }

                    }

                }
                #endregion
                #region thao tac sua
                else                // thao tac sua
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int id = Convert.ToInt16(dtgv_DSHinhThuc.CurrentRow.Cells[0].Value.ToString());
                        bool saudh = false;
                        if (cb_SauDH.Checked == true)
                            saudh = true;
                        hinhthuc = new HinhThucDaoTao(id, txt_Ten.Text, saudh, rtb_MoTa.Text);
                        try
                        {
                            hinhthuc.Update();
                            MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }

                    }
                }
                #endregion
            }
            else
                MessageBox.Show("Tên ngành không được rỗng, xin vui lòng cung cấp tên ngành", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Example #10
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (dtgv_DSHinhThuc.CurrentRow != null)
     {
         if (MessageBox.Show("Bạn thực sự muốn xoá ngành này? TOÀN BỘ CÁC SINH VIÊN THUỘC NGÀNH NÀY SẼ BỊ XOÁ THEO.", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //vanbang = ToDepartmentObject(dtg_DepartmentList.CurrentRow);
             hinhthuc = new HinhThucDaoTao(Convert.ToInt16(dtgv_DSHinhThuc.CurrentRow.Cells[0].Value.ToString()));
             try
             {
                 hinhthuc.Delete();
                 RefreshDataSource();
                 MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return;
 }