コード例 #1
0
        private void btnDanhsachPhongban_Click(object sender, EventArgs e)
        {
            PhongbanBUL cls = new PhongbanBUL();

            Report.frmBaoBieu.dt = cls.Danhsachphongban();
            Phongbanreport obj = new Phongbanreport();

            obj.SetDataSource(dt);
            crystalReportViewer1.ReportSource = obj;
            crystalReportViewer1.Refresh();
        }
コード例 #2
0
        private void frmPhongban_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 4; i++)
            {
                chuatextbox[i].Enabled = false;
            }
            PhongbanBUL cls = new PhongbanBUL();

            dataGridView1.DataSource = cls.Danhsachphongban();
            dataGridView1.AutoResizeColumns();
            btnOK.Enabled     = false;
            btnCancel.Enabled = false;
        }
コード例 #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (IorU == true)
            {
                try
                {
                    bool checklbl = true;
                    if (txtId.Text == "" && txtName.Text == "")
                    {
                        MessageBox.Show("Nhập giá trị cho phòng ban", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        checklbl = false;
                    }
                    if (checklbl == true)
                    {
                        PhongbanBUL    cls = new PhongbanBUL();
                        PhongbanPublic p   = new PhongbanPublic();
                        p.Mapb   = txtId.Text;
                        p.Tenpb  = txtName.Text;
                        p.Tenndn = txtInterest.Text;
                        p.Pass   = txtPass.Text;
                        cls.Themphongban(p);
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi, không thêm được");
                }
            }
            else if (IorU == false)
            {
                try
                {
                    PhongbanPublic p   = new PhongbanPublic();
                    PhongbanBUL    cls = new PhongbanBUL();
                    p.Mapb   = txtId.Text;
                    p.Tenpb  = txtName.Text;
                    p.Tenndn = txtInterest.Text;
                    p.Pass   = txtPass.Text;
                    cls.Suaphongban(p);

                    for (int i = 0; i < chuatextbox.Count(); i++)
                    {
                        chuatextbox[i].DataBindings.Clear();
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi, không sửa được");
                }
            }

            btnInsert.Enabled = true;
            btnUpdate.Enabled = true;

            for (int i = 0; i < 4; i++)
            {
                chuatextbox[i].Enabled = false;
                chuatextbox[i].Clear();
            }
            frmPhongban_Load(sender, e);
        }