private void SaveNewTransaction() { try { TransactionDetail newTransaction = GetNewTransactionDetails(); bool result = BusinessLogic.SaveNewTransaction(newTransaction); if (result) { //Helper.ShowInformationMessageBox("New Transaction Saved successfully!", "Client Billing"); ResetClientFileGridSelection(dgClientFileList.SelectedIndex); } } catch (Exception ex) { Helper.LogException(ex); } }
private TransactionDetail GetNewTransactionDetails() { TransactionDetail newTransaction = new TransactionDetail(); try { newTransaction.TransactionID = txtItemNo.Text; newTransaction.TransactionDate = dtTransactionDate.SelectedDate.Value.ToShortDateString(); newTransaction.BillingType = cmbBillingType.SelectedValue.ToString(); newTransaction.GeneralFund = txtGeneralFund.Text; if (newTransaction.BillingType.Equals("General Account Credit") && !txtGeneralFund.Text.Contains("-")) { newTransaction.GeneralFund = "-" + txtGeneralFund.Text; } if (!string.IsNullOrEmpty(newTransaction.GeneralFund)) { float genAcc = float.Parse(newTransaction.GeneralFund); newTransaction.GeneralFund = genAcc.ToString("0.00"); } newTransaction.TrustFund = txtTrustFund.Text; if (newTransaction.BillingType.Equals("Trust Account Debit") && !txtTrustFund.Text.Contains("-")) { newTransaction.TrustFund = "-" + txtTrustFund.Text; } if (!string.IsNullOrEmpty(newTransaction.TrustFund)) { float trustAcc = float.Parse(newTransaction.TrustFund); newTransaction.TrustFund = trustAcc.ToString("0.00"); } newTransaction.CheckNo = txtCheckNo.Text; newTransaction.Description = txtDescription.Text; newTransaction.FileID = txtFileNo.Text; } catch (Exception ex) { Helper.LogException(ex); } return(newTransaction); }
private void dgTransactionDetails_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { TransactionDetail selectedTransaction = dgTransactionDetails.SelectedItem as TransactionDetail; if (selectedTransaction == null) { return; } txtItemNo.Text = selectedTransaction.TransactionID; dtTransactionDate.SelectedDate = DateTime.Parse(selectedTransaction.TransactionDate); txtDescription.Text = selectedTransaction.Description; DataTable table = new DataTable(); table.Columns.Add("BillingType"); table.Rows.Add(selectedTransaction.BillingType); cmbBillingType.DisplayMemberPath = "BillingType"; cmbBillingType.SelectedValuePath = "BillingType"; cmbBillingType.ItemsSource = table.DefaultView; cmbBillingType.SelectedIndex = 0; txtGeneralFund.Text = selectedTransaction.GeneralFund; txtTrustFund.Text = selectedTransaction.TrustFund; txtCheckNo.Text = selectedTransaction.CheckNo; if (dgTransactionDetails.Items.Count > 0) { btnDeleteTransaction.IsEnabled = true; } UpdateAccountTotals(); } catch (Exception ex) { Helper.LogException(ex); } }
private TransactionDetail GetNewTransactionDetails() { TransactionDetail newTransaction = new TransactionDetail(); try { newTransaction.TransactionID = txtItemNo.Text; newTransaction.TransactionDate = dtTransactionDate.SelectedDate.Value.ToShortDateString(); newTransaction.BillingType = cmbBillingType.SelectedValue.ToString(); newTransaction.GeneralFund = txtGeneralFund.Text; if (newTransaction.BillingType.Equals("General Account Credit") && !txtGeneralFund.Text.Contains("-")) { newTransaction.GeneralFund = "-" + txtGeneralFund.Text; } if (!string.IsNullOrEmpty(newTransaction.GeneralFund)) { float genAcc = float.Parse(newTransaction.GeneralFund); newTransaction.GeneralFund = genAcc.ToString("0.00"); } newTransaction.TrustFund = txtTrustFund.Text; if (newTransaction.BillingType.Equals("Trust Account Debit") && !txtTrustFund.Text.Contains("-")) { newTransaction.TrustFund = "-" + txtTrustFund.Text; } if (!string.IsNullOrEmpty(newTransaction.TrustFund)) { float trustAcc = float.Parse(newTransaction.TrustFund); newTransaction.TrustFund = trustAcc.ToString("0.00"); } newTransaction.CheckNo = txtCheckNo.Text; newTransaction.Description = txtDescription.Text; newTransaction.FileID = txtFileNo.Text; } catch (Exception ex) { Helper.LogException(ex); } return newTransaction; }
internal static bool UpdateTransaction(TransactionDetail newTransaction) { string query = string.Format(Constants.EDIT_TRANSACTION_QUERY, newTransaction.TransactionDate, newTransaction.Description, newTransaction.BillingType, GetNonNullIntValue(newTransaction.GeneralFund), GetNonNullIntValue(newTransaction.TrustFund), newTransaction.CheckNo, newTransaction.FileID, newTransaction.TransactionID); int rowsAffected = DBHelper.ExecuteNonQuery(query); return rowsAffected != 0; }
internal static ObservableCollection<TransactionDetail> GetAllTransactionDetails(string sql) { ObservableCollection<TransactionDetail> fileList = new ObservableCollection<TransactionDetail>(); try { var result = DBHelper.GetSelectDataSet(sql); if (result == null) return null; for (int rowIndex = 0; rowIndex < result.Tables[0].Rows.Count; rowIndex++) { TransactionDetail newTransaction = new TransactionDetail() { TransactionID = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_ID].ToString(), TransactionDate = DateTime.Parse(result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_DATE].ToString()).ToShortDateString(), Description = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_DESCRIPTION].ToString(), BillingType = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_BILLING_TYPE].ToString(), GeneralFund = float.Parse(result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_GENERAL_FUND].ToString()).ToString("0.00"), //GeneralFund = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_GENERAL_FUND].ToString(), //TrustFund = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_TRUST_FUND].ToString(), TrustFund = float.Parse(result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_TRUST_FUND].ToString()).ToString("0.00"), CheckNo = result.Tables[0].Rows[rowIndex][Constants.TRANSACTION_CHECK_NO].ToString(), }; newTransaction.GeneralFund = newTransaction.GeneralFund; newTransaction.TrustFund = newTransaction.TrustFund; fileList.Add(newTransaction); } } catch (Exception ex) { throw ex; } return fileList; }
public bool ContainsTransaction(object value) { try { TransactionDetail currentRow = value as TransactionDetail; if (dgTransactionDetails.Columns.Count > 1) { //There is more than 1 column in DataGrid //FileInformation currentRow = value as FileInformation; if (currentRow != null) { if (currentRow.BillingType.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.CheckNo.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.TransactionDate.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.TransactionID.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.Description.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower())) { return(true); } } } else { if (currentRow.BillingType.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.CheckNo.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.TransactionDate.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.TransactionID.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower()) || currentRow.Description.ToString() .ToLower() .Contains(txtSearchTransaction.Text .ToLower())) { return(true); } } } catch (Exception ex) { Helper.LogException(ex); } return(false); }