示例#1
0
        public bool updateBaoCao(BCCongNoKH _baoCao)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("BCCONGNOKH_Update", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@ngayLap", SqlDbType.Date)).Value        = _baoCao.ngayLap;
                cmd.Parameters.Add(new SqlParameter("@maKH", SqlDbType.VarChar, 10)).Value    = _baoCao.maKH;
                cmd.Parameters.Add(new SqlParameter("@maNV", SqlDbType.VarChar, 10)).Value    = _baoCao.maNV;
                cmd.Parameters.Add(new SqlParameter("@noKyDau", SqlDbType.Int)).Value         = _baoCao.noKyDau;
                cmd.Parameters.Add(new SqlParameter("@phatSinh", SqlDbType.Int)).Value        = _baoCao.phatSinh;
                cmd.Parameters.Add(new SqlParameter("@noKyCuoi", SqlDbType.Int)).Value        = _baoCao.noKyCuoi;
                cmd.Parameters.Add(new SqlParameter("@ghiChu", SqlDbType.NVarChar, 10)).Value = _baoCao.ghiChu;

                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                cmd.ExecuteNonQuery();
                conn.Close();
                return(true);
            }
            catch (Exception e)
            {
                conn.Close();
                Console.WriteLine("Lỗi: " + e.Message);
                return(false);
            }
        }
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (checkUpdateInformation())
            {
                //XtraMessageBox.Show("Các thông tin đã hợp lệ");
                BCCongNoKH tempBaoCao = new BCCongNoKH(Convert.ToDateTime(tempNgayLap), tempMaKH, tempMaNV
                                                       , Convert.ToInt32(tempNoKyDau), Convert.ToInt32(tempPhatSinh), Convert.ToInt32(tempNoKyCuoi), tempGhiChu);
                bool updated = false;
                updated = UserControl_ListBCCongNoKH.objBCBus.updateBaoCao(tempBaoCao);
                if (updated)
                {
                    //XtraMessageBox.Show("Cập nhật thành công!");
                    UserControl_ListBCCongNoKH.Instance.loadDanhSachBaoCao();
                    UserControl_ListBCCongNoKH.Instance.BringToFront();
                    UserControl_ListBCCongNoKH.Instance.label_notification.Text = "Cập nhật thành công!";

                    //Enable/Disable các btn:
                    UserControl_ListButton_BCCongNoKH.Instance.btn_themMoi.Enabled = true;
                    UserControl_ListButton_BCCongNoKH.Instance.btn_Edit.Enabled    = false;
                    UserControl_ListButton_BCCongNoKH.Instance.btn_Xoa.Enabled     = false;
                }
                else
                {
                    XtraMessageBox.Show("Cập nhật không thành công!");
                }
            }
            else
            {
            }
        }
示例#3
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (checkAddNewInformation())
            {
                //XtraMessageBox.Show("Các thông tin đã hợp lệ");
                BCCongNoKH tempBaoCao = new BCCongNoKH(Convert.ToDateTime(tempNgayLap), tempMaKH, tempMaNV, Convert.ToInt32(tempNoKyDau), Convert.ToInt32(tempPhatSinh), Convert.ToInt32(tempNoKyCuoi), tempGhiChu);
                bool       inserted   = false;
                inserted = UserControl_ListBCCongNoKH.objBCBus.addBaoCao(tempBaoCao);
                if (inserted)
                {
                    Form parentForm = this.FindForm();
                    UserControl_ListBCCongNoKH.Instance.loadDanhSachBaoCao();
                    if (!((MainForm)parentForm).mainPanel.Controls.Contains(UserControl_ListBCCongNoKH.Instance))
                    {
                        ((MainForm)parentForm).mainPanel.Controls.Add(UserControl_ListBCCongNoKH.Instance);
                    }
                    UserControl_ListBCCongNoKH.Instance.BringToFront();

                    UserControl_ListBCCongNoKH.Instance.label_notification.Text = "Thêm thành công!";

                    //Enable/Disable các btn:
                    UserControl_ListButton_BCCongNoKH.Instance.btn_themMoi.Enabled = true;
                    UserControl_ListButton_BCCongNoKH.Instance.btn_Edit.Enabled    = false;
                    UserControl_ListButton_BCCongNoKH.Instance.btn_Xoa.Enabled     = false;
                }
                else
                {
                    XtraMessageBox.Show("Thêm không thành công!");
                }
            }
            else
            {
            }
        }
示例#4
0
 public bool updateBaoCao(BCCongNoKH baoCao)
 {
     return(objBCCN.updateBaoCao(baoCao));
 }
示例#5
0
 public bool addBaoCao(BCCongNoKH baoCao)
 {
     return(objBCCN.addBaoCao(baoCao));
 }