コード例 #1
0
ファイル: ChiTietKhoa.cs プロジェクト: vohoanglong0107/PBL3_1
        private void cánBộGiảngViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CBGV f = new CBGV(_loginForm);

            this.Close();
            f.Show();
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            CBGV f = new CBGV(_loginForm);

            this.Close();
            f.Show();
        }
コード例 #3
0
        private void Update_button_Click(object sender, EventArgs e)
        {
            try
            {
                MemoryStream stream = new MemoryStream();
                byte[]       pic    = null;
                if (pictureBox3.Image != null)
                {
                    pictureBox3.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    pic = stream.ToArray();
                }
                DateTime NS; string MaBM;
                try
                {
                    NS = DateTime.Parse(NS_textBox.Text.Trim());
                }
                catch (Exception)
                {
                    throw new GV_Exception(GV_Exception.ExepEnum.NgaySinh);
                }

                try
                {
                    MaBM = ((BoMonCBB)mon_comboBox.SelectedItem).mon.MaBoMon;
                }
                catch (Exception)
                {
                    throw new GV_Exception(GV_Exception.ExepEnum.BoMon);
                }

                GIANG_VIEN gv = new GIANG_VIEN()
                {
                    HoTen       = HoTen_textBox.Text.Trim(),
                    GioiTinh    = GioiTinh_textBox.Text.Trim(),
                    Anh         = pic,
                    NgaySinh    = NS,
                    BangCap     = BangCap_textBox.Text.Trim(),
                    DiaChi      = DiaChi_textBox.Text.Trim(),
                    MaBoMon     = MaBM,
                    SoDienThoai = SDT_textBox.Text.Trim(),
                    Email       = email_textBox.Text.Trim(),
                };
                GVChecker.CheckGV(gv);
                if (MaGV != null)
                {
                    gv.MaGV = (int)MaGV;
                    BLL.Instance.EditDB(gv);
                }
                else
                {
                    BLL.Instance.AddDB(gv);
                }
                CBGV f = new CBGV(_loginForm);
                this.Close();
                f.Show();
            }
            catch (GV_Exception gvex)
            {
                MessageBox.Show("Xin hãy điền thông tin " +
                                GV_Exception.ThongBao[(int)gvex.Number].ToLower() +
                                " chính xác", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Xin hãy điền thông tin chính xác", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }