Example #1
0
        public static List <ResortManagerDTO.DTO.CTPhieuTra> LayCTPTtheoMaCTGD(out ResortManagerDTO.DTO.DbAck ack, int MaCTGD)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@maCTGD", MaCTGD)
            };
            dt = provider.Select(CommandType.StoredProcedure, "usp_LayCTPTtheoMaCTGD", out ack, para);
            List <ResortManagerDTO.DTO.CTPhieuTra> lstItem = new List <ResortManagerDTO.DTO.CTPhieuTra>();

            if (dt == null)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                ResortManagerDTO.DTO.CTPhieuTra item = new ResortManagerDTO.DTO.CTPhieuTra();
                item.MACHITIET   = int.Parse(row["MACHITIET"].ToString());
                item.MABOITHUONG = row["MABOITHUONG"].ToString();
                item.SOLUONG     = int.Parse(row["SOLUONG"].ToString());
                item.MAPHIEUTRA  = int.Parse(row["MAPHIEUTRA"].ToString());
                lstItem.Add(item);
            }
            provider.Disconnect();
            return(lstItem);
        }
Example #2
0
        public static ResortManagerDTO.DTO.DbAck UpdateStatus(String maphong, string MaDoan)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck ack = provider.Connect();
            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network;
            }
            DataTable    dt = new DataTable();
            SqlParameter x  = new SqlParameter("@kq", SqlDbType.Int);

            x.Direction = ParameterDirection.Output;
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@maphong", maphong),
                new SqlParameter("@maDoan", MaDoan),
                x
            };
            ack = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_CapNhatTinhTrangPhong", para);
            if (Convert.ToInt32(x.Value) == -1)
            {
                ack = ResortManagerDTO.DTO.DbAck.LostUpdate;
            }
Network:
            return(ack);
        }
Example #3
0
        public static List <ResortManagerDTO.DTO.BoiThuong> SelectListItem(out ResortManagerDTO.DTO.DbAck ack)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            dt = provider.Select(CommandType.StoredProcedure, "usp_LayDachSachVatDung", out ack, null);
            List <ResortManagerDTO.DTO.BoiThuong> lstItem = new List <ResortManagerDTO.DTO.BoiThuong>();

            if (dt == null)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                ResortManagerDTO.DTO.BoiThuong item = new ResortManagerDTO.DTO.BoiThuong();
                item.MABOITHUONG = row["MABOITHUONG"].ToString();
                item.MOTA        = row["MOTA"].ToString();
                item.SOTIEN      = int.Parse(row["SOTIEN"].ToString());
                lstItem.Add(item);
            }
            provider.Disconnect();
            return(lstItem);
        }
        private void frmBoiThuong_Load(object sender, EventArgs e)
        {
            txtNum.Text = "1";
            ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
            this.lstItem = ResortManagerBUS.BUS.BoiThuong.SelectListItem(out ack).ToList <ResortManagerDTO.DTO.BoiThuong>();
            foreach (ResortManagerDTO.DTO.BoiThuong item in lstItem)
            {
                cmbItem.Items.Add(item.MOTA);
            }

            List <ResortManagerDTO.DTO.CTPhieuTra> CTPTcuaKH = new List <ResortManagerDTO.DTO.CTPhieuTra>();

            CTPTcuaKH = ResortManagerBUS.BUS.CTPhieuTra.LayCTPTtheoMaCTGD(out ack, this.MaCTGD);
            if (CTPTcuaKH.Count > 0)
            {
                foreach (ResortManagerDTO.DTO.CTPhieuTra ct in CTPTcuaKH)
                {
                    foreach (ResortManagerDTO.DTO.BoiThuong item in this.lstItem)
                    {
                        if (ct.MABOITHUONG.Trim() == item.MABOITHUONG.Trim())
                        {
                            dgvLst.Rows.Add(new String[4] {
                                item.MABOITHUONG.Trim(), item.MOTA.Trim(), item.SOTIEN.ToString(), ct.SOLUONG.ToString()
                            });
                            this.PhiBoiThuong += (item.SOTIEN * ct.SOLUONG);
                            break;
                        }
                    }
                }
            }
        }
        private void dgvLst_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                DataRow row = ((senderGrid.DataSource) as DataTable).Rows[e.RowIndex];
                ResortManagerDTO.DTO.DatChoRecord datcho = new ResortManagerDTO.DTO.DatChoRecord();
                datcho.MaDoan      = row["MADOAN"].ToString();
                datcho.HoTen       = row["HOTEN"].ToString();
                datcho.CMND        = row["CMND"].ToString();
                datcho.MaPhong     = row["MAPHONG"].ToString();
                datcho.MaCT        = Int32.Parse(row["MACHITIET"].ToString());
                datcho.NgayBatDau  = DateTime.Parse(row["NGAYBATDAU"].ToString());
                datcho.NgayKetThuc = DateTime.Parse(row["NGAYKETTHUC"].ToString());
                datcho.Gia         = Int32.Parse(row["GIA"].ToString());
                datcho.ThanhTien   = Int32.Parse(row["THANHTIEN"].ToString());

                ResortManagerDTO.DTO.DbAck ck = ResortManagerBUS.BUS.DatChoRecord.DeleleteDatCho(datcho);
                if (ck == ResortManagerDTO.DTO.DbAck.Ok)
                {
                    MessageBox.Show("Xóa thành công");
                    LoadGrid();
                }
                else if (ck == ResortManagerDTO.DTO.DbAck.NetworkError)
                {
                    MessageBox.Show("Lỗi kết nối", "Thông báo");
                }
                else
                {
                    MessageBox.Show("Lỗi không xác định", "Thông báo");
                }
            }
        }
Example #6
0
        public static List <String> SelectTypeRoom(out ResortManagerDTO.DTO.DbAck ack)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            dt = provider.Select(CommandType.StoredProcedure, "usp_LayDanhSachLoaiPhong", out ack, null);
            List <String> lstTypeRoom = new List <String>();

            if (dt == null)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                lstTypeRoom.Add(row["HINHTHUC"].ToString());
            }
            provider.Disconnect();
            return(lstTypeRoom);
        }
Example #7
0
        public static String GetPriceByValidate(out ResortManagerDTO.DTO.DbAck ack, String lavel, String type)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@hang", lavel),
                new SqlParameter("@hinhthuc", type)
            };
            dt = provider.Select(CommandType.StoredProcedure, "usp_LayGiaPhong", out ack, para);
            List <String> lstTypeRoom = new List <String>();

            if (dt == null)
            {
                return(null);
            }
            provider.Disconnect();
            return(dt.Rows[0]["GIA"].ToString());
        }
Example #8
0
        public DataTable Select(CommandType _cmdType, String _strSql, out ResortManagerDTO.DTO.DbAck ack, params SqlParameter[] _parameters)
        {
            try
            {
                SqlCommand _command = Connection.CreateCommand();
                _command.CommandText = _strSql;
                _command.CommandType = _cmdType;
                if (_parameters != null && _parameters.Length > 0)
                {
                    _command.Parameters.AddRange(_parameters);
                }
                SqlDataAdapter da = new SqlDataAdapter(_command);
                DataTable      dt = new DataTable();

                da.Fill(dt);
                ack = ResortManagerDTO.DTO.DbAck.Ok;
                return(dt);
            }
            catch (SqlException ex)
            {
                if (ex.Procedure == "" && _cmdType != CommandType.Text)
                {
                    //day la loi khong tim thay proce..
                    ack = (ResortManagerDTO.DTO.DbAck)ResortManagerDTO.DTO.EnumUtils.SetstringValueOf(ResortManagerDTO.DTO.DbAck.MethoodNotFound, ex.Message.ToString());
                }
                else
                {
                    // loi khong xac dinh
                    ack = (ResortManagerDTO.DTO.DbAck)ResortManagerDTO.DTO.EnumUtils.SetstringValueOf(ResortManagerDTO.DTO.DbAck.Unknown, ex.Message.ToString());
                }
                return(null);
            }
        }
Example #9
0
        public static List <ResortManagerDTO.DTO.TaiKhoan> SelectLoginUser(out ResortManagerDTO.DTO.DbAck ack)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            dt = provider.Select(CommandType.StoredProcedure, "SelectLoginUser", out ack, null);
            List <ResortManagerDTO.DTO.TaiKhoan> lstUser = new List <ResortManagerDTO.DTO.TaiKhoan>();

            if (dt == null)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                ResortManagerDTO.DTO.TaiKhoan user = new ResortManagerDTO.DTO.TaiKhoan
                {
                    TenTaiKhoan = row["TENTAIKHOAN"].ToString(),
                    MatKhau     = row["MATKHAU"].ToString(),
                    MaDoan      = row["MADOAN"].ToString()
                };

                lstUser.Add(user);
            }
            provider.Disconnect();
            return(lstUser);
        }
Example #10
0
        private void btnJoinRoom_Click(object sender, EventArgs e)
        {
            ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
            String strIdRoom = cmbRoom.SelectedItem.ToString().Split('-')[0];

            ResortManagerDTO.DTO.CTGiaoDich ctgd = new ResortManagerDTO.DTO.CTGiaoDich();
            for (int i = 0; i < dgvLst.Rows.Count; i++)
            {
                ctgd.CMND    = dgvLst.Rows[i].Cells[0].Value.ToString().Trim();
                ctgd.MADOAN  = this.MaDoan;
                ctgd.MAPHONG = strIdRoom;
                ack          = ResortManagerBUS.BUS.CTGiaoDich.ThemCTGD(ctgd);
                if (ack != ResortManagerDTO.DTO.DbAck.Ok)
                {
                    MessageBox.Show("Thêm CTGD thất bại");
                    return;
                }
                String MaCTGD = ResortManagerBUS.BUS.CTGiaoDich.LayMaCTDG(out ack, ctgd.CMND);
                ack = ResortManagerBUS.BUS.PhieuTra.ThemPhieuTra(MaCTGD);
                if (ack != ResortManagerDTO.DTO.DbAck.Ok)
                {
                    MessageBox.Show("Thêm PHIEUTRA thất bại");
                    return;
                }
            }
            txtCMND_TV1.Text = "";
            dgvLst.Rows.Clear();
            cmbRoom.Items.Remove(cmbRoom.SelectedItem);
            cmbRoom.SelectedIndex = -1;
        }
Example #11
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
            string maGiaoDich = txtMaGiaoDich.Text;
            List <ResortManagerDTO.DTO.DanhSachNhanPhong> lstNhanPhong = ResortManagerBUS.BUS.DanhSachNhanPhong.getListNhanPhong(out ack, maGiaoDich);

            InitTable(lstNhanPhong);
        }
Example #12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < this.lstCTPT.Count; i++)
     {
         ResortManagerDTO.DTO.DbAck ack = ResortManagerBUS.BUS.CTPhieuTra.ThemCTPT(this.lstCTPT[i], this.MaCTGD);
     }
     this.Dispose();
     this.Close();
 }
Example #13
0
 private void cmbCatRoom_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbCatRoom.SelectedIndex > -1 && cmbLever.SelectedIndex > -1)
     {
         ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
         String price = ResortManagerBUS.BUS.LoaiPhong.GetPriceByValidate(out ack, cmbLever.SelectedItem.ToString(), cmbCatRoom.SelectedItem.ToString());
         txtPrice.Text = price;
     }
 }
Example #14
0
 private void cmbItem_SelectedIndexChanged(object sender, EventArgs e)
 {
     ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
     foreach (ResortManagerDTO.DTO.BoiThuong item in this.lstItem)
     {
         if (item.MOTA == cmbItem.SelectedItem.ToString())
         {
             txtPrice.Text = item.SOTIEN.ToString();
             break;
         }
     }
 }
Example #15
0
 private void dtbNhanPhong_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
     if (e.ColumnIndex == 5)
     {
         string maPhong    = this.dtbNhanPhong.Rows[e.RowIndex].Cells[0].Value.ToString();
         string maGiaoDich = txtMaGiaoDich.Text;
         ResortManagerBUS.BUS.DanhSachNhanPhong.UpdateStatus(out ack, maPhong);
         List <ResortManagerDTO.DTO.DanhSachNhanPhong> lstNhanPhong = ResortManagerBUS.BUS.DanhSachNhanPhong.getListNhanPhong(out ack, maGiaoDich);
         InitTable(lstNhanPhong);
     }
 }
Example #16
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (txtIdRoom.Text.Trim() != "")
     {
         dgvLst.Rows.Clear();
         ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
         this.DS_CTGD = ResortManagerBUS.BUS.CTGiaoDich.SelectByIdRoom(out ack, txtIdRoom.Text.ToUpper());
         foreach (ResortManagerDTO.DTO.CTGiaoDich item in this.DS_CTGD)
         {
             dgvLst.Rows.Add(new String[8] {
                 item.HOTEN, item.MADOAN.Trim(), item.CMND.Trim(), item.GIA.ToString(), "0", item.GIA.ToString(), "Trả phòng", "Thêm BT"
             });
         }
     }
 }
        public static void UpdateStatus(out ResortManagerDTO.DTO.DbAck ack, String maphong)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return;
            }
            DataTable dt = new DataTable();

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MaPhong", maphong)
            };
            provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_CapNhatTinhTrangCoKhach", para);
        }
Example #18
0
        public static ResortManagerDTO.DTO.DbAck TaoMaDoan(out String id)
        {
            Provider pr = new Provider();

            ResortManagerDTO.DTO.DbAck ack = pr.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                id = null;
                return(ack);
            }
            SqlParameter p = new SqlParameter("@MaDoan", SqlDbType.NChar, 30);

            p.Direction = ParameterDirection.Output;
            ack         = pr.ExcuteNonQuery(CommandType.StoredProcedure, "usp_PhatSinhMaDoan", p);
            id          = Convert.ToString(p.Value);
            pr.Disconnect();
            return(ack);
        }
Example #19
0
        public static ResortManagerDTO.DTO.DbAck ThemPhieuTra(String MaCTGD)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@maCTGD", MaCTGD)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_ThemPhieuTra", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #20
0
        public static List <ResortManagerDTO.DTO.DatChoRecord> SelectDatCho(out ResortManagerDTO.DTO.DbAck ack, String MaDoan)
        {
            Provider provider = new Provider();

            ack = provider.Connect();
            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                return(null);
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MADOAN", MaDoan)
            };
            DataTable dt = new DataTable();

            dt = provider.Select(CommandType.StoredProcedure, "SelectDatCho", out ack, para);
            List <ResortManagerDTO.DTO.DatChoRecord> lstDatCho = new List <ResortManagerDTO.DTO.DatChoRecord>();

            if (dt == null)
            {
                return(null);
            }
            foreach (DataRow row in dt.Rows)
            {
                ResortManagerDTO.DTO.DatChoRecord datcho = new ResortManagerDTO.DTO.DatChoRecord
                {
                    MaCT        = Int32.Parse(row["MACHITIET"].ToString()),
                    MaDoan      = row["MADOAN"].ToString(),
                    HoTen       = row["HOTEN"].ToString(),
                    CMND        = row["CMND"].ToString(),
                    MaPhong     = row["MAPHONG"].ToString(),
                    NgayBatDau  = DateTime.Parse(row["NGAYBATDAU"].ToString()),
                    NgayKetThuc = DateTime.Parse(row["NGAYKETTHUC"].ToString()),
                    Gia         = Int32.Parse(row["GIA"].ToString()),
                    ThanhTien   = Int32.Parse(row["THANHTIEN"].ToString())
                };

                lstDatCho.Add(datcho);
            }
            provider.Disconnect();
            return(lstDatCho);
        }
Example #21
0
        public static ResortManagerDTO.DTO.DbAck DeleteDatCho(ResortManagerDTO.DTO.DatChoRecord a)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network;
            }

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@MACHITIET", a.MaCT),
                new SqlParameter("@MADOAN", a.MaDoan)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "DeleteDatCho", para);
            provider.Disconnect();
Network:
            return(result);
        }
Example #22
0
        public static ResortManagerDTO.DTO.DbAck CheckExchage()
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }

            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "CheckGiaoDich", null);
            if (result == ResortManagerDTO.DTO.DbAck.Ok)
            {
                Console.WriteLine("OK!");
            }
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #23
0
        private void btnDat10_Click(object sender, EventArgs e)
        {
            ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
            for (int i = 0; i < dgvLst.RowCount; i++)
            {
                ack = ResortManagerBUS.BUS.Phong.Err10SCapNhatTinhTrangPhong(dgvLst[1, i].Value.ToString(), this.MaDoan);
                this.lstRoom.Add(dgvLst[1, i].Value.ToString().Trim() + "-" + cmbCatRoom.SelectedItem.ToString());
            }

            if (ack == ResortManagerDTO.DTO.DbAck.Ok)
            {
                MessageBox.Show("Đặt phòng thành công");
                this.ResetControl();
            }
            else if (ack == ResortManagerDTO.DTO.DbAck.LostUpdate)
            {
                MessageBox.Show("Người đến sau");
                this.ResetControl();
            }
        }
Example #24
0
        public static ResortManagerDTO.DTO.DbAck CapNhatPhieuTraTheoMaCTGD(int MaCTGD, int TongTien)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@maCTGD", MaCTGD),
                new SqlParameter("@tongTien", TongTien),
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_CapNhatPhieuTraTheoMaCTGD", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #25
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     foreach (ResortManagerDTO.DTO.BoiThuong item in this.lstItem)
     {
         if (item.MOTA == cmbItem.SelectedItem.ToString())
         {
             ResortManagerDTO.DTO.DbAck ack = new ResortManagerDTO.DTO.DbAck();
             dgvLst.Rows.Add(new String[4] {
                 item.MABOITHUONG.Trim(), item.MOTA.Trim(), item.SOTIEN.ToString(), txtNum.Text.Trim()
             });
             ResortManagerDTO.DTO.CTPhieuTra ctpt = new ResortManagerDTO.DTO.CTPhieuTra();
             ctpt.MABOITHUONG = item.MABOITHUONG;
             ctpt.SOLUONG     = int.Parse(txtNum.Text);
             ctpt.MAPHIEUTRA  = ResortManagerBUS.BUS.CTPhieuTra.LayMaPhieuTraTheoMaCTGD(out ack, this.MaCTGD);
             this.lstCTPT.Add(ctpt);
             this.PhiBoiThuong += (item.SOTIEN * int.Parse(txtNum.Text.Trim()));
             break;
         }
     }
 }
Example #26
0
        public static ResortManagerDTO.DTO.DbAck ThemCTPT(ResortManagerDTO.DTO.CTPhieuTra ctpt, int maCTGD)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@maCTGD", maCTGD),
                new SqlParameter("@maBT", ctpt.MABOITHUONG),
                new SqlParameter("@soluong", ctpt.SOLUONG)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_ThemCTPT", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #27
0
        public static ResortManagerDTO.DTO.DbAck ThemThanhVien(ResortManagerDTO.DTO.ThanhVien tv)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@CMND", tv.CMND),
                new SqlParameter("@HoTen", tv.HoTen),
                new SqlParameter("@MaDoan", tv.MaDoan)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_ThemThanhVien", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #28
0
        public static bool CheckLog(string user, string pass)
        {
            ResortManagerDTO.DTO.DbAck           ack      = new  ResortManagerDTO.DTO.DbAck();
            List <ResortManagerDTO.DTO.TaiKhoan> lstLogin = ResortManagerBUS.BUS.TaiKhoan.SelectLoginUser(out ack);

            if (ack == ResortManagerDTO.DTO.DbAck.NetworkError || lstLogin == null) // chỗ này tài khoản chưa được tạo..
            {
                return(false);
            }
            for (int i = 0; i < lstLogin.Count; i++)
            {
                if (lstLogin[i].TenTaiKhoan.Trim() == user)
                {
                    if (lstLogin[i].MatKhau.Trim() == pass)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #29
0
        public static ResortManagerDTO.DTO.DbAck ErrThemChiTietGiaoDich(ResortManagerDTO.DTO.CTGiaoDich ctgd)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@cmnd", ctgd.CMND),
                new SqlParameter("@maDoan", ctgd.MADOAN),
                new SqlParameter("@maPhong", ctgd.MAPHONG)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_ErrThemChiTietGiaoDich", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }
Example #30
0
        public static ResortManagerDTO.DTO.DbAck ThemTaiKhoan(ResortManagerDTO.DTO.TaiKhoan tk)
        {
            Provider provider = new Provider();

            ResortManagerDTO.DTO.DbAck result = provider.Connect();
            if (result == ResortManagerDTO.DTO.DbAck.NetworkError)
            {
                goto Network; // net nhu la networkerror thi nhay den lable network
            }
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@TenTK", tk.TenTaiKhoan),
                new SqlParameter("@MatKhau", tk.MatKhau),
                new SqlParameter("@MaDoan", tk.MaDoan)
            };
            result = provider.ExcuteNonQuery(CommandType.StoredProcedure, "usp_ThemTaiKhoan", para);
            provider.Disconnect();
            //lable network
Network:
            return(result);
        }