Exemplo n.º 1
0
        //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;
        }