Beispiel #1
0
        public frmHocSinh()
        {
            InitializeComponent();
            var dg = new HocSinhController();

            loadcbb();
            ShowView(dg.DetailView());
            IsAdmin(ConstantCommon.QUYEN);
        }
Beispiel #2
0
        private void btnDelDoctor_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Chắc chắn muốn bản ghi không?", "Xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                long id     = Convert.ToInt64(txtIDHocSinh.Text);
                var  entity = new HocSinhController();
                if (entity.Del(id))
                {
                    ShowView(entity.DetailView());
                }
                else
                {
                    MessageBox.Show("Lỗi");
                }
            }
        }
Beispiel #3
0
        private void btnSaveDoctor_Click(object sender, EventArgs e)
        {
            if (Them_bool == true && Sua_bool == false)
            {
                var entity = new HocSinh();
                entity.TenHS    = txtTenHocSinh.Text;
                entity.GioiTinh = cbbGenderHocSinh.Text == "Nam" ? true : false;
                entity.NgaySinh = dtpDateHocSinh.Value;
                entity.Lophc    = Convert.ToInt64(cbbLopHocSinh.SelectedValue);

                var  dg  = new HocSinhController();
                long ijk = dg.Add(entity);
                if (ijk > 0)
                {
                    ShowView(dg.DetailView());
                }
                else
                {
                    MessageBox.Show("Thêm bản ghi không thành công");
                }
                add(false);
            }
            ///sua hoc sinh
            if (Them_bool == false && Sua_bool == true)
            {
                var entity = new HocSinh();
                entity.ID       = Convert.ToInt32(txtIDHocSinh.Text);
                entity.TenHS    = txtTenHocSinh.Text;
                entity.GioiTinh = cbbGenderHocSinh.Text == "Nam" ? true : false;
                entity.NgaySinh = dtpDateHocSinh.Value;
                entity.Lophc    = Convert.ToInt64(cbbLopHocSinh.SelectedValue);
                var dg = new HocSinhController();
                if (dg.Edit(entity))
                {
                    ShowView(dg.DetailView());
                }
                else
                {
                    MessageBox.Show("Sửa bản ghi không thành công");
                }
            }
            btn_enable(false);
        }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            HocSinhController dtc = new HocSinhController();

            ShowView(dtc.DetailView());
        }