protected void uiGridViewVouchers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditR") { BLL.PaymentVoucher voucher = new BLL.PaymentVoucher(); voucher.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); CurrentVoucher = voucher; uiTextBoxVoucherNo.Text = voucher.VoucherNumber; if (!voucher.IsColumnNull("VoucherDate")) uiTextBoxVoucherDate.Text = voucher.VoucherDate.ToString("dd/MM/yyyy"); uiTextBoxAmount.Text = voucher.Amount.ToString(); uiCheckBoxIsCheque.Checked = voucher.IsCheque; uiTextBoxBank.Text = voucher.BankName; if (!voucher.IsColumnNull("ChuqueDate")) uiTextBoxChequeDate.Text = voucher.ChuqueDate.ToString("dd/MM/yyyy"); uiTextBoxReason.Text = voucher.Reason; if (!voucher.IsColumnNull(BLL.PaymentVoucher.ColumnNames.PassengerId)) { uiDropDownListCustomer.SelectedValue = voucher.PassengerId.ToString(); } uiTextBoxPaidFor.Text = voucher.PaidFor; uiPanelAll.Visible = false; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteR") { BLL.PaymentVoucher voucher = new BLL.PaymentVoucher(); voucher.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); voucher.MarkAsDeleted(); voucher.Save(); LoadAllVouchers(); } }
protected void uiLinkButtonAdd_Click(object sender, EventArgs e) { uiPanelAll.Visible = false; uiPanelEdit.Visible = true; ClearFields(); CurrentVoucher = null; }
protected void uiLinkButtonSave_Click(object sender, EventArgs e) { BLL.PaymentVoucher voucher = new BLL.PaymentVoucher(); if (CurrentVoucher == null) voucher.AddNew(); else voucher = CurrentVoucher; voucher.VoucherNumber = uiTextBoxVoucherNo.Text; try { voucher.VoucherDate = DateTime.ParseExact(uiTextBoxVoucherDate.Text, "dd/MM/yyyy", null); } catch (Exception) { } voucher.Amount = decimal.Parse(uiTextBoxAmount.Text); if (uiDropDownListCustomer.SelectedIndex == 0) voucher.PaidFor = uiTextBoxPaidFor.Text; else { voucher.PaidFor = uiDropDownListCustomer.SelectedItem.Text; voucher.PassengerId = Convert.ToInt32(uiDropDownListCustomer.SelectedValue); } voucher.IsCheque = uiCheckBoxIsCheque.Checked; voucher.BankName = uiTextBoxBank.Text; voucher.Reason = uiTextBoxReason.Text; try { voucher.ChuqueDate = DateTime.ParseExact(uiTextBoxChequeDate.Text, "dd/MM/yyyy", null); } catch (Exception) { } voucher.Save(); LoadAllVouchers(); uiPanelAll.Visible = true; uiPanelEdit.Visible = false; ClearFields(); CurrentVoucher = null; }
private void LoadAllVouchers() { BLL.PaymentVoucher vouchers = new BLL.PaymentVoucher(); vouchers.SearchPaymentVoucher(uiTextBoxSearch.Text); uiGridViewVouchers.DataSource = vouchers.DefaultView; uiGridViewVouchers.DataBind(); }
protected void uiLinkButtonTotalPayment_Click(object sender, EventArgs e) { BLL.PaymentVoucher p = new BLL.PaymentVoucher(); DateTime from, to; from = DateTime.TryParseExact(uiTextBoxFromDate.Text, "MM/dd/yyyy", null, System.Globalization.DateTimeStyles.None, out from) ? from : new DateTime(1900, 1, 1); to = DateTime.TryParseExact(uiTextBoxToDate.Text, "MM/dd/yyyy", null, System.Globalization.DateTimeStyles.None, out to) ? to : new DateTime(8000, 12, 31); p.RPT_GetTotalPaymentVoucher(from, to); uiReportViewerMain.Reset(); uiReportViewerMain.LocalReport.ReportPath = "ReportsFiles/TotalPaymentVoucher.rdlc"; uiReportViewerMain.LocalReport.DataSources.Clear(); uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("TotalPaymentDataSet", p.DefaultView)); uiReportViewerMain.LocalReport.Refresh(); }