private void buttonJournalFilter_Click(object sender, EventArgs e) { listViewJournal.Items.Clear(); if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex) { return; } CharacterObject charObj = (CharacterObject) this.toolStripComboBoxCharacterSelection.SelectedItem; CharacterJournalCollection col = new CharacterJournalCollection(); IDBCollection icol = col as IDBCollection; JournalFilterObject obj = comboBoxJournalFilter.SelectedItem as JournalFilterObject; if (null != obj) { if (1 == obj.Count) { icol.SetConstraint((long)CharacterJournal.QueryValues.refType, new DBConstraint(DBConstraint.QueryConstraints.Equal, obj.Value(0))); } else if (0 != obj.Count) { throw new NotImplementedException(); } } DateTime start = dateTimePickerCharJournalStart.Value; DateTime end = dateTimePickerCharJournalEnd.Value; if (!checkBoxCharJournalStartUseTime.Checked) { start = start.Date; } if (!checkBoxCharJournalEndUseTime.Checked) { end = end.Date.AddDays(1).AddSeconds(-1); } icol.SetConstraint((long)CharacterJournal.QueryValues.CharID, new DBConstraint(DBConstraint.QueryConstraints.Equal, long.Parse(charObj.CharID))); icol.SetConstraint((long)CharacterJournal.QueryValues.date, new DBConstraint(DBConstraint.QueryConstraints.Between, start.ToOADate(), end.ToOADate())); icol.SetSortConstraint((long)CharacterJournal.QueryValues.date, new DBSortConstraint(DBSortConstraint.SortConstraints.Ascending)); if (Database.DatabaseError.NoError == this.m_db.ReadRecord(icol)) { IDBCollectionContents icolcon = col as IDBCollectionContents; for (long i = 0; i < icolcon.Count(); ++i) { listViewJournal.Items.Add(new JournalListViewItem(icolcon.GetRecordInterface(i).GetDataObject() as JournalObject)); } //listViewJournal.Items.Add(new JournalListViewItem(null)); } }
private void buttonCorpMissioner_Click(object sender, EventArgs e) { CorpMissionerTotal = 0; CorpMissionerRuns = 0; CorpMissionerPeople.Clear(); if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex) { return; } Character.CharacterObject charObj = (Character.CharacterObject) this.toolStripComboBoxCharacterSelection.SelectedItem; DateTime start = dateTimePickerCorpMissionerStart.Value; DateTime end = dateTimePickerCorpMissionerEnd.Value; start = start.Date; end = end.Date.AddDays(1).AddSeconds(-1); int[] types = { 33, 34, 85 }; foreach (int typ in types) { CorporationJournalCollection col = new CorporationJournalCollection(); IDBCollection icol = col as IDBCollection; icol.SetConstraint((long)CorporationJournal.QueryValues.CorpID, new DBConstraint(DBConstraint.QueryConstraints.Equal, charObj.CorpID)); icol.SetConstraint((long)CorporationJournal.QueryValues.Division, new DBConstraint(DBConstraint.QueryConstraints.Equal, 1000)); // set date range icol.SetConstraint((long)CorporationJournal.QueryValues.date, new DBConstraint(DBConstraint.QueryConstraints.Between, start.ToOADate(), end.ToOADate())); // set Sorting icol.SetSortConstraint((long)CorporationJournal.QueryValues.ownerName2, new DBSortConstraint(DBSortConstraint.SortConstraints.Ascending)); // do Agent Rewards icol.SetConstraint((long)CorporationJournal.QueryValues.refType, new DBConstraint(DBConstraint.QueryConstraints.Equal, typ)); if (Database.DatabaseError.NoError == m_db.ReadRecord(icol)) { IDBCollectionContents icolcon = col as IDBCollectionContents; for (long i = 0; i < icolcon.Count(); ++i) { InsertMissionerRecord(icolcon.GetRecordInterface(i).GetDataObject() as JournalObject, typ); } } } CorpMissionerPeople.Sort(delegate(CorpMissionerPerson p1, CorpMissionerPerson p2) { return(p2.Total.CompareTo(p1.Total)); }); this.listViewCorpMissioner.Items.Clear(); foreach (CorpMissionerPerson person in CorpMissionerPeople) { ListViewItem item = new ListViewItem(); item.Text = person.Name; item.SubItems.Add(person.Runs.ToString()); item.SubItems.Add(string.Format("{0:#,##0.00;(#,##0.00);''}", person.Total)); this.listViewCorpMissioner.Items.Add(item); } ListViewItem itemTotal = new ListViewItem(); itemTotal.Text = "Total"; itemTotal.SubItems.Add(CorpMissionerRuns.ToString()); itemTotal.SubItems.Add(string.Format("{0:#,##0.00;(#,##0.00);''}", CorpMissionerTotal)); this.listViewCorpMissioner.Items.Add(itemTotal); }