//Aggregated Account Display Methods private void loadlstTransactions() { // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter = new ListViewColumnSorter(); this.lstTransactions.ListViewItemSorter = lvwColumnSorter; lstTransactions.BeginUpdate(); lstTransactions.Clear(); buildlstTransactionsColumns(); if (!dbcTransactions.isEmpty()) { int recordCount = 0; foreach (DataRow row in dbcTransactions.getDT().Rows) { ListViewItem listItem = new ListViewItem(row["refTransTypeDesc"].ToString()); listItem.Name = recordCount + "!" + row["TransID"].ToString(); // listItem.SubItems.Add(row["refTransTypeSubDesc"].ToString()); // if (row["EmpID"].ToString() != "") //Harry 01062016 { var names = row["VendName"].ToString().TrimEnd().Split(' '); string lastName; if (names[names.Length - 1].IndexOf('(') != -1) { lastName = names[names.Length - 2]; } else { lastName = names[names.Length - 1]; } //string temp = lastName + " " + row["VendName"].ToString().Replace(lastName, ""); listItem.SubItems.Add(lastName + ", " + row["VendName"].ToString().Replace(lastName, "")); } else { listItem.SubItems.Add(row["VendName"].ToString()); } listItem.SubItems.Add(row["EmpUIN"].ToString()); listItem.SubItems.Add(row["PostingDate"].ToString()); // // listItem.SubItems.Add(row["TransactionDate"].ToString()); // listItem.SubItems.Add(row["theUnitID"].ToString()); // listItem.SubItems.Add(row["FundType"].ToString() + " " + row["DeptID"].ToString() + " " + row["FundProject"].ToString() + " " + row["FundClass"].ToString()); // listItem.SubItems.Add(row["GL"].ToString()); listItem.SubItems.Add(String.Format(nfi, "{0:c}", double.Parse(UtilityParser.passEmptyNumber(row["TransAmount"].ToString())))); // listItem.SubItems.Add(String.Format(nfi, "{0:c}", double.Parse(UtilityParser.passEmptyNumber(row["TransAmountRemainder"].ToString())))); // listItem.SubItems.Add(row["TransDesc"].ToString()); // listItem.SubItems.Add(row["StatusDesc"].ToString()); // listItem.SubItems.Add(row["TransBiReference"].ToString()); listItem.SubItems.Add(UtilityDates.convertFormatedDateToSortableString(row["PostingDate"].ToString())); // listItem.SubItems.Add(UtilityDates.convertFormatedDateToSortableString(row["TransactionDate"].ToString())); listItem.SubItems.Add(row["TransAmount"].ToString().PadLeft(12, '0')); listItem.SubItems.Add(row["TransAmountRemainder"].ToString().PadLeft(12, '0')); lstTransactions.Items.Add(listItem); recordCount++; } } lstTransactions.EndUpdate(); this.Cursor = Cursors.Default; }
private void loadLstPayroll() { try { // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter_lstPayroll = new ListViewColumnSorter(); this.lstPayroll.ListViewItemSorter = lvwColumnSorter_lstPayroll; fillDBCPayroll(); lstPayroll.BeginUpdate(); lstPayroll.Clear(); buildLstPayrollColumns(); int recordCount = 0; foreach (DataRow row in dbcPayroll.getDT().Rows) { ListViewItem listItem = new ListViewItem(row["EmpNameFirst"].ToString() + " " + row["EmpNameLast"].ToString()); listItem.Name = recordCount + "!" + row["EmpAppointID"].ToString(); // index for record in dbConnector + empAppointID listItem.SubItems.Add(row["UnitID"].ToString()); listItem.SubItems.Add(row["EmpTypeDesc"].ToString()); listItem.SubItems.Add(row["EmpAppTypeDesc"].ToString()); listItem.SubItems.Add(row["DeptID"].ToString()); listItem.SubItems.Add(row["FundType"].ToString()); listItem.SubItems.Add(row["FundProjClass"].ToString()); listItem.SubItems.Add(String.Format(nfi, "{0:c}", double.Parse(row["EmpAppointFTCompRate"].ToString()))); listItem.SubItems.Add(String.Format("{0:0.##}", row["EmpAppointTimeBase"].ToString())); listItem.SubItems.Add(String.Format(nfi, "{0:c}", double.Parse(row["EmpAppointSalary"].ToString()))); listItem.SubItems.Add(row["JobCodeID"].ToString()); listItem.SubItems.Add(row["PayrollDateStart"].ToString()); listItem.SubItems.Add(row["PayrollDateEnd"].ToString()); listItem.SubItems.Add(row["EmpAppointPositionNum"].ToString()); listItem.SubItems.Add(row["GLNumber"].ToString()); listItem.SubItems.Add(row["EtracDateStart"].ToString()); listItem.SubItems.Add(row["EtracDateEnd"].ToString()); //SORT COLUMNS listItem.SubItems.Add(UtilityDates.convertFormatedDateToSortableString(row["PayrollDateStart"].ToString())); listItem.SubItems.Add(UtilityDates.convertFormatedDateToSortableString(row["PayrollDateEnd"].ToString())); listItem.SubItems.Add(row["EmpAppointFTCompRate"].ToString().PadLeft(12, '0')); listItem.SubItems.Add(row["EmpAppointSalary"].ToString().PadLeft(12, '0')); listItem.SubItems.Add(row["EmpNameLast"].ToString()); lstPayroll.Items.Add(listItem); recordCount++; // get count of records added to lstPayroll } lstPayroll.EndUpdate(); lblPendingPayrollCount.Text = recordCount.ToString(); } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } }