private void LoadList() { GJournals clsGJournals = new GJournals(); DataClass clsDataClass = new DataClass(); string SortField = "GJournalID"; if (Request.QueryString["sortfield"]!=null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"]!=null) { sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } if (Request.QueryString["Search"]==null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsGJournals.List(SortField, sortoption)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsGJournals.Search(SearchKey, SortField, sortoption)).DefaultView; } clsGJournals.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }
private bool Cancel() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { GJournals clsGJournals = new GJournals(); clsGJournals.Cancel( stIDs.Substring(0,stIDs.Length-1)); clsGJournals.CommitAndDispose(); } return boRetValue; }
private void SaveRecord(string Sender) { ComputeGJournal(Sender); GJournalsDetails clsDetails = new GJournalsDetails(); clsDetails.GJournalID = Convert.ToInt64(lblGJournalID.Text); clsDetails.Particulars = txtRemarks.Text; clsDetails.TotalDebitAmount = Convert.ToDecimal(lblTotalDebitAmount.Text); clsDetails.TotalCreditAmount = Convert.ToDecimal(lblTotalCreditAmount.Text); GJournals clsGJournals = new GJournals(); clsGJournals.GetConnection(); lblGJournalID.Text = clsGJournals.Insert(clsDetails).ToString(); clsGJournals.CommitAndDispose(); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["GJournalid"],Session.SessionID)); GJournals clsGJournals = new GJournals(); GJournalsDetails clsDetails = clsGJournals.Details(iID); clsGJournals.CommitAndDispose(); lblGJournalID.Text = clsDetails.GJournalID.ToString(); lblRemarks.Text = clsDetails.Particulars; lblTotalDebitAmount.Text = clsDetails.TotalDebitAmount.ToString("#,##0.#0"); lblTotalCreditAmount.Text = clsDetails.TotalCreditAmount.ToString("#,##0.#0"); lblTotalAmount.Text = Convert.ToDecimal(clsDetails.TotalDebitAmount - clsDetails.TotalCreditAmount).ToString("#,##0.#0"); LoadItems(); }
private void Postjournal() { try { decimal decTotalAmount = Convert.ToDecimal(lblTotalAmount.Text); if (decTotalAmount == 0) { decimal decTotalDebitAmount = Convert.ToDecimal(lblTotalDebitAmount.Text); DateTime PostingDate = Convert.ToDateTime(txtPostingDate.Text + " " + DateTime.Now.ToString("HH:mm")); long lGJournalID = Convert.ToInt64(lblGJournalID.Text); GJournals clsGJournals = new GJournals(); clsGJournals.GetConnection(); clsGJournals.Post(lGJournalID, PostingDate); clsGJournals.CommitAndDispose(); Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID)); } else { //lblReferrer.Text = "Cannot post journal, the debit/credit amount should be equal. Please check the posted accounts."; string stScript = "<Script>"; stScript += "window.alert('Cannot post journal, the debit/credit amount should be equal. Please check the posted accounts.')"; stScript += "</Script>"; Response.Write(stScript); } } catch (Exception ex) { lblReferrer.Text= "'Cannot post journal. unexpected error occurred: " + ex.ToString(); string stScript = "<Script>"; stScript += "window.alert('Cannot post journal. unexpected error occurred: " + ex.ToString() + "')" ; stScript += "</Script>"; Response.Write(stScript); } }