private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e) { using (StringReader stringReader = new StringReader(workflowProperties.InitiationData)) { using (XmlReader reader = XmlReader.Create(stringReader)) { XmlSerializer serializer = new XmlSerializer(typeof(ReviewWFData)); WorkflowData = (ReviewWFData)serializer.Deserialize(reader); } } SetReviewers(); SetAgendaTitle(); notifyAgendaOwner.Action = "Complete"; notifyAgendaOwner.Source = "Paperless Board"; notifyAgendaOwner.TaskTitle = string.Format("Edit documents for '{0}', and then start the Board Agenda Workflow.", AgendaTitle); notifyAgendaOwner.TaskDescription = string.Format("All the reviewers have finished reviewing content for this agenda. The Review Agenda workflow has been completed for Agenda {0}. The owner/sponsor of this agenda item now needs to start the Board Agenda workflow for this agenda.", AgendaTitle); notifyAgendaOwner.TaskDueDate = DateTime.Today.AddDays(1); SPUser originator = GetSPUser(this.workflowProperties.Item, "Sponsor"); notifyAgendaOwner.TaskAssignedTo = originator.LoginName; }
internal string SerializePagetoXml() { List<string> userNamesList = new List<string>(); int adHocUsers = 0; foreach(PickerEntity pe in userPicker.Entities) { adHocUsers++; userNamesList.Add(string.Format("i:0#.w|{0}", pe.Description)); } ReviewWFData data = new ReviewWFData() { AdHocUserNames = string.Join(";", userNamesList.ToArray()), AGM_Audit = chk_agm_audit.Checked.ToString(), AGM_BusOperations = chk_agm_busoperations.Checked.ToString(), AGM_Communications = chk_agm_communications.Checked.ToString(), AGM_Contracts = chk_agm_contracts.Checked.ToString(), AGM_Finance = chk_agm_finance.Checked.ToString(), AGM_HumanResource = chk_agm_humanresources.Checked.ToString(), AGM_IT = chk_agm_it.Checked.ToString(), AGM_Legal = chk_agm_legal.Checked.ToString(), AGM_Planning = chk_agm_planning.Checked.ToString(), AGM_Police = chk_agm_police.Checked.ToString(), AGM_RaiOperations = chk_agm_railoperations.Checked.ToString(), AGM_Safety = chk_agm_safety.Checked.ToString(), CBSSSelected = chk_cbss.Checked.ToString(), DGMSelected = chk_dgm.Checked.ToString(), Executive_Director = chk_executive_director.Checked.ToString(), GMSelected = chk_gm.Checked.ToString() }; data.AdHocUser1Selected = "false"; data.AdHocUser2Selected = "false"; data.AdHocUser3Selected = "false"; data.AdHocUser4Selected = "false"; if (userNamesList.Count == 1) { data.AdHocUser1 = userNamesList[0]; data.AdHocUser1Selected = "true"; } if (userNamesList.Count == 2) { data.AdHocUser1 = userNamesList[0]; data.AdHocUser2 = userNamesList[1]; data.AdHocUser1Selected = "true"; data.AdHocUser2Selected = "true"; } if (userNamesList.Count == 3) { data.AdHocUser1 = userNamesList[0]; data.AdHocUser2 = userNamesList[1]; data.AdHocUser3 = userNamesList[2]; data.AdHocUser1Selected = "true"; data.AdHocUser2Selected = "true"; data.AdHocUser3Selected = "true"; } if (userNamesList.Count >= 4) { data.AdHocUser1 = userNamesList[0]; data.AdHocUser2 = userNamesList[1]; data.AdHocUser3 = userNamesList[2]; data.AdHocUser4 = userNamesList[3]; data.AdHocUser1Selected = "true"; data.AdHocUser2Selected = "true"; data.AdHocUser3Selected = "true"; data.AdHocUser4Selected = "true"; } using (MemoryStream stream = new MemoryStream()) { XmlSerializer serializer = new XmlSerializer(typeof(ReviewWFData)); serializer.Serialize(stream, data); stream.Position = 0; byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); return Encoding.UTF8.GetString(bytes); } }