Exemplo n.º 1
0
        private List <PhieuThuePhongVO> GetListPhieuThuePhongVO()
        {
            List <PhieuThuePhongVO> pttVOList = new List <PhieuThuePhongVO>();

            for (int i = 0; i < gridView_PhieuThuePhongChuaThanhToan.RowCount; i++)
            {
                PhieuThuePhongVO ptVO  = new PhieuThuePhongVO();
                DataRow          dtRow = gridView_PhieuThuePhongChuaThanhToan.GetDataRow(i);
                ptVO.MA_PHIEU = int.Parse(dtRow["MaP"].ToString().Substring(1));
                if (dtRow["MaKH"].ToString() != "")
                {
                    ptVO.MA_KHACH_HANG = int.Parse(dtRow["MaKH"].ToString().Substring(2));
                }
                if (dtRow["MaDK"].ToString() != "")
                {
                    ptVO.MA_DOAN_KHACH = int.Parse(dtRow["MaDK"].ToString().Substring(2));
                }
                ptVO.MA_PHONG        = int.Parse(dtRow["SO_PHONG"].ToString().Substring(2));
                ptVO.NGAY_NHAN_PHONG = DateTime.Parse(dtRow["NGAY_NHAN_PHONG"].ToString());
                if (dtRow["NGAY_TRA_PHONG"].ToString() != "")
                {
                    ptVO.NGAY_TRA_PHONG = DateTime.Parse(dtRow["NGAY_TRA_PHONG"].ToString());
                }
                else
                {
                    ptVO.NGAY_TRA_PHONG = DateTime.Now;
                }
                ptVO.GHI_CHU               = dtRow["GHI_CHU"].ToString();
                ptVO.THANH_TOAN_DICH_VU    = true;
                ptVO.THANH_TOAN_TIEN_PHONG = true;
                ptVO.DA_TRA_PHONG          = true;
                pttVOList.Add(ptVO);
            }
            return(pttVOList);
        }
Exemplo n.º 2
0
        // Created by G
        public int InsertBySP(PhieuThuePhongVO valueObject)
        {
            try
            {
                // Set procedure name
                String sp = "SP_INSERT_PHIEU_THUE_PHONG";

                // Create parameters
                SqlParameter[] param = new SqlParameter[5];

                // Return value
                param[0]           = new SqlParameter("@IDENTITY", valueObject.MA_PHIEU);
                param[0].Direction = ParameterDirection.Output;

                param[1] = new SqlParameter("@MA_KHACH_HANG", valueObject.MA_KHACH_HANG);
                param[2] = new SqlParameter("@MA_DOAN_KHACH", valueObject.MA_DOAN_KHACH);
                if (valueObject.MA_DOAN_KHACH == -1)
                {
                    param[2].Value = DBNull.Value;
                }
                param[3] = new SqlParameter("@MA_PHONG", valueObject.MA_PHONG);
                param[4] = new SqlParameter("@NGAY_NHAN_PHONG", valueObject.NGAY_NHAN_PHONG);

                return((int)Program.DBConnection.ExecuteSPReturnsID(sp, param));
            }//end try
            catch (Exception e)
            {
                throw e;
            } //end catch
        }     //end method InsertBySP
Exemplo n.º 3
0
        // Created by G
        public Int64 InsertBySP(PhieuThuePhongVO value)
        {
            try
            {
                // Set procedure name
                String sp = "SP_INSERT_PHIEU_THUE_PHONG";

                // Create parameters
                SqlParameter[] param = new SqlParameter[6];

                // Return value
                param[0]           = new SqlParameter("@IDENTITY", value.MA_PHIEU);
                param[0].Direction = ParameterDirection.Output;

                param[1] = new SqlParameter("@MA_KHACH_HANG", value.MA_KHACH_HANG);
                param[2] = new SqlParameter("@MA_DOAN_KHACH", value.MA_DOAN_KHACH);
                param[3] = new SqlParameter("@MA_PHONG", value.MA_PHONG);
                param[4] = new SqlParameter("@NGAY_NHAN_PHONG", value.NGAY_NHAN_PHONG);
                param[5] = new SqlParameter("@NGAY_TRA_PHONG", value.NGAY_TRA_PHONG);

                return(Program.DBConnection.ExecuteScalarByProcedure(sp, param));
            }//end try
            catch (Exception e)
            {
                throw e;
            } //end catch
        }     //end method InsertBySP
Exemplo n.º 4
0
 public int InsertAndGetID(PhieuThuePhongVO valueObject)
 {
     try {
         return(phieuthuephongDAO.InsertBySP(valueObject));
     }//end try
     catch {
         throw;
     } //end catch
 }     //end method InsertAndGetID
Exemplo n.º 5
0
 public int Update(PhieuThuePhongVO phieuthuephongVO)
 {
     try
     {
         return(phieuthuephongDAO.Update(phieuthuephongVO));
     }
     catch (SqlException e)
     {
         throw e;
     }
 }
Exemplo n.º 6
0
 public int Insert(PhieuThuePhongVO phieuthuephongVO)
 {
     try
     {
         return(phieuthuephongDAO.Insert(phieuthuephongVO));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 7
0
        private PhieuThuePhongVO GetPhieuThuePhongVO()
        {
            PhieuThuePhongVO phieuthuephongVO = new PhieuThuePhongVO();

            phieuthuephongVO.MA_PHIEU              = int.Parse(txt_MaPhieu.Text.Substring(1));
            phieuthuephongVO.MA_PHONG              = int.Parse(cbo_Phong.SelectedValue.ToString().Substring(2));
            phieuthuephongVO.GHI_CHU               = txt_GhiChu.Text;
            phieuthuephongVO.NGAY_NHAN_PHONG       = date_NgayNhan.DateTime;
            phieuthuephongVO.NGAY_TRA_PHONG        = date_NgayTra.DateTime;
            phieuthuephongVO.THANH_TOAN_TIEN_PHONG = chk_ThanhToanTienPhong.Checked;
            phieuthuephongVO.THANH_TOAN_DICH_VU    = chk_ThanhToanDichVU.Checked;
            if (cbo_KhachHang.Text != "")
            {
                phieuthuephongVO.MA_KHACH_HANG = int.Parse(cbo_KhachHang.SelectedValue.ToString().Substring(2));
            }
            if (cbo_DoanKhach.Text != "")
            {
                phieuthuephongVO.MA_DOAN_KHACH = int.Parse(cbo_DoanKhach.SelectedValue.ToString().Substring(2));
            }
            return(phieuthuephongVO);
        }
Exemplo n.º 8
0
        public int Insert(PhieuThuePhongVO phieuthuephongVO)
        {
            try
            {
                String         query         = "INSERT INTO PHIEU_THUE_PHONG (MA_KHACH_HANG,MA_DOAN_KHACH,MA_PHONG,NGAY_NHAN_PHONG,GHI_CHU,THANH_TOAN_TIEN_PHONG,THANH_TOAN_DICH_VU,DA_TRA_PHONG) VALUES(@MA_KHACH_HANG,@MA_DOAN_KHACH,@MA_PHONG,@NGAY_NHAN_PHONG,@GHI_CHU,@THANH_TOAN_TIEN_PHONG,@THANH_TOAN_DICH_VU,'False')";
                SqlParameter[] sqlParameters = new SqlParameter[7];
                sqlParameters[0] = new SqlParameter("@MA_KHACH_HANG", phieuthuephongVO.MA_KHACH_HANG);
                sqlParameters[1] = new SqlParameter("@MA_DOAN_KHACH", phieuthuephongVO.MA_DOAN_KHACH);
                sqlParameters[2] = new SqlParameter("@MA_PHONG", phieuthuephongVO.MA_PHONG);
                sqlParameters[3] = new SqlParameter("@NGAY_NHAN_PHONG", phieuthuephongVO.NGAY_NHAN_PHONG);
                sqlParameters[4] = new SqlParameter("@GHI_CHU", phieuthuephongVO.GHI_CHU);
                sqlParameters[5] = new SqlParameter("@THANH_TOAN_TIEN_PHONG", phieuthuephongVO.THANH_TOAN_TIEN_PHONG);
                sqlParameters[6] = new SqlParameter("@THANH_TOAN_DICH_VU", phieuthuephongVO.THANH_TOAN_DICH_VU);


                return(Program.DBConnection.ExecuteNonQuery(query, sqlParameters));
            }
            catch (Exception e)
            {
                throw e;
            }
        } //By zu~
Exemplo n.º 9
0
 public int Update(PhieuThuePhongVO phieuthuephongVO)
 {
     try
     {
         String         query         = "UPDATE PHIEU_THUE_PHONG SET MA_KHACH_HANG=@MA_KHACH_HANG,MA_DOAN_KHACH=@MA_DOAN_KHACH,MA_PHONG=@MA_PHONG,NGAY_NHAN_PHONG=@NGAY_NHAN_PHONG,NGAY_TRA_PHONG=@NGAY_TRA_PHONG,GHI_CHU=@GHI_CHU,THANH_TOAN_TIEN_PHONG=@THANH_TOAN_TIEN_PHONG,THANH_TOAN_DICH_VU=@THANH_TOAN_DICH_VU,DA_TRA_PHONG=@DA_TRA_PHONG WHERE MA_PHIEU=@MA_PHIEU";
         SqlParameter[] sqlParameters = new SqlParameter[10];
         sqlParameters[0] = new SqlParameter("@MA_KHACH_HANG", phieuthuephongVO.MA_KHACH_HANG);
         sqlParameters[1] = new SqlParameter("@MA_DOAN_KHACH", phieuthuephongVO.MA_DOAN_KHACH);
         sqlParameters[2] = new SqlParameter("@MA_PHONG", phieuthuephongVO.MA_PHONG);
         sqlParameters[3] = new SqlParameter("@NGAY_NHAN_PHONG", phieuthuephongVO.NGAY_NHAN_PHONG);
         sqlParameters[4] = new SqlParameter("@NGAY_TRA_PHONG", phieuthuephongVO.NGAY_TRA_PHONG);
         sqlParameters[5] = new SqlParameter("@GHI_CHU", phieuthuephongVO.GHI_CHU);
         sqlParameters[6] = new SqlParameter("@THANH_TOAN_TIEN_PHONG", phieuthuephongVO.THANH_TOAN_TIEN_PHONG);
         sqlParameters[7] = new SqlParameter("@THANH_TOAN_DICH_VU", phieuthuephongVO.THANH_TOAN_DICH_VU);
         sqlParameters[8] = new SqlParameter("@DA_TRA_PHONG", phieuthuephongVO.DA_TRA_PHONG);
         sqlParameters[9] = new SqlParameter("@MA_PHIEU", phieuthuephongVO.MA_PHIEU);
         return(Program.dbConnection.ExecuteNonQuery(query, sqlParameters));
     }
     catch (Exception e)
     {
         throw e;
     }
 }