protected void Page_Load(object sender, EventArgs e)
        {
            int madn = int.Parse(Session["MaDN"].ToString());
            if (int.Parse(Session["IsLogin"].ToString()) == 1)
            {
                if (!Page.IsPostBack)
                {
                    VoucherDAO vDAO = new VoucherDAO();
                    List<VoucherDTO> lstVoucher = new List<VoucherDTO>();
                    lstVoucher = VoucherBUS.SelectVoucher_DoanhNghiep(madn);

                    ChiTietDonHangDAO ctDAO = new ChiTietDonHangDAO();
                    List<ChiTietDonHangDTO> lstCT = new List<ChiTietDonHangDTO>();
                    lstCT = ctDAO.SelectAllChiTietDonHang();

                    List<VoucherDTO> lstVoucherddl = new List<VoucherDTO>();

                    for (int i = 0; i < lstVoucher.Count; i++)
                        for (int j = 0; j < lstCT.Count; j++)
                            if (lstVoucher[i].MAVOUCHER1 == lstCT[j].VOUCHERDH1)
                                lstVoucherddl.Add(lstVoucher[i]);

                    ddlVoucherList.DataSource = lstVoucherddl;
                    ddlVoucherList.DataTextField = "TENVOUCHER1";
                    ddlVoucherList.DataValueField = "MAVOUCHER1";
                    ddlVoucherList.DataBind();
                }
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
 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);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (int.Parse(Session["IsLogin"].ToString()) == 1)
            {
                if (!Page.IsPostBack)
                {
                    VoucherDAO voucher = new VoucherDAO();
                    List<VoucherDTO> arrDeal = (List<VoucherDTO>)VoucherBUS.SelectVoucher_DoanhNghiep(int.Parse(Session["MaDN"].ToString()));

                    RepeaterDSDealDN.DataSource = arrDeal.ToList();
                    RepeaterDSDealDN.DataBind();
                }
            }
        }