protected void ButtonUpdate_Click(object sender, EventArgs e) { if (int.Parse(Session["IsLogin"].ToString()) == 1) { int mavoucher = int.Parse(Request.QueryString["MAVOUCHER"]); VoucherDAO vDao = new VoucherDAO(); VoucherDTO vDto = new VoucherDTO(); vDto.MAVOUCHER1 = int.Parse(txtMaVoucher.Text); vDto.TENVOUCHER1 = txtTenVoucher.Text; vDto.THOIGIANBDKM1 = DateTime.Parse(txtTGBD.Text); vDto.THOIGIANKTKM1 = DateTime.Parse(txtTGKT.Text); vDto.NOIDUNG1 = txtNoiDung.Text; vDto.GIAGOC1 = int.Parse(txtGiaGoc.Text); vDto.GIAKHUYENMAI1 = int.Parse(txtGiaKhuyenMai.Text); vDto.SOLUONGTRONGKHO1 = int.Parse(txtSLKho.Text); vDto.SOLUONGDAMUA1 = int.Parse(txtSLDaMua.Text); vDto.THUOCTINHVIP1 = int.Parse(txtVip.Text); vDto.TONGSOGIOBAN1 = int.Parse(txtThoiGianBan.Text); vDto.TRANGTHAIDUYET1 = int.Parse(txtTrangThaiDuyet.Text); vDto.ISAVAILABLE1 = int.Parse(ddlAvai.SelectedValue.ToString()); vDto.MAHINH1 = int.Parse(ddlHinh.SelectedValue.ToString()); vDto.MALOAIVOUCHER1 = int.Parse(ddlVoucher.SelectedValue.ToString()); vDto.MAKHUVUC1 = int.Parse(ddlKV.SelectedValue.ToString()); vDto.MADOANHNGHIEP1 = int.Parse(ddlDN.SelectedValue.ToString()); VoucherBUS.UpdateVoucher(vDto); } }
protected void ButtonCapNhat_Click(object sender, EventArgs e) { if (int.Parse(Session["IsLogin"].ToString()) == 1) { VoucherDTO v = new VoucherDTO(); v.MAVOUCHER1 = Int32.Parse(TextBoxMaVoucher.Text); v.TENVOUCHER1 = TextBoxTenVoucher.Text; v.THOIGIANBDKM1 = DateTime.Parse(TextBoxThoiGianBatDau.Text); v.THOIGIANKTKM1 = DateTime.Parse(TextBoxThoiGianKetThuc.Text); v.NOIDUNG1 = TextBoxNoiDung.Text; v.GIAGOC1 = Int32.Parse(TextBoxGiaGoc.Text); v.GIAKHUYENMAI1 = Int32.Parse(TextBoxGiaKhuyenMai.Text); v.SOLUONGTRONGKHO1 = Int32.Parse(TextBoxSoLuongNhapKho.Text); v.SOLUONGDAMUA1 = 0; v.THUOCTINHVIP1 = Int32.Parse(DropDownListVIP.SelectedValue); v.TONGSOGIOBAN1 = Int32.Parse(TextBoxThoiGianBan.Text); v.TRANGTHAIDUYET1 = 0; v.MAHINH1 = Int32.Parse(DropDownListHinhAnh.SelectedValue); v.MALOAIVOUCHER1 = Int32.Parse(DropDownListLoaiVoucher.SelectedValue); v.MAKHUVUC1 = Int32.Parse(DropDownListKhuVuc.SelectedValue); v.MADOANHNGHIEP1 = int.Parse(Session["MaDN"].ToString()); v.ISAVAILABLE1 = 0; VoucherDAO vDAO = new VoucherDAO(); VoucherBUS.UpdateVoucher(v); } }
public static int UpdateVoucher(VoucherDTO vc) { return VoucherDAO.UpdateVoucher(vc); }
public static int InsertVoucher(VoucherDTO vc) { return VoucherDAO.InsertVoucher(vc); }
public static int InsertVoucher(VoucherDTO v) { int kq = 0; try { data.sp_ins_voucher(v.MAVOUCHER1, v.TENVOUCHER1, v.THOIGIANBDKM1, v.THOIGIANKTKM1, v.NOIDUNG1, v.GIAGOC1, v.GIAKHUYENMAI1, v.SOLUONGTRONGKHO1, v.SOLUONGDAMUA1, v.THUOCTINHVIP1, v.TONGSOGIOBAN1, v.TRANGTHAIDUYET1, v.MAHINH1, v.MALOAIVOUCHER1, v.MAKHUVUC1, v.MADOANHNGHIEP1, v.ISAVAILABLE1); data.SubmitChanges(); kq = 1; } catch (Exception ex) { } return kq; }
public static VoucherDTO SelectVoucher_MaVoucher(int mavoucher) { List<VoucherDTO> lstVoucherDto = new List<VoucherDTO>(); List<Voucher> listV = data.sp_VoucherXemMaVoucher(mavoucher).ToList(); foreach (Voucher v in listV) { VoucherDTO voucherDto = new VoucherDTO(v); lstVoucherDto.Add(voucherDto); } return lstVoucherDto[0]; }
public static List<VoucherDTO> SelectVoucher_Loai_KhuVuc(int loai, int khuvuc) { List<VoucherDTO> lstVoucherDto = new List<VoucherDTO>(); List<Voucher> listV = data.sp_VoucherXemloaiKV(loai, khuvuc).ToList(); foreach (Voucher v in listV) { VoucherDTO voucherDto = new VoucherDTO(v); lstVoucherDto.Add(voucherDto); } return lstVoucherDto; }
public static List<VoucherDTO> SelectVoucher_KhuVuc(int kv) { List<VoucherDTO> lstVoucherDto = new List<VoucherDTO>(); List<Voucher> listV = data.sp_VoucherXemKhuVuc(kv).ToList(); foreach (Voucher v in listV) { VoucherDTO voucherDto = new VoucherDTO(v); lstVoucherDto.Add(voucherDto); } return lstVoucherDto; }
public static List<VoucherDTO> SelectVoucher_DoanhNghiep(int madn) { List<VoucherDTO> lstVoucherDto = new List<VoucherDTO>(); List<Voucher> listV = data.sp_VoucherXemDN(madn).ToList(); foreach (Voucher v in listV) { VoucherDTO voucherDto = new VoucherDTO(v); lstVoucherDto.Add(voucherDto); } return lstVoucherDto; }
public static VoucherDTO SelectVoucherTheoMa(int mavoucher) { Voucher item = data.sp_SelectVoucherTheoMa(mavoucher).Single(); VoucherDTO voucherDto = new VoucherDTO(item); return voucherDto; }
public static List<VoucherDTO> SelectTop6TheoMaLoai(int maloai) { List<VoucherDTO> lstTop6VoucherDto = new List<VoucherDTO>(); List<Voucher> list = data.sp_Top6VoucherTheoMaLoai(maloai).ToList(); foreach (Voucher vc in list) { VoucherDTO voucherDto = new VoucherDTO(vc); lstTop6VoucherDto.Add(voucherDto); } return lstTop6VoucherDto; }
public static List<VoucherDTO> SelectAllVoucher() { List<VoucherDTO> lstVoucherDto = new List<VoucherDTO>(); try { List<Voucher> listVoucher = (from d in data.Vouchers select d).ToList(); if (listVoucher != null) { foreach (Voucher vc in listVoucher) { VoucherDTO voucherDto = new VoucherDTO(vc); lstVoucherDto.Add(voucherDto); } } } catch (Exception ex) { } return lstVoucherDto; }