Esempio n. 1
0
        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Hide();
            FCaLam fca = new FCaLam();

            fca.MdiParent = main;
            fca.main      = main;
            fca.Show();
        }
Esempio n. 2
0
        private void caLàmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form form = CheckTonTai(typeof(FCaLam));

            if (form != null)
            {
                form.Activate();
            }
            else
            {
                FCaLam newform = new FCaLam();
                newform.MdiParent = this;
                newform.main      = this;
                newform.Show();
            }
        }
Esempio n. 3
0
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            if (labTacVu.Text == "Thêm")
            {
                if (txtTenCa.Text != "")
                {
                    if (txtMaCa.Text != "")
                    {
                        try
                        {
                            //byte[] imageData = ReadFile(lbimgpath.Text);
                            CaLam.MaCa  = txtMaCa.Text;
                            CaLam.TenCa = txtTenCa.Text;
                            CaLam.MoTa  = txtMoTa.Text;
                            Act.AddCa(CaLam);
                            AutoID.UpdateAutoID(12);
                            MessageBox.Show("Đã Thêm Thành Công", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Mã không được để trống", "Chú Ý", MessageBoxButtons.OK);
                        txtMaCa.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Tên không được để trống", "Chú Ý", MessageBoxButtons.OK);
                    txtTenCa.Focus();
                }
            }
            else if (labTacVu.Text == "Sửa")
            {
                if (txtTenCa.Text != "")
                {
                    try
                    {
                        //byte[] imageData = ReadFile(lbimgpath.Text);
                        CaLam.MaCa  = txtMaCa.Text;
                        CaLam.TenCa = txtTenCa.Text;
                        CaLam.MoTa  = txtMoTa.Text;
                        Act.UpdateCa(CaLam);
                        MessageBox.Show("Đã Sửa Thành Công", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Mã Không được để trống", "Chú Ý", MessageBoxButtons.OK);
                    txtTenCa.Focus();
                }
            }
            else
            {
                try
                {
                    CaLam.MaCa  = txtMaCa.Text;
                    CaLam.TenCa = txtTenCa.Text;
                    CaLam.MoTa  = txtMoTa.Text;
                    Act.DeleteCa(CaLam);
                    MessageBox.Show("Đã Xóa Thành Công", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            this.Hide();
            FCaLam fca = new FCaLam();

            fca.MdiParent = main;
            fca.main      = main;
            fca.Show();
        }