protected void GrdViewPayment_RowDeleted(object sender, GridViewDeletedEventArgs e) { try { if (e.Exception == null) { GrdViewPayment.DataBind(); } else { if (e.Exception.InnerException != null) { StringBuilder script = new StringBuilder(); script.Append("alert('You are not allowed to delete the record. Please contact Supervisor.');"); if (e.Exception.InnerException.Message.IndexOf("Invalid Date") > -1) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true); } e.ExceptionHandled = true; } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { rvSearch.Enabled = true; Page.Validate(); if (Page.IsValid) { GrdViewPayment.DataBind(); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
private void BindPayment() { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); string criteria = string.Empty; string value = string.Empty; bool deletedItems = false; if (txtPaymentSearch.Text != "") { value = txtPaymentSearch.Text; } if (ddPaymentCriteria.SelectedValue != "0") { criteria = ddPaymentCriteria.SelectedValue; } deletedItems = ChkPayDel.Checked; BusinessLogic bl = new BusinessLogic(); DataSet ds = bl.lsPayments(sDataSource, criteria, value, deletedItems); GrdViewPayment.DataSource = ds; GrdViewPayment.DataBind(); if (ChkPayDel.Checked) { GrdViewPayment.Columns[9].Visible = false; GrdViewPayment.Columns[8].Visible = true; } else { GrdViewPayment.Columns[8].Visible = false; GrdViewPayment.Columns[9].Visible = true; } }
protected void frmViewAdd_ItemInserted(object sender, FormViewInsertedEventArgs e) { try { if (e.Exception == null) { lnkBtnAdd.Visible = true; frmViewAdd.Visible = false; System.Threading.Thread.Sleep(1000); GrdViewPayment.DataBind(); MyAccordion.Visible = true; GrdViewPayment.Visible = true; } else { StringBuilder script = new StringBuilder(); script.Append("alert('You are not allowed to Update this record. Please contact Supervisor.');"); if (e.Exception.InnerException != null) { if (e.Exception.InnerException.Message.IndexOf("Invalid Date") == -1) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + e.Exception.InnerException.Message + "');", true); } } e.KeepInInsertMode = true; e.ExceptionHandled = true; lnkBtnAdd.Visible = false; frmViewAdd.Visible = true; } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void rdoType_SelectedIndexChanged(object sender, EventArgs e) { try { if (rdoType.SelectedValue == "Payment") { divPayment.Visible = true; divReceipt.Visible = false; divJournal.Visible = false; divPurchase.Visible = false; divSales.Visible = false; divPaymentResult.Visible = true; GrdViewJournal.DataSource = null; GrdViewJournal.DataBind(); GrdViewPurchase.DataSource = null; GrdViewPurchase.DataBind(); GrdViewReceipt.DataSource = null; GrdViewReceipt.DataBind(); GrdViewSales.DataSource = null; GrdViewSales.DataBind(); ChkSales.Checked = false; ChkJournal.Checked = false; ChkPurchase.Checked = false; ChkReceipt.Checked = false; BindPayment(); } else if (rdoType.SelectedValue == "Receipt") { divPayment.Visible = false; divReceipt.Visible = true; divJournal.Visible = false; divPurchase.Visible = false; divSales.Visible = false; ChkSales.Checked = false; ChkJournal.Checked = false; ChkPurchase.Checked = false; ChkPayDel.Checked = false; divPaymentResult.Visible = false; divJournalResult.Visible = false; divPurchaseResult.Visible = false; divReceiptResult.Visible = true; divSalesResult.Visible = false; GrdViewPayment.DataSource = null; GrdViewPayment.DataBind(); GrdViewJournal.DataSource = null; GrdViewJournal.DataBind(); GrdViewPurchase.DataSource = null; GrdViewPurchase.DataBind(); GrdViewSales.DataSource = null; GrdViewSales.DataBind(); BindReceipt(); } else if (rdoType.SelectedValue == "Journal") { divPayment.Visible = false; divReceipt.Visible = false; divJournal.Visible = true; divPurchase.Visible = false; divSales.Visible = false; ChkSales.Checked = false; ChkPayDel.Checked = false; ChkPurchase.Checked = false; ChkReceipt.Checked = false; divPaymentResult.Visible = false; divJournalResult.Visible = true; divPurchaseResult.Visible = false; divReceiptResult.Visible = false; divSalesResult.Visible = false; GrdViewPayment.DataSource = null; GrdViewPayment.DataBind(); GrdViewPurchase.DataSource = null; GrdViewPurchase.DataBind(); GrdViewReceipt.DataSource = null; GrdViewReceipt.DataBind(); GrdViewSales.DataSource = null; GrdViewSales.DataBind(); BindJournal(); } else if (rdoType.SelectedValue == "Purchase") { divPayment.Visible = false; divReceipt.Visible = false; divJournal.Visible = false; divPurchase.Visible = true; divSales.Visible = false; divPaymentResult.Visible = false; divJournalResult.Visible = false; divPurchaseResult.Visible = true; divReceiptResult.Visible = false; divSalesResult.Visible = false; ChkSales.Checked = false; ChkJournal.Checked = false; ChkPayDel.Checked = false; ChkReceipt.Checked = false; GrdViewPayment.DataSource = null; GrdViewPayment.DataBind(); GrdViewJournal.DataSource = null; GrdViewJournal.DataBind(); GrdViewReceipt.DataSource = null; GrdViewReceipt.DataBind(); GrdViewSales.DataSource = null; GrdViewSales.DataBind(); BindPurchase("0"); } else { divReceipt.Visible = false; divPayment.Visible = false; divJournal.Visible = false; divPurchase.Visible = false; divSales.Visible = true; ChkPayDel.Checked = false; ChkJournal.Checked = false; ChkPurchase.Checked = false; ChkReceipt.Checked = false; divPaymentResult.Visible = false; divJournalResult.Visible = false; divPurchaseResult.Visible = false; divReceiptResult.Visible = false; divSalesResult.Visible = true; GrdViewPayment.DataSource = null; GrdViewPayment.DataBind(); GrdViewJournal.DataSource = null; GrdViewJournal.DataBind(); GrdViewPurchase.DataSource = null; GrdViewPurchase.DataBind(); GrdViewReceipt.DataSource = null; GrdViewReceipt.DataBind(); BindSales(0); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }