/// <summary> /// Saves the state of the action. /// </summary> private void SaveActionState(bool setInit) { ImportManager importManager = GetImportManager(); Action = importManager.ActionManager.GetAction("AddNote") as ActionAddNote; Action.History.LongNotes = txtNotes.Text; Action.History.Category = pklCategory.PickListValue; Action.History.Description = pklDescription.PickListValue; Action.History.Timeless = chkTimeless.Checked; //Action.History.UserId = slxUser.LookupResultValue.ToString(); Action.History.Duration = dpDuration.Value; if (dtpStartDate.DateTimeValue == null) { Action.History.StartDate = DateTime.UtcNow; } else { Action.History.StartDate = (DateTime)dtpStartDate.DateTimeValue; } if (!Action.Initialized && setInit) { Action.Initialized = true; Action.Active = true; } Action.SaveChanges(); Page.Session["importManager"] = importManager; }
/// <summary> /// Sets the state of the action. /// </summary> private void SetActionState() { ImportManager importManager = GetImportManager(); Action = importManager.ActionManager.GetAction("AddNote") as ActionAddNote; Action.HydrateChanges(); txtNotes.Text = Action.History.LongNotes; pklCategory.PickListValue = Action.History.Category; pklDescription.PickListValue = Action.History.Description; chkTimeless.Checked = Action.History.Timeless; dpDuration.Value = Action.History.Duration; dtpStartDate.Timeless = chkTimeless.Checked; dtpStartDate.DisplayTime = !chkTimeless.Checked; dtpStartDate.DateTimeValue = Action.History.StartDate; dpDuration.Enabled = !chkTimeless.Checked; }