public bool CapNhatTheThanhToan(TheThanhToanDTO tttDto) { Connect(); string strSql = "update THE_THANH_TOAN set MaLoaiThe = @maloaithe "; strSql += ", SoThe = @sothe "; strSql += ", NgayHetHan = @ngayhethan "; strSql += "where MaThe = @mathe"; SqlCommand cmd = new SqlCommand(strSql, cnn); cmd.Parameters.Add("@maloaithe", SqlDbType.Int); cmd.Parameters.Add("@sothe", SqlDbType.VarChar); cmd.Parameters.Add("@ngayhethan", SqlDbType.DateTime); cmd.Parameters.Add("@mathe", SqlDbType.Int); cmd.Parameters["@maloaithe"].Value = tttDto.Ma_loai_the; cmd.Parameters["@sothe"].Value = tttDto.So_the; cmd.Parameters["@ngayhethan"].Value = tttDto.Ngay_het_han; cmd.Parameters["@mathe"].Value = tttDto.Ma_the; try { cmd.ExecuteNonQuery(); } catch (SqlException ex) { cnn.Close(); return(false); } Disconnect(); return(true); }
protected override object GetDataFromDataRow(DataTable dt, int i) { TheThanhToanDTO the = new TheThanhToanDTO(); the.Ma_the = (int)dt.Rows[i]["MaThe"]; the.So_the = dt.Rows[i]["SoThe"].ToString().ToCharArray(); the.Ngay_het_han = (DateTime)dt.Rows[i]["NgayHetHan"]; the.Ma_loai_the = (int)dt.Rows[i]["MaLoaiThe"]; return((object)the); }
protected void ThemKhachHang() { KhachHangDTO khachhangdto = new KhachHangDTO(); khachhangdto.Ho_ten = XL_CHUOI.Nhap(Request, "hoten"); khachhangdto.Username = XL_CHUOI.Nhap(Request, "username"); khachhangdto.Password = XL_CHUOI.Nhap(Request, "password"); //hex string khachhangdto.Email = XL_CHUOI.Nhap(Request, "email"); khachhangdto.Dia_chi = XL_CHUOI.Nhap(Request, "diachi"); khachhangdto.Dien_thoai = XL_CHUOI.Nhap(Request, "dienthoai"); khachhangdto.Gioi_tinh = bool.Parse(XL_CHUOI.Nhap(Request, "gioitinh")); khachhangdto.Ngay_sinh = DateTime.Parse(XL_CHUOI.Nhap(Request, "date").ToString()); TheThanhToanDTO thedto = new TheThanhToanDTO(); thedto.Ma_loai_the = int.Parse(XL_CHUOI.Nhap(Request, "loaithe").ToString()); thedto.So_the = XL_CHUOI.Nhap(Request, "mathe"); thedto.Ngay_het_han = DateTime.Parse(XL_CHUOI.Nhap(Request, "dateHH").ToString()); int manguoidung = 0; XL_THE the = new XL_THE("goc"); XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("Kq", "false"); try { KhachHangBUS khachhangBUS = new KhachHangBUS(); manguoidung = khachhangBUS.ThemKhachHang(khachhangdto, thedto); if (manguoidung != 0) { thuoctinh = new XL_THUOC_TINH("kq", "true"); } else { thuoctinh = new XL_THUOC_TINH("kq", "error"); } } catch (SqlException ex) { if (ex.Number == 2627) { thuoctinh = new XL_THUOC_TINH("kq", "false"); } } the.Danh_sach_thuoc_tinh.Add(thuoctinh); string chuoi = the.Chuoi(); XL_CHUOI.XuatChuoi(Response, chuoi); }
public int ThemKhachHang(KhachHangDTO khachhang, TheThanhToanDTO the) { int Kq = 0; //mã người dùng SqlConnection cnn = Connect(); SqlCommand cmd = new SqlCommand("spThemKhachHang", cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@hoten", SqlDbType.NVarChar); cmd.Parameters.Add("@diachi", SqlDbType.NVarChar); cmd.Parameters.Add("@ngaysinh", SqlDbType.SmallDateTime); cmd.Parameters.Add("@gioitinh", SqlDbType.Bit); cmd.Parameters.Add("@email", SqlDbType.VarChar); cmd.Parameters.Add("@dienthoai", SqlDbType.VarChar); cmd.Parameters.Add("@username", SqlDbType.VarChar); cmd.Parameters.Add("@password", SqlDbType.VarChar); cmd.Parameters.Add("@maloaithe", SqlDbType.Int); cmd.Parameters.Add("@sothe", SqlDbType.VarChar); cmd.Parameters.Add("@ngayhethan", SqlDbType.SmallDateTime); cmd.Parameters["@hoten"].Value = khachhang.Ho_ten; cmd.Parameters["@diachi"].Value = khachhang.Dia_chi; cmd.Parameters["@ngaysinh"].Value = khachhang.Ngay_sinh; cmd.Parameters["@gioitinh"].Value = khachhang.Gioi_tinh; cmd.Parameters["@email"].Value = khachhang.Email; cmd.Parameters["@dienthoai"].Value = khachhang.Dien_thoai; cmd.Parameters["@username"].Value = khachhang.Username; cmd.Parameters["@password"].Value = khachhang.Password; cmd.Parameters["@maloaithe"].Value = the.Ma_loai_the; cmd.Parameters["@sothe"].Value = the.So_the; cmd.Parameters["@ngayhethan"].Value = the.Ngay_het_han; cmd.Parameters.Add("@makhachhang", SqlDbType.Int); cmd.Parameters["@makhachhang"].Direction = ParameterDirection.Output; try { cmd.ExecuteNonQuery(); } catch (SqlException ex) { Disconnect(); throw ex; } Kq = (int)cmd.Parameters["@makhachhang"].Value; Disconnect(); return(Kq); }
private void CapNhatThongTinTheTinDung() { viewKhachHangDTO vkhDto = (viewKhachHangDTO)Session["khachhang"]; TheThanhToanDTO tttDto = new TheThanhToanDTO(); tttDto.Ma_the = vkhDto.Ma_the; //Lấy tham số client truyền xuống tttDto.Ma_loai_the = int.Parse(XL_CHUOI.Nhap(Request, "maloaithe")); //tttDto.So_the = XL_CHUOI.Nhap(Request, "sothe").ToCharArray(); tttDto.So_the = XL_CHUOI.Nhap(Request, "sothe").ToString(); tttDto.Ngay_het_han = DateTime.Parse(Request["ngayhh"].ToString()); //Cập nhật neu co thay doi bool kq = true; if (tttDto.Ma_loai_the != vkhDto.Ma_loai_the || tttDto.So_the != vkhDto.So_the || tttDto.Ngay_het_han != vkhDto.Ngay_het_han) { kq = (new TheThanhToanBUS()).CapNhatTheThanhToan(tttDto); } XL_THE the = new XL_THE("goc"); XL_THUOC_TINH thuoc_tinh; if (kq == true) { //Lưu lại biến trong session vkhDto.Ma_loai_the = tttDto.Ma_loai_the; //vkhDto.Ten_loai_the = (new LoaiTheBUS()).Lay_Ten_Loai_The(tttDto.Ma_loai_the); vkhDto.Ten_loai_the = Request["tenloaithe"].ToString(); vkhDto.So_the = tttDto.So_the; vkhDto.Ngay_het_han = tttDto.Ngay_het_han; Session["khachhang"] = vkhDto; thuoc_tinh = new XL_THUOC_TINH("kq", "True"); } else { thuoc_tinh = new XL_THUOC_TINH("kq", "False"); } //Trả kết quả về client the.Danh_sach_thuoc_tinh.Add(thuoc_tinh); string chuoi = the.Chuoi(); XL_CHUOI.XuatChuoi(Response, chuoi); }
public bool CapNhatTheThanhToan(TheThanhToanDTO tttDto) { TheThanhToanBUS theBUS = new TheThanhToanBUS(); return(theBUS.CapNhatTheThanhToan(tttDto)); }
public int ThemKhachHang(KhachHangDTO khachhang, TheThanhToanDTO the) { KhachHangBUS khachhangBUS = new KhachHangBUS(); return(khachhangBUS.ThemKhachHang(khachhang, the)); }
public bool CapNhatTheThanhToan(TheThanhToanDTO tttDto) { TheThanhToanDAO theDAO = new TheThanhToanDAO(); return(theDAO.CapNhatTheThanhToan(tttDto)); }
public int ThemKhachHang(KhachHangDTO khachhang, TheThanhToanDTO the) { KhachHangDAO khachhangDAO = new KhachHangDAO(); return(khachhangDAO.ThemKhachHang(khachhang, the)); }
public bool CapNhatTheThanhToan(TheThanhToanDTO tttDto) { return(theDAO.CapNhatTheThanhToan(tttDto)); }
public int ThemKhachHang(KhachHangDTO khachhang, TheThanhToanDTO the) { return(khDAO.ThemKhachHang(khachhang, the)); }