Example #1
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);
            var pageCountWithoutForms = totalPageCount - pageCountWithForms;

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

            if (totalPageCount != 0 && pageCountWithoutForms / ((decimal)totalPageCount / 100) > 10)
            {
                var    menu = DataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "Form");
                string url;
                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");
                }

                lrlMessage.Text = string.Format("<li class=\"widget-error\">{0} страниц не содержит контактных форм! <a href=\"{1}\">Перейти к модулю Формы</a></li>", pageCountWithoutForms, url);
            }

            var clientBaseGrowthTemplateForms = DataManager.StatisticData.ClientBaseGrowthTemplateForm;
            var sb = new StringBuilder();

            foreach (var clientBaseGrowthTemplateForm in clientBaseGrowthTemplateForms)
            {
                if (clientBaseGrowthTemplateForm.Value.DbValue == 0)
                {
                    continue;
                }

                var siteActivityRule = DataManager.SiteActivityRules.SelectById(Guid.Parse(clientBaseGrowthTemplateForm.Key.Split('_')[1]));
                sb.Append(string.Format("<li>{0} {1}</li>", siteActivityRule.Name, clientBaseGrowthTemplateForm.Value.DbValue.ToString("F0")));
            }

            lrlClientBaseGrowthTemplateForm.Text = sb.ToString();

            if (DataManager.StatisticData.ClientBaseOtherFormsCount.DbValue > 0)
            {
                lrlClientBaseOtherFormsCount.Text = string.Format("<li>Другие <b>{0}</b></li>", DataManager.StatisticData.ClientBaseOtherFormsCount.DbValue.ToString("F0"));
            }

            if (!string.IsNullOrEmpty(lrlClientBaseGrowthTemplateForm.Text) || !string.IsNullOrEmpty(lrlClientBaseOtherFormsCount.Text))
            {
                lrlTitle.Text = "Из них";
            }
            else
            {
                lrlTitle.Text = string.Empty;
            }

            rbtnImport.NavigateUrl = GetImportUrl();
        }
        /// <summary>
        /// Handles the OnCommand event of the lbCopy control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
        protected void lbCopy_OnCommand(object sender, CommandEventArgs e)
        {
            var newSiteActivityRule = new tbl_SiteActivityRules();
            var _id = Guid.Parse(e.CommandArgument.ToString());

            newSiteActivityRule = _dataManager.SiteActivityRules.CopyByID(_id);

            Response.Redirect(UrlsData.AP_SiteActivityRules((int)RuleType.Form));
            //gridSiteActivityRules.Rebind();
        }
        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);
            }
        }
Example #4
0
        /// <summary>
        /// Handles the OnClick event of the btnUpdate 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 btnUpdate_OnClick(object sender, EventArgs e)
        {
            if (!access.Write)
            {
                return;
            }

            var link = new tbl_Links();

            var checkCode = DataManager.Links.Select(SiteId, txtCode.Text);

            if (_linkId != Guid.Empty)
            {
                link = DataManager.Links.SelectById(_linkId);
                if (checkCode != null && checkCode.ID == _linkId)
                {
                    checkCode = null;
                }
            }

            ucMessage.Text = "";
            if (checkCode == null)
            {
                link.SiteID     = SiteId;
                link.Name       = txtName.Text;
                link.RuleTypeID = (int)RuleType.Link;
                if (_linkId == Guid.Empty)
                {
                    link.Code = txtCode.Text;
                }
                link.URL = txtURL.Text;

                if (_linkId != Guid.Empty)
                {
                    DataManager.Links.Update(link);
                }
                else
                {
                    link.OwnerID = CurrentUser.Instance.ContactID;
                    link.ID      = Guid.NewGuid();
                    DataManager.Links.Add(link);
                }
            }
            else
            {
                ucMessage.Text = "Правило с таким кодом уже существует.";
            }

            Response.Redirect(UrlsData.AP_SiteActivityRules((int)RuleType.Link));
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (!IsEditMode)
         {
             rtsWizard.AutoPostBack = true;
             rtsWizard.TabClick    += rtsWizard_OnTabClick;
             AddTab("Выбор типа формы", "SelectFormType", true);
             rmpWizard.PageViews.Add(new RadPageView {
                 ID = "SelectFormType"
             });
             AddTab("Инструкции и тексты", "InstructionAndText", false);
             AddTab("Дизайн формы", "Design", false);
             AddTab("Логика обработки", "LogicProcessing", false);
             AddTab("Действие после обработки ", "ActionAfterProcessing", false);
         }
         else
         {
             rtsWizard.AutoPostBack = false;
             plButtons.Visible      = true;
             hlCancel.NavigateUrl   = UrlsData.AP_SiteActivityRules((int)RuleType.Form);
             AddTab("Инструкции и тексты", "InstructionAndText", true);
             rmpWizard.PageViews.Add(new RadPageView {
                 ID = "InstructionAndText"
             });
             AddTab("Дизайн формы", "Design", true);
             rmpWizard.PageViews.Add(new RadPageView {
                 ID = "Design"
             });
             var dataManager      = new DataManager();
             var siteActivityRule = dataManager.SiteActivityRules.SelectById(EditFormId.Value);
             if (!siteActivityRule.tbl_SiteActivityRuleLayout.Any(o => o.LayoutType == (int)LayoutType.InviteFriend))
             {
                 AddTab("Логика обработки", "LogicProcessing", true);
                 rmpWizard.PageViews.Add(new RadPageView {
                     ID = "LogicProcessing"
                 });
             }
             AddTab("Действие после обработки ", "ActionAfterProcessing", true);
             rmpWizard.PageViews.Add(new RadPageView {
                 ID = "ActionAfterProcessing"
             });
         }
     }
 }
Example #6
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";

            access = Access.Check();
            if (!access.Write)
            {
                btnUpdate.Visible = false;
            }

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

            hlCancel.NavigateUrl = UrlsData.AP_SiteActivityRules((int)RuleType.Link);

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }
Example #7
0
        /// <summary>
        /// Saves the specified site activity rule id.
        /// </summary>
        /// <param name="siteActivityRuleId">The site activity rule id.</param>
        public void Save(Guid siteActivityRuleId)
        {
            var dataManager = new DataManager();

            var txtFormTitle           = ((TextBox)rmpWizard.FindPageViewByID("InstructionAndText").Controls[0].FindControl("txtFormTitle"));
            var txtTextButton          = ((TextBox)rmpWizard.FindPageViewByID("InstructionAndText").Controls[0].FindControl("txtTextButton"));
            var txtFormWidth           = ((RadNumericTextBox)rmpWizard.FindPageViewByID("Design").Controls[0].FindControl("txtFormWidth"));
            var ucCssEditorInstruction = ((CssEditor)rmpWizard.FindPageViewByID("Design").Controls[0].FindControl("ucCssEditorInstruction"));
            var ucCssEditorColumns     = ((CssEditor)rmpWizard.FindPageViewByID("Design").Controls[0].FindControl("ucCssEditorColumns"));
            var ucCssEditorButton      = ((CssEditor)rmpWizard.FindPageViewByID("Design").Controls[0].FindControl("ucCssEditorButton"));
            var rcpBackgroundColor     = ((RadColorPicker)rmpWizard.FindPageViewByID("Design").Controls[0].FindControl("rcpBackgroundColor"));
            var txtUrl = ((TextBox)rmpWizard.FindPageViewByID("ActionAfterProcessing").Controls[0].FindControl("txtUrl"));
            var plInviteFriendSettings    = ((Panel)rmpWizard.FindPageViewByID("ActionAfterProcessing").Controls[0].FindControl("plInviteFriendSettings"));
            var dcbWorkflowTemplate       = ((DictionaryOnDemandComboBox)rmpWizard.FindPageViewByID("ActionAfterProcessing").Controls[0].FindControl("dcbWorkflowTemplate"));
            var ucPopupSiteActionTemplate = ((PopupSiteActionTemplate)rmpWizard.FindPageViewByID("ActionAfterProcessing").Controls[0].FindControl("ucPopupSiteActionTemplate"));

            tbl_SiteActivityRules siteActivityRule = null;

            if (!IsEditMode)
            {
                siteActivityRule            = dataManager.SiteActivityRules.CopyByID(siteActivityRuleId);
                siteActivityRule.TemplateID = siteActivityRuleId;
                siteActivityRule.SiteID     = CurrentUser.Instance.SiteID;
                siteActivityRule.Code       = string.Concat("form_", DateTime.Now.ToString("[ddMMyyyy]_[mmss]"));

                var currentSiteColumnCategories = dataManager.ColumnCategories.SelectAll(CurrentUser.Instance.SiteID);

                foreach (tbl_SiteActivityRuleLayout ruleLayout in siteActivityRule.tbl_SiteActivityRuleLayout)
                {
                    ruleLayout.SiteID = CurrentUser.Instance.SiteID;
                }
                foreach (tbl_SiteColumns siteColumns in dataManager.SiteColumns.SelectByActivityRuleId(siteActivityRule.ID))
                {
                    siteColumns.SiteID = CurrentUser.Instance.SiteID;
                    var columnCategory = currentSiteColumnCategories.SingleOrDefault(o => o.Title == siteColumns.tbl_ColumnCategories.Title) ?? currentSiteColumnCategories.FirstOrDefault();
                    siteColumns.CategoryID = columnCategory.ID;
                }
            }
            else
            {
                siteActivityRule = dataManager.SiteActivityRules.SelectById(siteActivityRuleId);
            }


            siteActivityRule.Name       = txtFormTitle.Text;
            siteActivityRule.TextButton = txtTextButton.Text;
            siteActivityRule.RepostURL  = txtUrl.Text;
            siteActivityRule.FormWidth  = (int?)txtFormWidth.Value;
            siteActivityRule.CSSButton  = ucCssEditorButton.GetCss();
            siteActivityRule.CSSForm    = EncodeBackgroundCss(rcpBackgroundColor);

            var order = 0;

            var existsiteActivityRule = dataManager.SiteActivityRules.SelectById(siteActivityRuleId);

            foreach (var activityRuleLayout in existsiteActivityRule.tbl_SiteActivityRuleLayout)
            {
                if (string.IsNullOrEmpty(activityRuleLayout.LayoutParams))
                {
                    continue;
                }

                var toUpdate = siteActivityRule.tbl_SiteActivityRuleLayout.FirstOrDefault(o => o.Name == activityRuleLayout.Name);

                if (toUpdate == null)
                {
                    continue;
                }

                var lp = LayoutParams.Deserialize(activityRuleLayout.LayoutParams);
                if (!string.IsNullOrEmpty(lp.GetValue("ShowInMaster")))
                {
                    switch ((ShowTextBlockInMaster)int.Parse(lp.GetValue("ShowInMaster")))
                    {
                    case ShowTextBlockInMaster.Text:
                        var text = ((TextBox)FindControlRecursive(rmpWizard.FindPageViewByID("InstructionAndText").Controls[0], activityRuleLayout.ID.ToString())).Text;
                        text = text.Replace("\n", "#@#");
                        text = Sanitizer.GetSafeHtmlFragment(text);
                        text = text.Replace("#@#", "\n");
                        toUpdate.Description = text;
                        break;

                    case ShowTextBlockInMaster.HTML:
                        toUpdate.Description = ((RadEditor)FindControlRecursive(rmpWizard.FindPageViewByID("InstructionAndText").Controls[0], activityRuleLayout.ID.ToString())).Content;
                        break;
                    }
                    toUpdate.CSSStyle = ucCssEditorInstruction.GetCss();
                }
            }

            foreach (tbl_SiteActivityRuleLayout ruleLayout in siteActivityRule.tbl_SiteActivityRuleLayout)
            {
                if (string.IsNullOrEmpty(ruleLayout.LayoutParams) && ruleLayout.LayoutType != (int)LayoutType.Feedback &&
                    ruleLayout.LayoutType != (int)LayoutType.GroupFields && ruleLayout.LayoutType != (int)LayoutType.InviteFriend &&
                    ruleLayout.LayoutType != (int)LayoutType.Root && ruleLayout.LayoutType != (int)LayoutType.TextBlock)
                {
                    ruleLayout.CSSStyle = ucCssEditorColumns.GetCss();
                }
            }

            if (rmpWizard.FindPageViewByID("LogicProcessing") != null)
            {
                var ddlOutputFormatFields = ((DropDownList)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("ddlOutputFormatFields"));
                var rlbDestination        = ((RadListBox)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("rlbDestination"));
                var plFeedBack            = ((Panel)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("plFeedBack"));
                var rblStep            = ((RadioButtonList)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("rblStep"));
                var rblKnowledgeBase   = ((RadioButtonList)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("rblKnowledgeBase"));
                var chxPublicationType = ((CheckBoxList)rmpWizard.FindPageViewByID("LogicProcessing").Controls[0].FindControl("chxPublicationType"));

                tbl_SiteActivityRuleLayout parentSiteActivityRuleLayout =
                    (from ruleLayout in siteActivityRule.tbl_SiteActivityRuleLayout
                     where !string.IsNullOrEmpty(ruleLayout.LayoutParams)
                     let layoutParams = LayoutParams.Deserialize(ruleLayout.LayoutParams)
                                        where
                                        !string.IsNullOrEmpty(layoutParams.GetValue("IsUsedForAdditionalDetails")) &&
                                        bool.Parse(layoutParams.GetValue("IsUsedForAdditionalDetails"))
                                        select ruleLayout).FirstOrDefault();

                if (parentSiteActivityRuleLayout != null)
                {
                    var idsToDelete =
                        siteActivityRule.tbl_SiteActivityRuleLayout.Where(
                            o => o.ParentID == parentSiteActivityRuleLayout.ID).Select(o => o.ID).ToList();
                    foreach (Guid id in idsToDelete)
                    {
                        dataManager.SiteActivityRuleLayout.Delete(id);
                    }

                    foreach (RadListBoxItem item in rlbDestination.Items)
                    {
                        var siteActivityRuleLayout = new tbl_SiteActivityRuleLayout
                        {
                            ID                 = Guid.NewGuid(),
                            SiteID             = CurrentUser.Instance.SiteID,
                            SiteActivityRuleID = siteActivityRule.ID,
                            Order              = order,
                            Name               = item.Text,
                            ParentID           = parentSiteActivityRuleLayout.ID,
                            LayoutType         = (int)LayoutType.ProfileField
                        };

                        Guid outSiteColumnId;
                        if (Guid.TryParse(item.Value, out outSiteColumnId))
                        {
                            siteActivityRuleLayout.SiteColumnID = outSiteColumnId;
                            siteActivityRuleLayout.SysField     = null;
                        }
                        else
                        {
                            siteActivityRuleLayout.SiteColumnID = null;
                            siteActivityRuleLayout.SysField     = item.Value;
                        }

                        /*switch (item.Value)
                         * {
                         *  case "sys_fullname":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.FullName;
                         *      break;
                         *  case "sys_email":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.Email;
                         *      break;
                         *  case "sys_phone":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.Phone;
                         *      break;
                         *  case "sys_surname":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.Surname;
                         *      break;
                         *  case "sys_name":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.Name;
                         *      break;
                         *  case "sys_patronymic":
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.Patronymic;
                         *      break;
                         *  default:
                         *      siteActivityRuleLayout.SiteColumnID = Guid.Parse(item.Value);
                         *      siteActivityRuleLayout.LayoutType = (int) LayoutType.ProfileField;
                         *      break;
                         * }*/
                        order++;

                        siteActivityRule.tbl_SiteActivityRuleLayout.Add(siteActivityRuleLayout);
                    }

                    parentSiteActivityRuleLayout.OutputFormatFields = int.Parse(ddlOutputFormatFields.SelectedValue);

                    dataManager.SiteActivityRuleLayout.Update(parentSiteActivityRuleLayout);
                }

                if (plFeedBack.Visible)
                {
                    var feedBackComponent = siteActivityRule.tbl_SiteActivityRuleLayout.FirstOrDefault(o => o.LayoutType == (int)LayoutType.Feedback);
                    if (feedBackComponent != null)
                    {
                        var layoutParams = new List <LayoutParams>();
                        layoutParams.Add(new LayoutParams()
                        {
                            Name = "step", Value = rblStep.SelectedValue
                        });
                        layoutParams.Add(new LayoutParams()
                        {
                            Name = "kb", Value = rblKnowledgeBase.SelectedValue
                        });
                        var publicationTypeValues = (from ListItem item in chxPublicationType.Items where item.Selected select item.Value).ToList();
                        layoutParams.Add(new LayoutParams()
                        {
                            Name = "pt", Value = string.Join(",", publicationTypeValues)
                        });
                        feedBackComponent.LayoutParams = LayoutParams.Serialize(layoutParams);
                    }
                }
            }

            if (plInviteFriendSettings.Visible)
            {
                var inviteFriendComponent = siteActivityRule.tbl_SiteActivityRuleLayout.FirstOrDefault(o => o.LayoutType == (int)LayoutType.InviteFriend);
                if (inviteFriendComponent != null)
                {
                    var lp   = new List <LayoutParams>();
                    var item = new LayoutParams
                    {
                        Name  = "WorkflowTemplateID",
                        Value = dcbWorkflowTemplate.SelectedIdNullable.HasValue
                                               ? dcbWorkflowTemplate.SelectedId.ToString()
                                               : string.Empty
                    };
                    lp.Add(item);

                    item = new LayoutParams
                    {
                        Name  = "SiteActionTemplateID",
                        Value = ucPopupSiteActionTemplate.SiteActionTemplateId != Guid.Empty
                                           ? ucPopupSiteActionTemplate.SiteActionTemplateId.ToString()
                                           : string.Empty
                    };
                    lp.Add(item);

                    inviteFriendComponent.LayoutParams = LayoutParams.Serialize(lp);
                }
            }

            dataManager.SiteActivityRules.Update(siteActivityRule);

            Response.Redirect(UrlsData.AP_SiteActivityRules((int)RuleType.ExternalForm));
        }