Beispiel #1
0
        public bool updateVanDe(BKIT.Entities.VanDe objVanDe)
        {
            Database db         = DatabaseFactory.CreateDatabase();
            string   sqlCommand = "UPDATE VanDe SET Ten = @Ten, IDLoaiVD = @IDLoaiVD, Tien = @Tien,UserID = @UserID, Ghichu = @Ghichu, NgayCapNhat = @NgayCapNhat " +
                                  "WHERE IDVanDe = @IDVanDe";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

            try
            {
                db.AddInParameter(dbCommand, "Ten", DbType.String, objVanDe.Ten);
                db.AddInParameter(dbCommand, "IDLoaiVD", DbType.Int32, objVanDe.IDLoaiVD);
                db.AddInParameter(dbCommand, "Tien", DbType.Decimal, objVanDe.Tien);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, objVanDe.UserID);
                db.AddInParameter(dbCommand, "Ghichu", DbType.String, objVanDe.GhiChu);
                db.AddInParameter(dbCommand, "NgayCapNhat", DbType.DateTime, objVanDe.NgayCapNhat);

                db.AddInParameter(dbCommand, "IDVanDe", DbType.Int32, objVanDe.IDVanDe);
                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #2
0
        public int insertVanDe(BKIT.Entities.VanDe objVanDe)
        {
            Database db         = DatabaseFactory.CreateDatabase();
            string   sqlCommand = "INSERT INTO VanDe(IDVanDe,Ten,IDLoaiVD,Tien,UserID,Ghichu,NgayCapNhat) " +
                                  "VALUES (@IDVanDe,@Ten,@IDLoaiVD,@Tien,@UserID,@Ghichu,@NgayCapNhat)";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

            try
            {
                int ID = GetNextAVailableID();
                objVanDe.IDVanDe = ID;
                db.AddInParameter(dbCommand, "IDVanDe", DbType.Int32, objVanDe.IDVanDe);
                db.AddInParameter(dbCommand, "Ten", DbType.String, objVanDe.Ten);
                db.AddInParameter(dbCommand, "IDLoaiVD", DbType.Int32, objVanDe.IDLoaiVD);
                db.AddInParameter(dbCommand, "Tien", DbType.Decimal, objVanDe.Tien);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, objVanDe.UserID);
                db.AddInParameter(dbCommand, "Ghichu", DbType.String, objVanDe.GhiChu);
                db.AddInParameter(dbCommand, "NgayCapNhat", DbType.DateTime, objVanDe.NgayCapNhat);

                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return(ID);
            }
            catch
            {
                dbCommand.Connection.Close();
                return(-1);
            }
        }
Beispiel #3
0
        public bool deleteVanDe(BKIT.Entities.VanDe objVanDe)
        {
            Database  db         = DatabaseFactory.CreateDatabase();
            string    sqlCommand = "DELETE FROM VanDe WHERE IDVanDe = @idVanDe";
            DbCommand dbCommand  = db.GetSqlStringCommand(sqlCommand);

            try
            {
                db.AddInParameter(dbCommand, "idVanDe", DbType.Int32, objVanDe.IDVanDe);
                db.ExecuteNonQuery(dbCommand);
                dbCommand.Connection.Close();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTenGoiNho.Text))
            {
                MessageBox.Show("Nhập tên gợi nhớ cho ghi chú xử lý.");
                txtTenGoiNho.Focus();
                return;
            }
            if (string.IsNullOrEmpty(cboLoaiXuLy.Text))
            {
                MessageBox.Show("Chọn loại tình huống cho ghi chú xử lý.");
                cboLoaiXuLy.Focus();
                return;
            }
            VanDe objVande = new VanDe();

            objVande.GhiChu = txtGhiChu.Text;
            objVande.NgayCapNhat = DateTime.Now.Date;
            objVande.Ten = txtTenGoiNho.Text;
            objVande.IDLoaiVD = new DataAccess().getIDLoaiVDByTenLoaiVD(cboLoaiXuLy.Text);
            objVande.UserID = Program.IDNhanvien;
            if (!string.IsNullOrEmpty(txtTien.Text))
            {
                objVande.Tien = Convert.ToInt32(txtTien.Text);
            }
            if (new DataAccess().insertVanDe(objVande) >= 0)
            {
                MessageBox.Show("Thêm ghi chú thành công");
                this.Close();
            }
            else
            {
                MessageBox.Show("Thêm ghi chú không thành công");
                this.Close();
            }
        }
Beispiel #5
0
 public bool updateVanDe(VanDe objVanDe)
 {
     return new VanDeService().updateVanDe(objVanDe);
 }
Beispiel #6
0
 public int insertVanDe(VanDe objVanDe)
 {
     return new VanDeService().insertVanDe(objVanDe);
 }
Beispiel #7
0
 public bool deleteVanDe(VanDe objVanDe)
 {
     return new VanDeService().deleteVanDe(objVanDe);
 }