private void AddSelecteEventsToListEvent(DataGridView SourceDGV, List <ViewEventItem> SourceList, DataGridView TargetDGV, List <InputEventItem> TargetList) { try { int n = SourceDGV.SelectedRows.Count - 1; for (int i = 0; i < SourceDGV.SelectedRows.Count; i++) { string name = SourceDGV.SelectedRows[n - i].Cells["Name"].Value.ToString(); string cty = ""; try { cty = SourceDGV.SelectedRows[n - i].Cells["Category"].Value.ToString(); } catch { } if (String.IsNullOrEmpty(name)) { continue; } foreach (var itr in SourceList) { if (itr.Name == name) { if (cty != "" && !String.IsNullOrEmpty(itr.Category) && itr.Category != cty) { continue; } bool exist = false; foreach (var evt in TargetList) { if (evt.Name == itr.Name && evt.Category == itr.Category) { exist = true; break; } } if (!exist) { InputEventItem newEv = new InputEventItem(itr); TargetList.Add(newEv); //if (TargetDGV.Name == "dataGridViewCurResult") LoadCurTimetable(); } break; } } } BindInputEventItems(TargetList, TargetDGV); } catch { } }
public Event(InputEventItem InEv, DateTime CurDate) : this(InEv.Name, InEv.Category, InEv.Status, InEv.Memo) { if (Event.LastId != 0) { this.Id = "E" + String.Format("{0:D7}", ++LastId); } DateTime date = CurDate; if (!String.IsNullOrEmpty(InEv.Date)) { date = UltilityConvert.ToDate(InEv.Date); } Items.Add(new EventItem(InEv, date)); }
public EventItem(InputEventItem InEv, DateTime CurDate) { this.Date = CurDate; this.Time = UltilityConvert.ToDoble(InEv.Time); this.Memo = InEv.Memo; }