// if you change something here - make sure you also changing the way polling populates the manifest to keep constistency
        private static void ParseTabsWithItems(RecipientStatus recipient, DocuSignRecipientStatus docusignRecipient)
        {
            //handle radio group tabs
            foreach (var radioGroup in recipient.TabStatuses.Where(a => a.CustomTabType == CustomTabType.Radio).GroupBy(a => a.TabLabel))
            {
                var first_tab_ingroup = radioGroup.First();
                var radioGroupTab     = ParseTab(first_tab_ingroup);

                if (radioGroup.Count() > 0)
                {
                    foreach (var tab_ingroup in radioGroup)
                    {
                        var childTab = ParseTab(tab_ingroup);
                        radioGroupTab.Items.Add(childTab);
                        childTab.Selected = (childTab.Value != null).ToString();
                    }
                }
                else
                // <TabValue>X</TabValue> <- this is how it arrives with connect
                {
                    radioGroupTab.Selected = (radioGroupTab.Value != null).ToString();
                }
                docusignRecipient.Tabs.Add(radioGroupTab);
            }

            //handle list tabs
            foreach (var dslisttab in recipient.TabStatuses.Where(a => a.CustomTabType == CustomTabType.List))
            {
                DocuSignTabStatus listtab = ParseTab(dslisttab);

                string[] values = dslisttab.TabName.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); //yes, TabName
                foreach (var ddlbvalue in values)
                {
                    var childItem = new DocuSignTabStatus();
                    childItem.TabLabel = ddlbvalue;
                    childItem.Value    = ddlbvalue;
                    childItem.Selected = false.ToString();
                    listtab.Items.Add(childItem);
                }

                //choose selected
                var selectedItem = listtab.Items.Where(a => a.Value == dslisttab.ListSelectedValue).FirstOrDefault();
                if (selectedItem != null)
                {
                    selectedItem.Selected = true.ToString();
                }

                docusignRecipient.Tabs.Add(listtab);
            }
        }
예제 #2
0
        protected RecipientStatus AddEPiServerGroupRecipients(IEmailImporter importer, string groupName)
        {
            RecipientStatus status = new RecipientStatus();

            List <string> addresses = new List <string>();

            string[] usersInRole = Roles.GetUsersInRole(groupName);

            foreach (string userName in usersInRole)
            {
                MembershipUser user = Membership.GetUser(userName);
                if (user != null && string.IsNullOrEmpty(user.Email) == false)
                {
                    addresses.Add(user.Email);
                }
            }

            if (addresses.Count == 0)
            {
                status.Status = "Could not find any email addresses for users in the EPiServer group.";
                return(status);
            }

            // Add the items
            List <string> duplicateAddresses;
            List <string> invalidAddresses;

            System.Diagnostics.Stopwatch tmr = System.Diagnostics.Stopwatch.StartNew();
            int count = importer.ImportEmailAddresses(addresses.ToArray(), out invalidAddresses, out duplicateAddresses);

            tmr.Stop();

            if (invalidAddresses.Count > 0)
            {
                status.InvalidMessage = string.Join(", ", invalidAddresses.ToArray());
            }

            status.ImportedEmails   = count;
            status.DuplicatedEmails = duplicateAddresses.Count;
            status.InvalidEmails    = invalidAddresses.Count;
            status.TimeToImport     = tmr.ElapsedMilliseconds;
            status.Status           = "Import ok";

            return(status);
        }
예제 #3
0
        public HttpResponseMessage AddRecipientsToListFromList(int sourceListId, int destinationListId)
        {
            RecipientList destList   = RecipientList.Load(destinationListId);
            RecipientList sourceList = RecipientList.Load(sourceListId);

            if (destList != null && sourceList != null)
            {
                int             addedAddresses = destList.AddRecipientItemsFromRecipientList(sourceList.Id);
                RecipientStatus status         = new RecipientStatus {
                    ImportedEmails = addedAddresses
                };

                return(Request.CreateResponse(HttpStatusCode.OK,
                                              GetJsonResult <RecipientStatus>(status)));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Source or Destination list not found"));
        }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 internal void InitializeInstance(Int32 collector, string email, string recipientKey)
 {
     m_recipientId      = default(Int64);
     m_collector        = collector;
     m_recipientKey     = recipientKey;
     m_email            = email;
     m_firstName        = default(string);
     m_lastName         = default(string);
     m_title            = default(string);
     m_customValue      = default(string);
     m_status           = default(RecipientStatus);
     m_attributeFlags   = default(Int32);
     m_personalPassword = default(string);
     m_activationDate   = null;
     m_validFromDate    = null;
     m_validToDate      = null;
     m_expireAfter      = default(Int16);
     m_expirationDate   = null;
 }
예제 #5
0
        public HttpResponseMessage AddRecipientsToJobFromList(int sourceListId, int jobId)
        {
            Job job = Job.Load(jobId);

            if (job == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Job not found"));
            }
            RecipientList sourceList = RecipientList.Load(sourceListId);

            if (sourceList == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Source list not found"));
            }

            int             addedAddresses = job.AddWorkItemsFromRecipientList(sourceList.Id);
            RecipientStatus status         = new RecipientStatus {
                ImportedEmails = addedAddresses
            };

            return(Request.CreateResponse(HttpStatusCode.OK, GetJsonResult <RecipientStatus>(status)));
        }
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Bool)
                        {
                            ReminderNotifyEmail = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Bool)
                        {
                            ReminderNotifyInApp = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Bool)
                        {
                            InMyList = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.String)
                        {
                            Stack = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.I32)
                        {
                            RecipientStatus = (RecipientStatus)iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }