private void LoadAllActiveAccounts() { DailyEntries.AllActiveAccounts = DBClass.Reader("Select * from Accounts where IsClosed=0 and OpeningDate<@OpeningDate and AccountID not in(Select DailyTransactions.AccountID from DailyTransactions where DailyTransactions.TransactionDate=@TransactionDate)", System.Data.CommandType.Text, new SqlParameter("@TransactionDate", BasePage.GetSystemDate), new SqlParameter("@OpeningDate", GetSystemDate)); LoadNextActiveAccount(); }
protected void frmDisplayPersonalDetails_DataBound(object sender, EventArgs e) { int AccountID; if (grdAccounts.SelectedDataKey != null) { int.TryParse(grdAccounts.SelectedDataKey.Value.ToString(), out AccountID); string txt = ((Label)frmDisplayPersonalDetails.FindControl("txtTotalAmountCollected")).Text; txt = txt + String.Format("{0:#.##}", DBClass.Scalar("Select sum(Amount) from DailyTransactions where AccountID=@AccountID", System.Data.CommandType.Text, new SqlParameter("@AccountID", AccountID))); ((Label)frmDisplayPersonalDetails.FindControl("txtTotalAmountCollected")).Text = txt; txt = ((Label)frmDisplayPersonalDetails.FindControl("txtLastTransactionDate")).Text; SqlDataReader dr = DBClass.Reader("Select TransactionDate from DailyTransactions where AccountID=@AccountID order by TransactionDate DESC", System.Data.CommandType.Text, new SqlParameter("@AccountID", AccountID)); if (dr.Read()) { txt = txt + String.Format("{0:dd-MMM-yyyy}", dr[0]); } ((Label)frmDisplayPersonalDetails.FindControl("txtLastTransactionDate")).Text = txt; dr.Close(); } else { Response.Redirect("~/SomethingWentWrong.aspx"); } }
private void GetVisibilityStatus() { SqlDataReader dr = DBClass.Reader("SELECT Name, NoOfAccountsLinked, Address, PhoneNo, MobileNo, Age, DOB, CustomerUID, CustomerPanID, CustomerElectionID, Gender, CreatedOn, ModifiedOn, IsDiscontinued, DiscontinuedOn FROM CustomerConfigurations"); int index = 0; if (dr != null) { if (dr.Read()) { foreach (DataControlField c in grdCustomers.Columns) { if (c.HeaderText == "Name" || c.HeaderText == "No. of <br/>Accounts Linked" || c.HeaderText == "Address" || c.HeaderText == "Phone No" || c.HeaderText == "Mobile No" || c.HeaderText == "Age" || c.HeaderText == "Date of Birth" || c.HeaderText == "Aadhar-card No" || c.HeaderText == "Pan-card No" || c.HeaderText == "Election-card No" || c.HeaderText == "Gender" || c.HeaderText == "Created On" || c.HeaderText == "Modified On" || c.HeaderText == "Discontinue" || c.HeaderText == "Discontinued On") { string value = dr[index++].ToString(); if (value == "False") { c.Visible = false; } else { c.Visible = true; } } } } } }