private void OnWorkflowActivated_Invoked(object sender, ExternalDataEventArgs e)
        {
            using (StringReader stringReader = new StringReader(workflowProperties.InitiationData))
            {
                using (XmlReader reader = XmlReader.Create(stringReader))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(AgendaWFData));
                    WorkflowData = (AgendaWFData)serializer.Deserialize(reader);
                }
            }
            SetAgendaTitle();

            notifyAgendaOwner.Action = "Complete";
            notifyAgendaOwner.Source = "Paperless Board";
            notifyAgendaOwner.TaskTitle = string.Format("Clean document(s) for '{0}' and start the Collect-Digital-Signatures workflow.", AgendaTitle);
            notifyAgendaOwner.TaskDescription = string.Format("The Board Agenda workflow has been completed for Agenda {0}. The owner/sponsor of this agenda item now needs to start the Collect Digital Signatures workflow for this agenda.", AgendaTitle);
            notifyAgendaOwner.TaskDueDate = DateTime.Today.AddDays(1);

            SPUser originator = GetSPUser(this.workflowProperties.Item, "Sponsor");
            notifyAgendaOwner.TaskAssignedTo = originator.LoginName;

            notifyAgendaOwnerAboutComments.Action = "Complete";
            notifyAgendaOwnerAboutComments.Source = "Paperless Board";
            notifyAgendaOwnerAboutComments.TaskTitle = string.Format("Edit documents with GM Comments '{0}' and resubmit to GM.", AgendaTitle);
            notifyAgendaOwnerAboutComments.TaskDescription = string.Format("The GM has added comments for this agenda which need to be incorporated into the documents before resubmitting to the DGM and CBSS.", AgendaTitle);
            notifyAgendaOwnerAboutComments.TaskDueDate = DateTime.Today.AddDays(1);

            notifyAgendaOwnerAboutComments.TaskAssignedTo = originator.LoginName;
        }
Пример #2
0
        internal string SerializePagetoXml()
        {
            List<string> userNamesList = new List<string>();
            int adHocUsers = 0;
            foreach(PickerEntity pe in userPicker.Entities)
            {
                adHocUsers++;
                userNamesList.Add(pe.Description);
            }

            AgendaWFData data = new AgendaWFData()
            {
                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(),
                IsExpedited = chkExpedited.Checked.ToString(),
                Expedited_CBSSSelected = chk_cbss.Checked.ToString(),
                Expedited_DGMSelected = chk_dgm.Checked.ToString(),
                Executive_Director = chk_executive_director.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(AgendaWFData));
                serializer.Serialize(stream, data);
                stream.Position = 0;
                byte[] bytes = new byte[stream.Length];
                stream.Read(bytes, 0, bytes.Length);

                return Encoding.UTF8.GetString(bytes);
            }
        }