public DataTable GetTodaysCashOutEntryList(CashOutBLL cashOut, LumexDBPlayer db) { try { db.AddParameters("@SalesCenterId", cashOut.SalesCenterId); db.AddParameters("@EntryDate", cashOut.EntryDate); db.AddParameters("@Staus", cashOut.Status); DataTable dt = db.ExecuteDataTable("GET_TODAYS_CASH_OUT_ENTRY_LIST", true); return dt; } catch (Exception) { throw; } }
public void UpdateTodaysCashOutEntryBySerial(CashOutBLL cashOut, LumexDBPlayer db) { try { db.AddParameters("@Serial", cashOut.Serial.Trim()); db.AddParameters("@AccountId", cashOut.AccountId); db.AddParameters("@EntryDate", cashOut.EntryDate.Trim()); db.AddParameters("@Amount", cashOut.Amount.Trim()); db.AddParameters("@Narration", cashOut.Narration.Trim()); db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal()); db.ExecuteNonQuery("UPDATE_CASH_OUT_ENTRY_BY_SERIAL", true); } catch (Exception) { throw; } }
private void LoadData() { CashOutBLL cashOutBll=new CashOutBLL(); try { DataTable dt=cashOutBll.GetTodaysCashOutEntryListBySerial(); //txtbxSerial.Text = dt.Rows[0]["Serial"].ToString(); //txtbxSerial.Text = LumexSessionManager.Get("CashOutSerialForUpdate").ToString().Trim(); accountHeadDropDownList.SelectedValue = dt.Rows[0]["AccountId"].ToString(); txtbxDescription.Text = dt.Rows[0]["Description"].ToString(); amountTextBox.Text = dt.Rows[0]["Amount"].ToString(); narrationTextBox.Text = dt.Rows[0]["Narration"].ToString(); entryDateTextBox.Text = DateTime.Parse(dt.Rows[0]["CashOutDate"].ToString().Trim()).ToString(LumexLibraryManager.GetAppDateFormat()); } catch (Exception) { throw; } }
public DataTable SaveCashOutEntry(CashOutBLL cashOut, LumexDBPlayer db) { try { db.AddParameters("@SalesCenterId", cashOut.SalesCenterId.Trim()); db.AddParameters("@EntryDate", cashOut.EntryDate.Trim()); db.AddParameters("@Amount", cashOut.Amount.Trim()); db.AddParameters("@Narration", cashOut.Narration.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); db.AddParameters("@AccountId", cashOut.AccountHEad.Trim()); DataTable dt = db.ExecuteDataTable("INSERT_TODAYS_CASH_OUT_ENTRY", true); return dt; } catch (Exception) { throw; } finally { cashOut = null; } }
protected void updateButton_Click(object sender, EventArgs e) { CashOutBLL cashOut = new CashOutBLL(); try { if (cashOutEntrySerialForUpdateHiddenField.Value.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Cash Out Entry not found to update."; } else if (amountTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Amount field is required."; } else if (narrationTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Narration field is required."; } else if (accountHeadDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Account Head field is required."; } else { cashOut.Serial = idLabel.Text.Trim(); cashOut.Amount = amountTextBox.Text.Trim(); cashOut.Narration = narrationTextBox.Text.Trim(); cashOut.EntryDate = LumexLibraryManager.ParseAppDate(entryDateTextBox.Text.Trim()); //cashOut.AccountHEad = accountHeadDropDownList.SelectedValue.Trim(); cashOut.Description = txtbxDescription.Text.Trim(); cashOut.AccountId = accountHeadDropDownList.SelectedValue; cashOut.UpdateTodaysCashOutEntryBySerial(); cashOutEntrySerialForUpdateHiddenField.Value = ""; string message = "Cash Out Entry <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/TodaysCashOut/TodaysCashOutList.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { cashOut = null; } }
protected void approveButton_Click(object sender, EventArgs e) { //List<CashOutBLL> cashOuts = new List<CashOutBLL>(); List<string> cashOuts = new List<string>(); string Serial = ""; CashOutBLL cashOut = new CashOutBLL(); int i = 0; try { for (i = 0; i < cashOutListGridView.Rows.Count; i++) { CheckBox selectCheckBox = (CheckBox)cashOutListGridView.Rows[i].Cells[10].FindControl("selectCheckBox"); Label lblSerial = (Label)cashOutListGridView.Rows[i].Cells[0].FindControl("lblSerial"); if (selectCheckBox.Checked) { Serial = lblSerial.Text; cashOuts.Add(Serial); } } if (cashOuts.Count > 0) { cashOut.ApproveTodaysCashOutBySerial(cashOuts); } GetTodaysCashOutEntryList(); string message = "Todays Cash Out Entries <span class='actionTopic'>Approved</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
protected void deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; Label lb1 = (Label)row.FindControl("lblSerial"); string id = lb1.Text; CashOutBLL cashOut = new CashOutBLL(); cashOut.DeleteTodaysCashOutEntryBySerial(id); GetTodaysCashOutEntryList(); string message = "Cash Out Entry <span class='actionTopic'>Deleted</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
//protected void LoadSalesCenters() //{ // SalesCenterBLL salesCenter = new SalesCenterBLL(); // try // { // DataTable dt = salesCenter.GetActiveSalesCenterListByUser(); // drpdwnSalesCenterOrWarehouse.DataSource = dt; // drpdwnSalesCenterOrWarehouse.DataValueField = "SalesCenterId"; // drpdwnSalesCenterOrWarehouse.DataTextField = "SalesCenterName"; // drpdwnSalesCenterOrWarehouse.DataBind(); // //drpdwnSalesCenterOrWarehouse.Items.Insert(0, ""); // //drpdwnSalesCenterOrWarehouse.SelectedIndex = 0; // drpdwnSalesCenterOrWarehouse.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // if (dt.Rows.Count < 1) // { // msgbox.Visible = true; msgTitleLabel.Text = "Joining Sales Center Data Not Found!!!"; msgDetailLabel.Text = ""; // msgbox.Attributes.Add("class", "alert alert-warning"); // } // } // catch (Exception ex) // { // string message = ex.Message; // if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } // MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); // } // finally // { // salesCenter = null; // } //} //protected void LoadTransactionBranchesByUser() //{ // UserBLL user = new UserBLL(); // try // { // DataTable dt = user.GetTransactionBranchesByUser((string)LumexSessionManager.Get("ActiveUserId")); // transactionBranchDropDownList.DataSource = dt; // transactionBranchDropDownList.DataValueField = "TransactionBranchId"; // transactionBranchDropDownList.DataTextField = "TransactionBranchName"; // transactionBranchDropDownList.DataBind(); // transactionBranchDropDownList.Items.Insert(0, ""); // transactionBranchDropDownList.SelectedIndex = 0; // } // catch (Exception ex) // { // string message = ex.Message; // if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } // MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); // } // finally // { // user = null; // } //} protected void GetTodaysCashOutEntryList() { CashOutBLL cashOut = new CashOutBLL(); try { cashOut.EntryDate = LumexLibraryManager.ParseAppDate(entryDateTextBox.Text.Trim()); cashOut.SalesCenterId = drpdwnSalesCenterOrWarehouse.SelectedValue.Trim(); cashOut.Status = ddlStatus.SelectedValue.Trim(); DataTable dt = cashOut.GetTodaysCashOutEntryList(); cashOutListGridView.DataSource = dt; cashOutListGridView.DataBind(); // bool disableApproveButton = true; for (int i = 0; i < cashOutListGridView.Rows.Count; i++) { if (cashOutListGridView.Rows[i].Cells[7].Text.Trim() != "Pending") { //LinkButton editLinkButton = (LinkButton)cashOutListGridView.Rows[i].FindControl("editLinkButton"); //editLinkButton.Visible = false; //LinkButton deleteLinkButton = (LinkButton)cashOutListGridView.Rows[i].FindControl("deleteLinkButton"); //deleteLinkButton.Visible = false; //cashOutListGridView.Rows[i].Cells[8].Visible = false; //cashOutListGridView.Rows[i].Cells[9].Visible = false; //cashOutListGridView.Rows[i].Cells[10].Visible = false; this.cashOutListGridView.Columns[8].Visible = false; this.cashOutListGridView.Columns[9].Visible = false; this.cashOutListGridView.Columns[10].Visible = false; } } if (ddlStatus.SelectedValue=="A") { approveButton.Enabled = false; } else if (ddlStatus.SelectedValue=="D") { approveButton.Enabled = false; this.cashOutListGridView.Columns[8].Visible = false; this.cashOutListGridView.Columns[9].Visible = false; this.cashOutListGridView.Columns[10].Visible = false; } else { approveButton.Enabled = true; this.cashOutListGridView.Columns[8].Visible = true; this.cashOutListGridView.Columns[9].Visible = true; this.cashOutListGridView.Columns[10].Visible = true; } if (cashOutListGridView.Rows.Count > 0) { cashOutListGridView.UseAccessibleHeader = true; cashOutListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; approveButton.Enabled = true; } else { approveButton.Enabled = false; msgbox.Visible = true; msgTitleLabel.Text = "Todays Cash Out Entry List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { cashOut = null; } }
//try // { // db.AddParameters("@SalesCenterId", salesCenterId.Trim()); // db.AddParameters("@EntryDate", entryDate); // db.AddParameters("@ApprovedBy", LumexSessionManager.Get("ActiveUserId").ToString()); // db.AddParameters("@ApprovedFrom", LumexLibraryManager.GetTerminal()); // DataTable dt = db.ExecuteDataTable("APPROVE_TODAYS_CASH_OUT_BY_SERIAL", true); // } // catch (Exception) // { // throw; // } internal void ApproveTodaysCashOutBySerial(CashOutBLL cashOut,List<string>cashOuts, LumexDBPlayer db) { try { for (int i = 0; i < cashOuts.Count; i++) { db.ClearParameters(); db.AddParameters("@Serial", cashOuts[i]); db.AddParameters("@ApprovedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@ApprovedFrom", LumexLibraryManager.GetTerminal()); DataTable dt = db.ExecuteDataTable("APPROVE_TODAYS_CASH_OUT_BY_SERIAL", true); } } catch (Exception) { throw; } }
//protected void LoadSalesCenters() //{ // SalesCenterBLL salesCenter = new SalesCenterBLL(); // try // { // DataTable dt = salesCenter.GetActiveSalesCenterListByUser(); // drpdwnSalesCenterOrWarehouse.DataSource = dt; // drpdwnSalesCenterOrWarehouse.DataValueField = "SalesCenterId"; // drpdwnSalesCenterOrWarehouse.DataTextField = "SalesCenterName"; // drpdwnSalesCenterOrWarehouse.DataBind(); // //drpdwnSalesCenterOrWarehouse.Items.Insert(0, ""); // //drpdwnSalesCenterOrWarehouse.SelectedIndex = 0; // drpdwnSalesCenterOrWarehouse.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // if (dt.Rows.Count < 1) // { // msgbox.Visible = true; msgTitleLabel.Text = "Joining Sales Center Data Not Found!!!"; msgDetailLabel.Text = ""; // msgbox.Attributes.Add("class", "alert alert-warning"); // } // } // catch (Exception ex) // { // string message = ex.Message; // if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } // MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); // } // finally // { // salesCenter = null; // } //} protected void saveButton_Click(object sender, EventArgs e) { CashOutBLL cashOut = new CashOutBLL(); try { if (amountTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Amount field is required."; } else if (narrationTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Narration field is required."; } else if (entryDateTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Entry Date field is required."; } else if (drpdwnSalesCenterOrWarehouse.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Account On field is required."; } else if(accountHeadDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Account Head field is required."; } else { cashOut.EntryDate = LumexLibraryManager.ParseAppDate(entryDateTextBox.Text.Trim()); cashOut.Amount = amountTextBox.Text.Trim(); cashOut.Narration = narrationTextBox.Text.Trim(); cashOut.SalesCenterId = drpdwnSalesCenterOrWarehouse.SelectedValue.Trim(); cashOut.AccountHEad = accountHeadDropDownList.SelectedValue.Trim(); DataTable dt = cashOut.SaveCashOutEntry(); if (dt.Rows.Count > 0) { string message = "Cash Out Entry <span class='actionTopic'>Created</span> Successfully with Serial: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/TodaysCashOut/TodaysCashOutList.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } else { string message = "<span class='actionTopic'>Failed</span> to Create Cash Out Entry."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { cashOut = null; } }