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 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); } }