Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString["no"] != null)
         {
             Business.ClaimManagement.Voucher objVoucher = new Business.ClaimManagement.Voucher();
             DataSet dsVoucher = objVoucher.Voucher_GetAll(new Voucher()
             {
                 VoucherNo = Request.QueryString["no"].ToString(),
                 PageIndex = 0,
                 PageSize  = 10
             });
             VoucherJson voucher = new VoucherJson();
             voucher           = JsonConvert.DeserializeObject <VoucherJson>(dsVoucher.Tables[0].Rows[0]["VoucherJson"].ToString());
             voucher.VoucherNo = dsVoucher.Tables[0].Rows[0]["VoucherNo"].ToString();
             GenerateVoucher(voucher);
         }
         else
         {
             throw new Exception("Invalid voucher id");
         }
     }
     catch (Exception ex)
     {
         ex.WriteException();
     }
 }
Exemplo n.º 2
0
        private void Voucher_GetAll()
        {
            Business.ClaimManagement.Voucher objVoucher = new Business.ClaimManagement.Voucher();
            DataSet dsVoucher = objVoucher.Voucher_GetAll(new Entity.ClaimManagement.Voucher()
            {
                EmployeeName = txtEmployeeName.Text.Trim(),
                VoucherNo    = txtVoucherNo.Text.Trim(),
                FromDate     = (string.IsNullOrEmpty(txtFromDate.Text.Trim()) ? DateTime.MinValue : Convert.ToDateTime(txtFromDate.Text.Trim())),
                ToDate       = (string.IsNullOrEmpty(txtToDate.Text.Trim()) ? DateTime.MinValue : Convert.ToDateTime(txtToDate.Text.Trim())),
                PageIndex    = gvVoucherList.PageIndex,
                PageSize     = gvVoucherList.PageSize
            });

            gvVoucherList.DataSource       = dsVoucher.Tables[0];
            gvVoucherList.VirtualItemCount = (dsVoucher.Tables[1].Rows.Count > 0) ? Convert.ToInt32(dsVoucher.Tables[1].Rows[0]["TotalCount"].ToString()) : 20;
            gvVoucherList.DataBind();
        }