コード例 #1
0
 protected void btnXoaBNai_Click(object sender, EventArgs e)
 {
     try
     {
         int MaKH = int.Parse(Session["MaKH"].ToString());
         int MaNT = int.Parse(Request.QueryString["MaNT"]);
         XLDL.Excute("Delete HinhAnhChiTietNhaTro from HinhAnhChiTietNhaTro where HinhAnhChiTietNhaTro.MaNhaTro =" + MaNT);
         XLDL.Excute("Delete DanhGia from DanhGia where DanhGia.MaNhaTro=" + MaNT);
         XLDL.Excute("Delete NhaTroChoThue from NhaTroChoThue where NhaTroChoThue.MaNhaTro =" + MaNT);
         Response.Redirect("~/QuanLiBaiDang.aspx");
     }
     catch
     {
         lbBaoLoi.Text = "Thất bại";
     }
 }
コード例 #2
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     try
     {
         int       MaNT = int.Parse(Request.QueryString["MaNT"]);
         DataTable dt   = XLDL.GetData("select [TinhThanh],[QuanHuyen],[PhuongXa],[TenDuong],[LoaiNT],[SoNha],[DiaChi],[SDTNguoiChoThue],[MoTa],[GiaChoThue],[DienTich],[TieuDe] from NhaTroChoThue where  MaNhaTro='" + MaNT + "'");
         if (dt.Rows.Count > 0)
         {
             XLDL.Excute(@"update NhaTroChoThue set TenDuong=N'" + txtDuong.Text + "',SoNha=N'" + txtSoNha.Text + "', DiaChi=N'" + txtDiaChiChinhXac.Text + "',LoaiNT='" + drpLoaiNT.SelectedValue + "',TieuDe=N'" + txtTieuDe.Text + "',MoTa=N'" + txtMoTa.Text + "',SDTNguoiChoThue='" + txtThongTinLienHe.Text + "',GiaChoThue='" + txtGiaChoThue.Text + "',DienTich='" + txtDienTich.Text + "' where  MaNhaTro='" + MaNT + "'");
             lbBaoLoi.Text = "Lưu thành công";
         }
     }
     catch
     {
         lbBaoLoi.Text = "Thất bại";
     }
 }
コード例 #3
0
        public void XLNgayHetHan()
        {
            DataTable dt    = XLDL.GetData("SELECT [MaNhaTro], [NgayHetHan] FROM [NhaTroChoThue]");
            DateTime  dtNow = DateTime.Now;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int      MaNT = (int)dt.Rows[i][0];
                DateTime NHH  = (DateTime)dt.Rows[i]["NgayHetHan"];
                if (DateTime.Compare(NHH, dtNow) < 0)
                {
                    XLDL.Excute("Delete HinhAnhChiTietNhaTro from HinhAnhChiTietNhaTro where HinhAnhChiTietNhaTro.MaNhaTro =" + MaNT);
                    XLDL.Excute("Delete DanhGia from DanhGia where DanhGia.MaNhaTro=" + MaNT);
                    XLDL.Excute("Delete NhaTroChoThue from NhaTroChoThue where NhaTroChoThue.MaNhaTro =" + MaNT);
                }
                ;
            }
        }
コード例 #4
0
 protected void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = XLDL.GetData("select TenTK from KhachHang where TenTK='" + txtTenDN.Text + "' and MatKhau='" + txtMatKhauCu.Text + "'");
         if (dt.Rows.Count > 0)
         {
             XLDL.Excute("UPDATE KhachHang set MatKhau='" + txtMatKhauMoi.Text + "'where TenTK='" + txtTenDN.Text + "'");
             lbThongBaoLoi.Text = "Đổi mật khẩu thành công";
         }
         else
         {
             lbThongBaoLoi.Text = "Tên đăng nhập hoặc mật khẩu cũ không hợp lệ!";
         }
     }
     catch
     {
         lbThongBaoLoi.Text = "Thất bại";
     }
 }
コード例 #5
0
 protected void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         string    MaKH = Session["MaKH"].ToString();
         DataTable dt   = XLDL.GetData("select  [TenKH],[Email] from KhachHang where  MaKH='" + MaKH + "'");
         if (dt.Rows.Count > 0)
         {
             XLDL.Excute(@"update KhachHang set TenKH=N'" + txtTenKH.Text + "',Email='" + txtEmail.Text + "' where  MaKH='" + MaKH + "'");
             Session["TenKH"] = txtTenKH.Text;
             lbBaoLoi.Text    = "Lưu thành công";
         }
         else
         {
             lbBaoLoi.Text = "Lưu không thành công!";
         }
     }
     catch
     {
         lbBaoLoi.Text = "Thất bại";
     }
 }