Ejemplo n.º 1
0
        private void InsertCa()
        {
            DTO_Ca ca = new DTO_Ca();

            //verified infor
            if (txtTenCa.Text == "")
            {
                MessageBox.Show("Tên ca còn trống. Vui lòng nhập lại.");
                txtTenCa.Focus();
                return;
            }
            //get infor to object
            ca.TenCa = txtTenCa.Text;

            DialogResult resultDialog = MessageBox.Show("Bạn có muốn lưu ca này lại không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (resultDialog == DialogResult.Yes)
            {
                bool InsertState = BUS_Ca.InsertCa(ca);
                if (InsertState)
                {
                    dgvTableShow.DataSource = BUS_Ca.GetDataTable();
                    SetDisplay(DISPLAY.HOME);
                    MessageBox.Show("Thêm thành công");
                }
                else
                {
                    MessageBox.Show("Thêm thất bại, thử lại");
                }
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            DTO_Ca ca = new DTO_Ca();

            //verified infor
            if (txtTenCa.Text == "")
            {
                MessageBox.Show("Thêm thất bại, tên ca còn trống");
                return;
            }
            //get infor to object
            ca.TenCa = txtTenCa.Text;

            DialogResult resultDialog = MessageBox.Show("Bạn có muốn thêm dữ liệu ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (resultDialog == DialogResult.Yes)
            {
                bool InsertState = BUS_Ca.InsertCa(ca);
                if (InsertState)
                {
                    dgvTableShow.DataSource = BUS_Ca.GetDataTable();
                    MessageBox.Show("Thêm thành công");
                }
                else
                {
                    MessageBox.Show("Thêm thất bại, thử lại");
                }
            }
            else
            {
                return;
            }
        }