private void AddDefaultSession(DayEntry activity) { // Clear the sessions from the previously selected row, and show a blank row Sessions.SetCurrentActivity(activity.Activity, 0); dev1_session session = new dev1_session(); session.Account = activity.Account; session.dev1_ActivityId = activity.Activity.Id.ToString(); session.dev1_ActivityTypeName = activity.Activity.LogicalName; session.dev1_ActivityId = activity.Activity.Id.ToString(); session.dev1_StartTime = Sessions.WeekStart; session.activitypointer_subject = activity.Activity.Name; session.activitypointer_regardingobjectid = activity.RegardingObjectId; Sessions.SelectedActivity = activity.Activity; session.dev1_Row = this.Sessions.GetCurrentWeek().Count; // Has the account been set - if not we need to look it up from the selected activity if (session.Account == null || session.activitypointer_regardingobjectid == null) { SetAccountAndRegardingFromActivity(session); } Sessions.AddItem(session); _selectedRows = new SelectedRange[1] { new SelectedRange() }; _selectedRows[0].FromRow = rows.Count + 1; _selectedRows[0].ToRow = rows.Count + 1; }
public override void AddItem(object item) { dev1_session session = new dev1_session(); DayEntry activity = (DayEntry)item; if ((activity.Activity != null) && (activity.Activity.Id != null)) { session.dev1_ActivityId = activity.Activity.Id.ToString(); session.dev1_ActivityTypeName = activity.Activity.LogicalName; //session.activityName = activity.Activity.Name; session.dev1_ActivityId = activity.Activity.Id.ToString(); session.dev1_StartTime = sessions.WeekStart; sessions.SelectedActivity = activity.Activity; sessions.AddItem(session); _selectedRows = new SelectedRange[1] { new SelectedRange() }; _selectedRows[0].FromRow = rows.Count + 1; _selectedRows[0].ToRow = rows.Count + 1; Refresh(); } }