コード例 #1
0
        private bool SelectNameCompleted()
        {
            if (string.IsNullOrEmpty(this.RecipientListName.Value))
            {
                SheerResponse.Alert(EcmTexts.Localize("Please enter a valid name.", new object[0]), new string[0]);
                return(false);
            }
            List <TargetAudience> taList  = Root.GetTargetAudiences();
            List <string>         taNames = new List <string>();

            foreach (TargetAudience ta in taList)
            {
                taNames.Add(ta.Name);
            }
            if (taNames.Contains(this.RecipientListName.Value))
            {
                SheerResponse.Alert(EcmTexts.Localize("The '{0}' list already exists, please choose another name.", new object[] { this.RecipientListName.Value }), new string[0]);
                return(false);
            }
            return(true);
        }
コード例 #2
0
        private Response GetEmailLandingPagesReportResponse(string messageId, string language, SortParameter sortParameter, DataPage page)
        {
            if (sortParameter == null)
            {
                sortParameter = new SortParameter("Value", SortDirection.Desc);
            }
            MessageReportResponse <EmailLandingPagesReportModel> response = new MessageReportResponse <EmailLandingPagesReportModel>();

            try
            {
                DataTable dataTable = this.emailLandingPagesRepository.GetEmailLandingPagesData(new Guid(messageId), language, sortParameter);
                response.Results    = this.Convert(dataTable, page).ToArray();
                response.TotalCount = dataTable.Rows.Count;
            }
            catch (Exception exception)
            {
                Log.Error(exception.Message, exception, this);
                response.Error        = true;
                response.ErrorMessage = EcmTexts.Localize("A serious error occurred please contact the administrator", new object[0]);
            }
            return(response);
        }
コード例 #3
0
        protected void Run(ClientPipelineArgs args)
        {
            if (!args.IsPostBack)
            {
                SheerResponse.CheckModified(true);
                args.WaitForPostBack();
            }
            else if (args.Result != "cancel")
            {
                if (args.HasResult && (args.Result != "cancel"))
                {
                    if ((args.Result == "yes") || (args.Result == "no"))
                    {
                        if (args.Result == "yes")
                        {
                            this.SaveChanges();
                        }
                        string rname = args.Parameters["rname"];
                        SheerResponse.Input(EcmTexts.Localize("Enter the new name of the new Recipient List:", new object[0]), rname, Settings.ItemNameValidation, EcmTexts.Localize("'{0}' is not a valid name.", new object[] { "$Input" }), 100);
                        args.WaitForPostBack();
                    }
                    else
                    {
                        string rid = args.Parameters["rid"];

                        if (RenameList(rid, args.Result))
                        {
                            NotificationManager.Instance.Notify("RefreshRecipientLists", new EventArgs());
                        }
                        else
                        {
                            SheerResponse.Alert(EcmTexts.Localize("The '{0}' list already exists, please choose another name.", new object[] { args.Result }), new string[0]);
                        }
                    }
                }
            }
        }
コード例 #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!Context.ClientPage.IsEvent)
            {
                Context.ClientPage.RegisterArrayDeclaration("dictionary", "'" + EcmTexts.Localize("is not a CSV file.", new object[0]) + "'");
                this.FillDomains();

                this.NumImported.Text    = "0";
                this.NumEmailExists.Text = "0";
                this.NumNoEmail.Text     = "0";
                this.NumBroken.Text      = "0";
            }
            else
            {
                foreach (object obj2 in this.ParentControl.Controls)
                {
                    if (obj2 is TraceableCombobox)
                    {
                        (obj2 as TraceableCombobox).SelectOnly = true;
                    }
                }
            }
        }
コード例 #5
0
        private Response GetBestEmailLandingPagesReportResponse(string messageId, string language, SortParameter sortParameter)
        {
            MessageReportResponse <BestEmailLandingPagesReportModel> messageReportResponse = new MessageReportResponse <BestEmailLandingPagesReportModel>();

            try
            {
                DataTable dataTable = this.emailLandingPagesRepository.GetEmailLandingPagesData(new Guid(messageId), language, new SortParameter("Url", SortDirection.Asc));
                List <BestEmailLandingPagesReportModel> list = new List <BestEmailLandingPagesReportModel>(this.bestPagesMappings.Count);
                foreach (KeyValuePair <string, string> current in this.bestPagesMappings)
                {
                    BestEmailLandingPagesReportModel bestEmailLandingPagesReportModel = new BestEmailLandingPagesReportModel();
                    bestEmailLandingPagesReportModel.ItemId = Guid.NewGuid().ToString();
                    bestEmailLandingPagesReportModel.PerformanceIndicator       = EcmTexts.Localize(current.Value, new object[0]);
                    bestEmailLandingPagesReportModel.PerformanceIndicatorColumn = current.Key;
                    if (dataTable.Rows.Count == 0)
                    {
                        bestEmailLandingPagesReportModel.EmailLandingPages = new EmailLandingPagesReportModel[0];
                        bestEmailLandingPagesReportModel.Url = "-";
                    }
                    else
                    {
                        dataTable.DefaultView.Sort = string.Format("{0} DESC", current.Key);
                        dataTable = dataTable.DefaultView.ToTable();
                        bestEmailLandingPagesReportModel.EmailLandingPages = this.Convert(dataTable, null).ToArray();
                        bestEmailLandingPagesReportModel.Url = (string)dataTable.Rows[0]["Url"];
                    }
                    list.Add(bestEmailLandingPagesReportModel);
                }
                if (sortParameter != null)
                {
                    if (sortParameter.Name == "performanceIndicator")
                    {
                        List <BestEmailLandingPagesReportModel> arg_1B5_0;
                        if (sortParameter.Direction != SortDirection.Desc)
                        {
                            arg_1B5_0 = (from model in list
                                         orderby model.PerformanceIndicator
                                         select model).ToList <BestEmailLandingPagesReportModel>();
                        }
                        else
                        {
                            arg_1B5_0 = (from model in list
                                         orderby model.PerformanceIndicator descending
                                         select model).ToList <BestEmailLandingPagesReportModel>();
                        }
                        list = arg_1B5_0;
                    }
                    if (sortParameter.Name == "url")
                    {
                        List <BestEmailLandingPagesReportModel> arg_223_0;
                        if (sortParameter.Direction != SortDirection.Desc)
                        {
                            arg_223_0 = (from model in list
                                         orderby model.Url
                                         select model).ToList <BestEmailLandingPagesReportModel>();
                        }
                        else
                        {
                            arg_223_0 = (from model in list
                                         orderby model.Url descending
                                         select model).ToList <BestEmailLandingPagesReportModel>();
                        }
                        list = arg_223_0;
                    }
                }
                messageReportResponse.Results    = list.ToArray();
                messageReportResponse.TotalCount = list.Count;
            }
            catch (Exception ex)
            {
                Sitecore.Diagnostics.Log.Error(ex.Message, ex, this);
                messageReportResponse.Error        = true;
                messageReportResponse.ErrorMessage = EcmTexts.Localize("A serious error occurred please contact the administrator", new object[0]);
            }
            return(messageReportResponse);
        }
コード例 #6
0
 protected void ConfirmExit(ClientPipelineArgs args)
 {
     if (!args.IsPostBack)
     {
         SheerResponse.Confirm(EcmTexts.Localize("You have not downloaded the file containing the exported users.", new object[0]) + "\n\n" + EcmTexts.Localize("Are you sure you want to exit without exporting any users?", new object[0]));
         args.WaitForPostBack();
     }
     else if (args.HasResult && (args.Result == "yes"))
     {
         base.Cancel();
     }
 }
        private bool SelectRolesCompleted()
        {
            //here goes actual import

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

            try
            {
                this.AddAdvancedRoles(roles);
            }
            catch (Exception exception)
            {
                SheerResponse.Alert(exception.Message, new string[0]);
                return(false);
            }
            TargetAudience ta = null;
            Item           listsContainerRoot = Root.GetRecipientListContainerItem();

            if (roles.Count > 0)
            {
                using (new SecurityDisabler())
                {
                    string rolename = roles[0];
                    if (listsContainerRoot != null)
                    {
                        try
                        {
                            ta = TargetAudienceSource.Create(this.RecipientListName.Value, listsContainerRoot, rolename, null);
                            roles.RemoveAt(0);
                        }
                        catch (Exception e)
                        {
                            SheerResponse.Alert(EcmTexts.Localize("Error appeared during creating a new Recipient List.", new object[0]), new string[0]);
                            Log.Error("Error appeared during creating a new Recipient List.", e, this);
                        }
                    }
                }
            }
            else
            {
                using (new SecurityDisabler())
                {
                    if (listsContainerRoot != null)
                    {
                        try
                        {
                            ta = TargetAudienceSource.Create(this.RecipientListName.Value, listsContainerRoot, null, null);
                        }
                        catch (Exception e)
                        {
                            SheerResponse.Alert(EcmTexts.Localize("Error appeared during creating a new Recipient List.", new object[0]), new string[0]);
                            Log.Error("Error appeared during creating a new Recipient List.", e, this);
                        }
                    }
                }
            }

            if (ta == null)
            {
                SheerResponse.Alert(EcmTexts.Localize("Recipient List could not be created.", new object[0]), new string[0]);
                return(false);
            }

            if ((ta != null) && (ta.InnerItem != null))
            {
                try
                {
                    foreach (string str in roles)
                    {
                        ta.Source.AddRoleToExtraOptIn(str);
                    }
                }
                catch (Exception e)
                {
                    SheerResponse.Alert(EcmTexts.Localize("Error appeared during adding extra roles to a new Recipient List.", new object[0]), new string[0]);
                    Log.Error("Error appeared during adding extra roles to a new Recipient List.", e, this);
                }
            }
            return(true);
        }