Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "Настройки домена - LeadForce";

            if (Page.RouteData.Values["id"] != null)
            {
                _siteDomainId = Guid.Parse(Page.RouteData.Values["id"] as string);
            }

            if (Page.RouteData.Values["siteId"] != null)
            {
                _siteId = Guid.Parse(Page.RouteData.Values["siteId"] as string);
            }

            if (Request.Url.ToString().ToLower().Contains("sites"))
            {
                hlCancel.NavigateUrl = UrlsData.AP_Sites();
            }
            else
            {
                hlCancel.NavigateUrl = UrlsData.AP_Settings();
            }

            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(lbtnSave, ucNotificationMessage);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(lbtnSave, lrlSiteDomainStatus, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(ucCheckSite, lrlSiteDomainStatus);

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var site               = DataManager.Sites.SelectById(CurrentUser.Instance.SiteID);
            var totalPageCount     = site.tbl_SiteDomain.Sum(o => o.TotalPageCount);
            var pageCountWithForms = site.tbl_SiteDomain.Sum(o => o.PageCountWithForms);

            lrlTotalPages.Text = totalPageCount.ToString();
            lrlTotalForms.Text = pageCountWithForms.ToString();

            var    menu = DataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "Form");
            string url  = string.Empty;

            if (menu != null)
            {
                var tab = string.IsNullOrEmpty(menu.TabName) && menu.ParentID.HasValue ? DataManager.Menu.SelectByID(menu.ParentID.Value).TabName : menu.TabName;
                url = ResolveUrl(string.Format("~/{0}/{1}/List", tab, menu.tbl_Module.Name));
            }
            else
            {
                url = UrlsData.AP_SiteActivityRules((int)RuleType.Form, "Evaluation");
            }

            if (totalPageCount != 0 && pageCountWithForms / ((decimal)totalPageCount / 100) < 50)
            {
                lrlMessage1.Text = string.Format("<li class=\"widget-error\">Для клиентов важна возможность задать вопрос или оставить отзыв. Подключите <a href=\"{0}\">формы обратной связи</a> к сайту!</li>", url);
            }

            if (DataManager.StatisticData.LoyaltyManagementInviteFriendFormCount.Value == 0)
            {
                lrlMessage2.Text = string.Format("<li class=\"widget-error\">Используй силу рекомендаций лояльных клиентов. Подключите форму <a href=\"{0}\">Пригласи друга</a> к сайту!</li>", url);
            }

            if (DataManager.StatisticData.LoyaltyManagementIsExistPortal.DbValue == 1)
            {
                var portal = DataManager.PortalSettings.SelectBySiteId(CurrentUser.Instance.SiteID);
                lrlPortal.Text = string.Format("<li>Портал поддержки доступен по ссылке: <a href=\"{0}\" target=\"_blank\">{0}</a></li>", string.Concat("http://", portal.Domain.Replace("http://", string.Empty)));
            }
            else
            {
                menu = DataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "Discussions");
                if (menu != null)
                {
                    var tab = string.IsNullOrEmpty(menu.TabName) && menu.ParentID.HasValue ? DataManager.Menu.SelectByID(menu.ParentID.Value).TabName : menu.TabName;
                    url = ResolveUrl(string.Format("~/{0}/{1}/PortalSetting", tab, menu.tbl_Module.Name));
                }
                else
                {
                    url = UrlsData.AP_Settings("Settings");
                }

                lrlPortal.Text = string.Format("<li>Внешний портал не настроен. <a href=\"{0}\">Настроить!</a></li>", url);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "Настройки портала - LeadForce";

            if (Page.RouteData.Values["id"] != null)
            {
                _portalSettingsId = Guid.Parse(Page.RouteData.Values["id"] as string);
            }

            if (Page.RouteData.Values["siteId"] != null)
            {
                _siteId = Guid.Parse(Page.RouteData.Values["siteId"] as string);
            }

            RadAjaxManager = RadAjaxManager.GetCurrent(Page);
            RadAjaxManager.AjaxSettings.AddAjaxSetting(RadAjaxManager, rbiLogo);
            rauLogo.Localization.Select = "Выбрать";
            rauLogo.Localization.Remove = "Удалить";
            rauLogo.Localization.Cancel = "Отмена";

            txtTwitterProfile.Attributes.Add("style", "display:none");
            txtVkontakteProfile.Attributes.Add("style", "display:none");
            txtFacebookProfile.Attributes.Add("style", "display:none");

            if (Request.Url.ToString().ToLower().Contains("sites"))
            {
                hlCancel.NavigateUrl = UrlsData.AP_Sites();
            }
            else
            {
                hlCancel.NavigateUrl = UrlsData.AP_Settings();
            }

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Header.DataBind();

            if (!string.IsNullOrEmpty(Request.QueryString["code"]))
            {
                _activityCode = Request.QueryString["code"];
            }

            rblFormMode.Items.Clear();
            tsFormMode.Tabs.Clear();
            foreach (var mode in EnumHelper.EnumToList <FormMode>())
            {
                rblFormMode.Items.Add(new ListItem(EnumHelper.GetEnumDescription(mode), ((int)mode).ToString()));
                tsFormMode.Tabs.Add(new Telerik.Web.UI.RadTab(EnumHelper.GetEnumDescription(mode), ((int)mode).ToString()));
            }
            rblFormMode.SelectedIndex = 0;

            lrlCounterCode.Text = HttpUtility.HtmlEncode(ScriptTemplates.Form(CurrentUser.Instance.SiteID, _activityCode)
                                                         .Replace("$Mode", ((int)FormMode.Inner).ToString())
                                                         .Replace("$FromVisit", string.Empty)
                                                         .Replace("$Through", string.Empty)
                                                         .Replace("$Period", string.Empty)
                                                         .Replace("$Parameter", string.Empty));

            //rblPeriod.Items.Clear();
            foreach (var period in EnumHelper.EnumToList <Period>())
            {
                rblPeriod.Items.Add(new ListItem(EnumHelper.GetEnumDescription(period), ((int)period).ToString()));
            }

            foreach (var category in EnumHelper.EnumToList <FormContactCategory>())
            {
                rblContactCategory.Items.Add(new ListItem(EnumHelper.GetEnumDescription(category), ((int)category).ToString()));
            }
            rblContactCategory.Items.FindByValue("0").Selected = true;

            foreach (var align in EnumHelper.EnumToList <PopupAlign>())
            {
                rblPopupAlign.Items.Add(new ListItem("", ((int)align).ToString()));
            }
            rblPopupAlign.Items.FindByValue("4").Selected = true;

            foreach (var effect in EnumHelper.EnumToList <PopupEffectAppear>())
            {
                ddlPopupEffectAppear.Items.Add(new ListItem(EnumHelper.GetEnumDescription(effect), ((int)effect).ToString()));
            }

            foreach (var position in EnumHelper.EnumToList <FloatingButtonPosition>())
            {
                ddlFloatingButtonPosition.Items.Add(new ListItem(EnumHelper.GetEnumDescription(position), ((int)position).ToString()));
            }

            if (!Page.ClientScript.IsClientScriptIncludeRegistered("FormCodeJS"))
            {
                ScriptManager.RegisterClientScriptInclude(this, typeof(FormCode), "FormCodeJS", ResolveUrl("~/Scripts/formcode.js"));
            }

            if (!Page.ClientScript.IsClientScriptIncludeRegistered("HighlightJS"))
            {
                ScriptManager.RegisterClientScriptInclude(this, typeof(FormCode), "HighlightJS", ResolveUrl("~/Scripts/highlight.pack.js"));
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("FormCodeTemplateJS"))
            {
                var script = string.Format("<script type=\"text/javascript\">var popupFormTemplate = \"{0}\"; var integratedFormTemplate = \"{1}\"; var autocallFormTemplate = \"{2}\"; var floatingButtonFormTemplate = \"{3}\"; var callOnClosingFormTemplate = \"{4}\";$('pre code').each(function(i, e) {{ hljs.highlightBlock(e); }});</script>",
                                           HttpUtility.HtmlEncode(ScriptTemplates.PopupForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.IntegratedForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.AutoCallForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.FloatingButtonForm(CurrentUser.Instance.SiteID, _activityCode)),
                                           HttpUtility.HtmlEncode(ScriptTemplates.CallOnClosingForm(CurrentUser.Instance.SiteID, _activityCode))).Replace("\r\n", "\\r\\n");
                ScriptManager.RegisterClientScriptBlock(this, typeof(FormCode), "FormCodeTemplateJS", script, false);
            }

            var fsProvider = new FileSystemProvider();
            var floatingButtonDirectory = fsProvider.GetFloatingButtonDirectory(CurrentUser.Instance.SiteID);

            rfeFloatingButtonIcon.Configuration.ViewPaths         = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.UploadPaths       = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.DeletePaths       = new[] { floatingButtonDirectory };
            rfeFloatingButtonIcon.Configuration.MaxUploadFileSize = 1048576;

            hlSettings.NavigateUrl = UrlsData.AP_Settings("Settings").Replace("/FormCode.aspx", "");
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dataManager = new DataManager();
            var site        = dataManager.Sites.SelectById(CurrentUser.Instance.SiteID);

            if (AccessProfile != null)
            {
                int?maxDomainsCount = AccessProfile.DomainsCount;
                var menu            = dataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "DomainSettings");
                var url             = string.Empty;
                if (menu != null)
                {
                    var tab = string.IsNullOrEmpty(menu.TabName) && menu.ParentID.HasValue ? dataManager.Menu.SelectByID(menu.ParentID.Value).TabName : menu.TabName;
                    url = ResolveUrl(string.Format("~/{0}/{1}/List", tab, menu.tbl_Module.Name));
                }

                IsNotExistsDomains.Visible = site.tbl_SiteDomain.Count == 0;
                if (site.tbl_SiteDomain.Count > 0)
                {
                    lrlDomainsUsed.Text = string.Format("<a href='{0}'>{1}</a>", !string.IsNullOrEmpty(url) ? url : UrlsData.AP_Settings("Settings"), GetDomainsWithCase(site.tbl_SiteDomain.Count));

                    if (AccessProfile.DomainsCount.HasValue)
                    {
                        lrlDomainRestriction.Text = string.Format(" из <b>{0}</b> доступных", AccessProfile.DomainsCount);
                    }
                }
                else
                {
                    DomainsUsage.Visible = false;
                }

                if (!string.IsNullOrEmpty(url))
                {
                    rbtnAddDomain.NavigateUrl = url;
                }
                else
                {
                    rbtnAddDomain.NavigateUrl = UrlsData.AP_SiteDomainsAdd("Settings", CurrentUser.Instance.SiteID);
                }

                if (!maxDomainsCount.HasValue || maxDomainsCount.Value > site.tbl_SiteDomain.Count)
                {
                    AddDomain.Visible = true;
                }
                else
                {
                    AddDomain.Visible = false;
                }

                if (maxDomainsCount.HasValue && maxDomainsCount.Value == site.tbl_SiteDomain.Count)
                {
                    hlContactUrl.NavigateUrl = AccessProfile.ContactsPageUrl;
                }
                else
                {
                    NoMoreDomains.Visible = false;
                }

                if (site.tbl_SiteDomain.Count > 0)
                {
                    var pageCountWithCounter = site.tbl_SiteDomain.Sum(o => o.PageCountWithCounter);
                    var totalPageCount       = site.tbl_SiteDomain.Sum(o => o.TotalPageCount);
                    lrlCounterFoundStats.Text = string.Format("{0} из {1}", pageCountWithCounter, totalPageCount);

                    if (totalPageCount != 0 && (pageCountWithCounter / ((double)totalPageCount / 100) < 80))
                    {
                        CounterFoundStats.Attributes.Add("class", "widget-error");
                    }
                }
                else
                {
                    CounterFoundStats.Visible = false;
                }

                if (!string.IsNullOrEmpty(url))
                {
                    rbtnCheck.NavigateUrl = url + "?check=true";
                }
                else
                {
                    Check.Visible = false;
                }
            }
        }