Пример #1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var modules    = AttachedModules.GetModules <ISendMails>();
            var modulesAny = false;

            foreach (var moduleType in modules)
            {
                var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null);
                if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId))
                {
                    modulesAny = true;
                }
            }

            if (!modulesAny)
            {
                lblMessage.Text      = Resource.Admin_m_News_SendMailOff;
                lblMessage.ForeColor = System.Drawing.Color.Red;
                divMessage.Visible   = true;
                divSend.Visible      = false;
            }
            else if (!IsPostBack)
            {
                divMessage.Visible = false;
                divSend.Visible    = true;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ocModule = AttachedModules.GetModules <IOrderConfirmation>().FirstOrDefault();
            IOrderConfirmation classInstance;

            if (ocModule != null)
            {
                classInstance = (IOrderConfirmation)Activator.CreateInstance(ocModule, null);
                if (!ModulesRepository.IsActiveModule(classInstance.ModuleStringId) || !classInstance.CheckAlive())
                {
                    Response.Redirect("~/orderconfirmation.aspx");
                    return;
                }
            }
            else
            {
                Response.Redirect("~/orderconfirmation.aspx");
                return;
            }

            SetMeta(new MetaInfo(string.Format("{0} - {1}", classInstance.PageName, SettingsMain.ShopName)),
                    string.Empty);
            liPageHead.Text = classInstance.PageName;
            Control c =
                (this).LoadControl(
                    UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", classInstance.ModuleStringId,
                                                             classInstance.FileUserControlOrderConfirmation)));

            if (c != null)
            {
                pnlContent.Controls.Add(c);
            }
        }
Пример #3
0
        private void SaveProductTabs(int productId)
        {
            foreach (var detailsTabsModule in AttachedModules.GetModules <IProductTabs>())
            {
                var classInstance = (IProductTabs)Activator.CreateInstance(detailsTabsModule, null);
                if (ModulesRepository.IsActiveModule(classInstance.ModuleStringId) && classInstance.CheckAlive())
                {
                    foreach (ListViewItem tabBody in lvTabBodies.Items)
                    {
                        var tabTitleId       = 0;
                        var stringTabTitleId = ((HiddenField)tabBody.FindControl("hfTabTitleId")).Value;
                        var stringTabBody    = ((TextBox)tabBody.FindControl("fckTabBody")).Text;

                        if (!int.TryParse(stringTabTitleId, out tabTitleId))
                        {
                            continue;
                        }

                        if (string.IsNullOrEmpty(stringTabBody))
                        {
                            classInstance.DeleteProductDetailsTab(productId, tabTitleId);
                        }
                        else if (!string.IsNullOrEmpty(stringTabTitleId))
                        {
                            classInstance.SaveProductDetailsTab(productId, tabTitleId, stringTabBody);
                        }
                    }
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["module"].IsNullOrEmpty())
            {
                Response.Redirect(UrlService.GetAdminAbsoluteLink(""));
            }

            var module = AttachedModules.GetModules().FirstOrDefault(
                item => ((IModule)Activator.CreateInstance(item, null)).ModuleStringId == Request["module"]);

            if (module == null)
            {
                Response.Redirect(UrlService.GetAdminAbsoluteLink(""));
            }

            ckbActiveModule.Attributes.Add("data-modulestringid", Request["module"]);
            ckbActiveModule.Checked = ModulesRepository.IsActiveModule(Request["module"]);
            lblIsActive.Text        = ckbActiveModule.Checked
                                   ? Resources.Resource.Admin_Module_Active
                                   : Resources.Resource.Admin_Module_NotActive;
            lblIsActive.ForeColor = ckbActiveModule.Checked
                                   ? System.Drawing.Color.Green
                                   : System.Drawing.Color.Red;

            var moduleObject = (IModule)Activator.CreateInstance(module, null);

            lblHead.Text = moduleObject.ModuleName;

            if (moduleObject.ModuleControls != null)
            {
                rptTabs.DataSource = moduleObject.ModuleControls;
                rptTabs.DataBind();

                int currentControlIndex = CurrentControlIndex;

                if (currentControlIndex < 0 || currentControlIndex > (moduleObject.ModuleControls.Count - 1))
                {
                    currentControlIndex = 0;
                }

                if (moduleObject.ModuleControls != null && moduleObject.ModuleControls.Any())
                {
                    Control c =
                        (this).LoadControl(
                            UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", moduleObject.ModuleStringId,
                                                                     moduleObject.ModuleControls[currentControlIndex]
                                                                     .File)));
                    if (c != null)
                    {
                        pnlBody.Controls.Add(c);
                    }
                    SetMeta(string.Format("{0} - {1} - {2}", SettingsMain.ShopName, moduleObject.ModuleName, moduleObject.ModuleControls[currentControlIndex].NameTab));
                }
            }
            else
            {
                lblInfo.Text = Resources.Resource.Admin_Module_NotConfigure;
            }
        }
Пример #5
0
 public static void SendNews(string txtTitle, string text)
 {
     foreach (var moduleType in AttachedModules.GetModules <ISendMails>())
     {
         var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null);
         if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId))
         {
             moduleObject.SendMails(txtTitle, text, MailRecipientType.Subscriber);
         }
     }
 }
Пример #6
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (!IsValidData())
            {
                return;
            }

            var isSend  = false;
            var modules = AttachedModules.GetModules <ISendMails>().ToArray();

            var recipientType = MailRecipientType.None;

            if (ckbSubscribers.Checked)
            {
                recipientType |= MailRecipientType.Subscriber;
            }
            if (ckbOrderedCustomers.Checked)
            {
                recipientType |= MailRecipientType.OrderCustomer;
            }

            foreach (var moduleType in modules)
            {
                var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null);
                if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId))
                {
                    isSend |= moduleObject.SendMails(txtTitle.Text, fckMailContent.Text, recipientType);
                }
            }

            if (isSend)
            {
                lblMessage.Text      = Resource.Admin_m_News_MessageIsSend;
                lblMessage.ForeColor = System.Drawing.Color.Blue;
            }
            else
            {
                lblMessage.Text      = Resource.Admin_m_News_MessageIsSend;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }

            divMessage.Visible = true;
            divSend.Visible    = false;
        }
Пример #7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var brand = popUpBrand.SelectBrandId != 0 ? BrandService.GetBrandById(popUpBrand.SelectBrandId) : null;

            lBrand.Text           = brand != null ? brand.Name : Resource.Admin_Product_NotSelected;
            ibRemoveBrand.Visible = popUpBrand.SelectBrandId != 0;

            if (!AddingNewProduct)
            {
                aToClient.HRef    = "../" + UrlService.GetLinkDB(ParamType.Product, ProductId);
                aToClient.Visible = true;
            }
            else
            {
                aToClient.Visible = false;
            }

            if (ProductId != 0)
            {
                var listDetailsTabs = new List <ITab>();

                foreach (var detailsTabsModule in AttachedModules.GetModules <IProductTabs>())
                {
                    var classInstance = (IProductTabs)Activator.CreateInstance(detailsTabsModule, null);
                    if (ModulesRepository.IsActiveModule(classInstance.ModuleStringId) && classInstance.CheckAlive())
                    {
                        listDetailsTabs.AddRange(classInstance.GetProductTabsCollection(ProductId));
                    }
                }

                lvTabBodies.DataSource = listDetailsTabs;
                lvTabTitles.DataSource = listDetailsTabs;

                lvTabBodies.DataBind();
                lvTabTitles.DataBind();
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_NewsAdmin_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging
                {
                    TableName    = "[Settings].[News]",
                    ItemsPerPage = 20
                };

                _paging.AddFieldsRange(new List <Field>
                {
                    new Field
                    {
                        Name       = "NewsID as ID",
                        IsDistinct = true
                    },
                    new Field {
                        Name = "Title"
                    },
                    new Field {
                        Name = "ShowOnMainPage"
                    },
                    new Field {
                        Name = "NewsCategoryID"
                    },
                    new Field {
                        Name = "AddingDate", Sorting = SortDirection.Descending
                    }
                });

                grid.ChangeHeaderImageUrl("arrowAddingDate", "images/arrowdown.gif");

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex      = 1;
                ViewState["Paging"]           = _paging;
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];

                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    _selectionFilter = new InSetFieldFilter();
                    if (arrids.Contains("-1"))
                    {
                        _selectionFilter.IncludeValues = false;
                        _inverseSelection = true;
                    }
                    else
                    {
                        _selectionFilter.IncludeValues = true;
                    }
                    _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray();
                }
            }


            var modules = AttachedModules.GetModules <ISendMails>();


            foreach (var moduleType in modules)
            {
                var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null);
                if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId))
                {
                    CanSendNews = true;
                }
            }
        }