示例#1
0
 public static KeyValuePair <float, float> GetMonthProgress()
 {
     return(SQLDataAccess.ExecuteReadOne("[Order].[sp_GetOrdersMonthProgress]", CommandType.StoredProcedure,
                                         reader =>
                                         new KeyValuePair <float, float>(SQLDataHelper.GetFloat(reader, "Sum"),
                                                                         SQLDataHelper.GetFloat(reader, "Profit"))));
 }
示例#2
0
    public static List <string> GetPaymentMethods()
    {
        var result = new List <string>();

        try
        {
            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = "SELECT distinct Name FROM [Order].[PaymentMethod]";
                db.cmd.CommandType = CommandType.Text;
                db.cnOpen();

                using (var reader = db.cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        result.Add(SQLDataHelper.GetString(reader, "Name").Trim());
                    }
                }
                db.cnClose();
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
        }
        return(result);
    }
示例#3
0
 private static GiftCertificate GetFromReader(SqlDataReader reader)
 {
     return(new GiftCertificate
     {
         CertificateId = SQLDataHelper.GetInt(reader, "CertificateID"),
         CertificateCode = SQLDataHelper.GetString(reader, "CertificateCode"),
         FromName = SQLDataHelper.GetString(reader, "FromName"),
         ToName = SQLDataHelper.GetString(reader, "ToName"),
         OrderNumber = SQLDataHelper.GetString(reader, "OrderNumber"),
         Sum = SQLDataHelper.GetDecimal(reader, "Sum"),
         Paid = SQLDataHelper.GetBoolean(reader, "Paid"),
         Used = SQLDataHelper.GetBoolean(reader, "Used"),
         Enable = SQLDataHelper.GetBoolean(reader, "Enable"),
         Type = (CertificatePostType)(SQLDataHelper.GetInt(reader, "Type")),
         CertificateMessage = SQLDataHelper.GetString(reader, "Message"),
         Email = SQLDataHelper.GetString(reader, "Email"),
         Country = SQLDataHelper.GetString(reader, "Country"),
         Zone = SQLDataHelper.GetString(reader, "Zone"),
         City = SQLDataHelper.GetString(reader, "City"),
         Zip = SQLDataHelper.GetString(reader, "Zip"),
         Address = SQLDataHelper.GetString(reader, "Address"),
         CreationDate = SQLDataHelper.GetDateTime(reader, "CreationDate"),
         CurrencyCode = SQLDataHelper.GetString(reader, "CurrencyCode"),
         CurrencyValue = SQLDataHelper.GetDecimal(reader, "CurrencyValue"),
         FromEmail = SQLDataHelper.GetString(reader, "FromEmail")
     });
 }
示例#4
0
 public static Product GetProductFromReader(SqlDataReader reader)
 {
     return(new Product
     {
         ProductId = SQLDataHelper.GetInt(reader, "ProductId"),
         ArtNo = SQLDataHelper.GetString(reader, "ArtNo"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription", string.Empty),
         Description = SQLDataHelper.GetString(reader, "Description", string.Empty),
         Photo = SQLDataHelper.GetString(reader, "Photo"),
         Discount = SQLDataHelper.GetDecimal(reader, "Discount"),
         Size = SQLDataHelper.GetString(reader, "Size"),
         Weight = SQLDataHelper.GetDecimal(reader, "Weight"),
         Ratio = SQLDataHelper.GetDouble(reader, "Ratio"),
         Enabled = SQLDataHelper.GetBoolean(reader, "Enabled", true),
         OrderByRequest = SQLDataHelper.GetBoolean(reader, "OrderByRequest"),
         Recomended = SQLDataHelper.GetBoolean(reader, "Recomended"),
         New = SQLDataHelper.GetBoolean(reader, "New"),
         BestSeller = SQLDataHelper.GetBoolean(reader, "Bestseller"),
         OnSale = SQLDataHelper.GetBoolean(reader, "OnSale"),
         BrandId = SQLDataHelper.GetInt(reader, "BrandID", 0),
         UrlPath = SQLDataHelper.GetString(reader, "UrlPath"),
         HirecalEnabled = SQLDataHelper.GetBoolean(reader, "HirecalEnabled"),
         //Added by Evgeni to add EAN and SubbrandiD
         EAN = SQLDataHelper.GetString(reader, "EAN"),
         SubBrandId = SQLDataHelper.GetInt(reader, "SubBrandID", 0),
         ManufactureArtNo = SQLDataHelper.GetString(reader, "ManufactureArtNo")
                            //
     });
 }
示例#5
0
        public static List <string> GetIDs()
        {
            List <string> result = SQLDataAccess.ExecuteReadList <string>("SELECT [StaticBlockID] FROM [CMS].[StaticBlock]", CommandType.Text,
                                                                          reader => SQLDataHelper.GetInt(reader, "StaticBlockID").ToString());

            return(result);
        }
示例#6
0
        public bool ProcessCloseRollbackOperation(int orderId, string type)
        {
            var rollbackParams = SQLDataAccess.ExecuteReadOne <RollbackParams>(
                "Select * From [ModulePayment].[MasterBank] Where OrderId = @OrderId",
                CommandType.Text,
                reader => new RollbackParams
            {
                orderId = SQLDataHelper.GetInt(reader, "OrderId"),
                order   = SQLDataHelper.GetString(reader, "StringOrderId"),
                amount  = SQLDataHelper.GetString(reader, "Amount"),
                rrn     = SQLDataHelper.GetString(reader, "RRN"),
                int_ref = SQLDataHelper.GetString(reader, "INT_REF")
            },
                new SqlParameter("@OrderId", orderId));

            if (rollbackParams == null)
            {
                return(false);
            }

            var        post_data = "AMOUNT={0}&ORDER={1}&RRN={2}&INT_REF={3}&TIMESTAMP={4}&TERMINAL={5}&SIGN={6}";
            var        timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");
            WebRequest request   = WebRequest.Create("https://pay.masterbank.ru/acquiring/" + type + "?");

            byte[] data = Encoding.UTF8.GetBytes(string.Format(post_data,
                                                               rollbackParams.amount,
                                                               rollbackParams.order,
                                                               rollbackParams.rrn,
                                                               rollbackParams.int_ref,
                                                               timeStamp,
                                                               Terminal,
                                                               GetMd5Hash(MD5.Create(), Terminal + timeStamp + rollbackParams.order + rollbackParams.amount + SecretWord)
                                                               ));

            request.Method        = "POST";
            request.ContentType   = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;

            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            request.Method = "POST";
            request.GetResponse();
            if (string.Equals(type, "close"))
            {
                OrderService.PayOrder(rollbackParams.orderId, true);
            }
            else if (string.Equals(type, "rollback"))
            {
            }

            SQLDataAccess.ExecuteNonQuery(
                "Delete From [ModulePayment].[MasterBank] Where OrderId = @OrderId",
                CommandType.Text,
                new SqlParameter("@OrderId", orderId));

            return(true);
        }
示例#7
0
        public static List <int> GetAllTaxesIDs()
        {
            List <int> result = SQLDataAccess.ExecuteReadList("select [TaxId] from [Catalog].[Tax]", CommandType.Text,
                                                              reader => SQLDataHelper.GetInt(reader, "TaxId"));

            return(result);
        }
示例#8
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteBlock")
     {
         StaticBlockService.DeleteBlock(SQLDataHelper.GetInt(e.CommandArgument));
     }
 }
        protected void Page_Load()
        {
            SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_MailFormat_Header));
            CKEditorControl1.Language = CultureInfo.CurrentCulture.ToString();
            if (!IsPostBack)
            {
                MailFormatId       = 0;
                lblMessage.Text    = "";
                lblMessage.Visible = false;
                MsgErr(true);

                if (AddingNew)
                {
                    ddlTypes.DataBind();
                    ShowMailFormatTypeDescription();
                }
                else
                {
                    btnSave.Text    = Resource.Admin_Update;
                    lblSubHead.Text = Resource.Admin_MailFormatDetail_Edit;

                    MailFormatId = SQLDataHelper.GetInt(Request["id"]);
                    LoadMailFormat();
                }
            }
        }
示例#10
0
        protected void lbDeleteSelected_Click(object sender, EventArgs e)
        {
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                if (!_inverseSelection)
                {
                    foreach (var id in _selectionFilter.Values)
                    {
                        int sizeId = SQLDataHelper.GetInt(id);

                        if (!SizeService.IsSizeUsed(sizeId))
                        {
                            SizeService.DeleteSize(sizeId);
                        }
                    }
                }
                else
                {
                    var itemsIds = _paging.ItemsIds <int>("SizeID as ID");
                    foreach (var id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString())))
                    {
                        if (!SizeService.IsSizeUsed(id))
                        {
                            SizeService.DeleteSize(id);
                        }
                    }
                }
            }
        }
示例#11
0
        protected void lbPreviousPage_Click(object sender, EventArgs e)
        {
            var temp = SQLDataHelper.GetInt(currentPage.Value) - 1;

            currentPage.Value        = temp.ToString();
            _paging.CurrentPageIndex = temp;
        }
示例#12
0
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteAnswer")
            {
                VoiceService.DeleteAnswer(SQLDataHelper.GetInt(e.CommandArgument));
            }

            if (e.CommandName == "AddAnswer")
            {
                try
                {
                    var answer = new Answer
                    {
                        Name       = ((TextBox)grid.FooterRow.FindControl("txtNewName")).Text,
                        CountVoice = ((TextBox)grid.FooterRow.FindControl("txtNewCountVoice")).Text.TryParseInt(),
                        Sort       = ((TextBox)grid.FooterRow.FindControl("txtNewSort")).Text.TryParseInt(),
                        IsVisible  = ((CheckBox)grid.FooterRow.FindControl("chkNewIsVisible")).Checked,
                        FkidTheme  = ThemeId
                    };

                    VoiceService.InsertAnswer(answer);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex);
                }
                grid.ShowFooter = false;
            }


            if (e.CommandName == "CancelAdd")
            {
                grid.ShowFooter = false;
            }
        }
        public object Get(string showCode, string entityId)
        {
            PreviewDTO    pDTO  = new PreviewDTO();
            SQLDataHelper SQLDA = new SQLDataHelper();

            eventBitEntities entities = new eventBitEntities();

            var entityState = entities.EntityStates.FirstOrDefault(x => x.ShowCode == showCode && x.EntityID == entityId);

            DataTable dt = new DataTable();

            if (entityState != null)
            {
                dt = SQLDA.GetEntityDataTable(entityId, (entityState.sysEventId ?? 0));

                pDTO.Columns = dt.Columns.Cast <DataColumn>().Where(x => !x.ColumnName.StartsWith("sys"))
                               .Select(x => Char.ToLowerInvariant(x.ColumnName[0]) + x.ColumnName.Substring(1))
                               .ToArray();

                pDTO.SysRowStampNumMax = entityState.sysRowStampNumMax.ToString();

                pDTO.RowCount = SQLDA.GetRowCountForEntity(entityId, (entityState.sysEventId ?? 0));
            }

            pDTO.Data = dt;

            return(pDTO);
        }
示例#14
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteMailFormat")
     {
         MailFormatService.Delete(SQLDataHelper.GetInt(e.CommandArgument));
     }
 }
示例#15
0
        public static int AddCustomOption(CustomOption copt)
        {
            var id = SQLDataHelper.GetInt(SQLDataAccess.ExecuteScalar(
                                              "[Catalog].[sp_AddCustomOption]",
                                              CommandType.StoredProcedure,
                                              new[]
            {
                new SqlParameter("@Title", copt.Title),
                new SqlParameter("@IsRequired", copt.IsRequired),
                new SqlParameter("@InputType", copt.InputType),
                new SqlParameter("@SortOrder", copt.SortOrder),
                new SqlParameter("@ProductID", copt.ProductId)
            }
                                              ));

            if (id != 0)
            {
                foreach (var optionItem in copt.Options)
                {
                    if (optionItem.Title != null)
                    {
                        AddOption(optionItem, id);
                    }
                }
            }
            return(id);
        }
        public bool SaveData()
        {
            if (!ValidateData())
            {
                return(false);
            }

            SettingsCatalog.DisplayWeight              = chkDisplayWeight.Checked;
            SettingsCatalog.DisplayDimensions          = chkDisplayDimensions.Checked;
            SettingsCatalog.ShowStockAvailability      = cbShowStockAvailability.Checked;
            SettingsCatalog.ShowBlockStockAvailability = cbShowBlockStockAvailability.Checked;

            SettingsCatalog.CompressBigImage = chkCompressBigImage.Checked;
            SettingsCatalog.ModerateReviews  = ckbModerateReviews.Checked;
            SettingsCatalog.AllowReviews     = chkAllowReviews.Checked;

            SettingsDesign.EnableZoom = chkEnableZoom.Checked;

            SettingsDesign.ShowShippingsMethodsInDetails =
                (SettingsDesign.eShowShippingsInDetails)
                SQLDataHelper.GetInt(ddlShowShippingsMethodsInDetails.SelectedValue);

            SettingsDesign.ShippingsMethodsInDetailsCount = txtShippingsMethodsInDetailsCount.Text.TryParseInt();

            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1} {2}", SettingsMain.ShopName, Resource.Admin_OrderByRequest_Header, Request["id"]));

            if (AddingNew)
            {
                Response.Redirect("OrderByRequest.aspx");
                return;
            }

            MsgErr(true);
            lblMessage.Text        = "";
            lblMessage.Visible     = false;
            lEmailError.Visible    = false;
            lPhoneError.Visible    = false;
            lUserNameError.Visible = false;
            lQuantityError.Visible = false;

            if (!IsPostBack)
            {
                OrderByRequestId = 0;

                OrderByRequestId = SQLDataHelper.GetInt(Request["id"]);
                btnSave.Text     = Resource.Admin_Update;
                lblHead.Text     = Resource.Admin_OrderByRequest_Header + " " + OrderByRequestId;
                lblSubHead.Text  = Resource.Admin_OrderByRequest_RequestDate;

                LoadOrder();
            }
        }
示例#18
0
        public static int GetNewPropertyValueSortOrder(int productId)
        {
            var intResult = SQLDataHelper.GetInt(SQLDataAccess.ExecuteScalar("SELECT MAX(SortOrder) + 10 FROM [Catalog].[ProductPropertyValue] where ProductID=@ProductID",
                                                                             CommandType.Text, new SqlParameter("@ProductID", productId)), 10);

            return(intResult);
        }
示例#19
0
        protected void lbDeleteSelected_Click(object sender, EventArgs e)
        {
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                var currency = CurrencyService.Currency(SettingsCatalog.DefaultCurrencyIso3);

                if (!_inverseSelection)
                {
                    foreach (var id in _selectionFilter.Values)
                    {
                        if (currency != null && currency.CurrencyID != SQLDataHelper.GetInt(id))
                        {
                            CurrencyService.DeleteCurrency(SQLDataHelper.GetInt(id));
                        }
                    }
                }
                else
                {
                    var itemsIds = _paging.ItemsIds <int>("CurrencyID as ID");
                    foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
                    {
                        if (currency != null && currency.CurrencyID != id)
                        {
                            CurrencyService.DeleteCurrency(id);
                        }
                    }
                }
                CurrencyService.RefreshCurrency();
            }
        }
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "DeleteDiscount")
                {
                    DeleteOrderPriceDiscount(SQLDataHelper.GetInt(e.CommandArgument));
                }
                if (e.CommandName == "AddRange")
                {
                    SQLDataAccess.ExecuteNonQuery("INSERT INTO [Order].[OrderPriceDiscount] (PriceRange, PercentDiscount) VALUES (@Range, @Discount)",
                                                  CommandType.Text,
                                                  new SqlParameter("@Range", ((TextBox)grid.FooterRow.FindControl("txtNewPriceRange")).Text.TryParseDecimal()),
                                                  new SqlParameter("@Discount", ((TextBox)grid.FooterRow.FindControl("txtNewPercentDiscount")).Text.TryParseDecimal())
                                                  );
                    grid.ShowFooter = false;
                    grid.DataBind();
                }
                if (e.CommandName == "CancelAdd")
                {
                    grid.ShowFooter = false;
                }

                CacheManager.Remove(CacheNames.GetOrderPriceDiscountCacheObjectName());
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
        }
示例#21
0
 protected void agv_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Select")
     {
         SelectNewsId = SQLDataHelper.GetInt(e.CommandArgument);
     }
 }
示例#22
0
 private void LoadChildCategories(TreeNode node)
 {
     foreach (var c in CategoryService.GetChildCategoriesByCategoryId(SQLDataHelper.GetInt(node.Value), false))
     {
         var newNode = new ButtonTreeNodeCatalog
         {
             Text = string.Format("{3}{0} ({1}/{2}){4}", c.Name, c.ProductsCount, c.TotalProductsCount,
                                  c.ProductsCount == 0 ? "<span class=\"lightlink\">" : string.Empty,
                                  c.ProductsCount == 0 ? "</span>" : string.Empty),
             MessageToDel =
                 Server.HtmlEncode(string.Format(
                                       Resource.Admin_MasterPageAdminCatalog_Confirmation, c.Name)),
             Value       = c.CategoryId.ToString(),
             NavigateUrl = "Catalog.aspx?CategoryID=" + c.CategoryId,
             TreeView    = tree
         };
         if (c.HasChild)
         {
             newNode.Expanded         = false;
             newNode.PopulateOnDemand = true;
         }
         else
         {
             newNode.Expanded         = true;
             newNode.PopulateOnDemand = false;
         }
         node.ChildNodes.Add(newNode);
     }
 }
示例#23
0
 public static List<Brand> GetBrandsByProductOnMain(ProductOnMain.TypeFlag type)
 {
     var subCmd = string.Empty;
     switch (type)
     {
         case ProductOnMain.TypeFlag.New:
             subCmd = "New=1";
             break;
         case ProductOnMain.TypeFlag.Bestseller:
             subCmd = "Bestseller=1";
             break;
         case ProductOnMain.TypeFlag.Discount:
             subCmd = "Discount>0";
             break;
     }
     string cmd =
         "Select Brand.BrandID, Brand.BrandName, UrlPath, Brand.SortOrder from Catalog.Brand where BrandID in (select BrandID from Catalog.Product where " + subCmd + " ) order by Brand.BrandName";
     return SQLDataAccess.ExecuteReadList<Brand>(cmd, CommandType.Text,
                                                  reader => new Brand
                                                  {
                                                      BrandId = SQLDataHelper.GetInt(reader, "BrandID"),
                                                      Name = SQLDataHelper.GetString(reader, "BrandName"),
                                                      UrlPath = SQLDataHelper.GetString(reader, "UrlPath")
                                                  });
 }
示例#24
0
 /// <summary>
 /// return child categories by parent categoryId
 /// </summary>
 /// <param name="categoryId"></param>
 /// <returns></returns>
 public static IList <Category> GetChildCategoriesByCategoryIdForMenu(int categoryId)
 {
     return(SQLDataAccess.ExecuteReadList(
                "[Catalog].[sp_GetChildCategoriesByParentIDForMenu]",
                CommandType.StoredProcedure,
                reader =>
     {
         var category = new Category
         {
             CategoryId = SQLDataHelper.GetInt(reader, "CategoryId"),
             Name = SQLDataHelper.GetString(reader, "Name"),
             //Picture = SQLDataHelper.GetString(reader, "Picture"),
             SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"),
             ParentCategoryId = SQLDataHelper.GetInt(reader, "ParentCategory"),
             ProductsCount = SQLDataHelper.GetInt(reader, "Products_Count"),
             BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription"),
             Description = SQLDataHelper.GetString(reader, "Description"),
             Enabled = SQLDataHelper.GetBoolean(reader, "Enabled"),
             DisplayStyle = SQLDataHelper.GetString(reader, "DisplayStyle"),
             UrlPath = SQLDataHelper.GetString(reader, "UrlPath"),
             DisplayBrandsInMenu = SQLDataHelper.GetBoolean(reader, "DisplayBrandsInMenu"),
             DisplaySubCategoriesInMenu = SQLDataHelper.GetBoolean(reader, "DisplaySubCategoriesInMenu"),
         };
         var childCounts = SQLDataHelper.GetInt(reader, "ChildCategories_Count");
         category.HasChild = childCounts > 0;
         return category;
     },
                new SqlParameter("@CurrentCategoryID", categoryId)));
 }
示例#25
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCarousel")
     {
         CarouselService.DeleteCarousel(SQLDataHelper.GetInt(e.CommandArgument));
     }
 }
示例#26
0
        /// <summary>
        /// Get list of products by categoryId
        /// </summary>
        /// <param name="categoryId"></param>
        /// <param name="inDepth">param set use recurse or not</param>
        /// <returns></returns>
        public static IList <Product> GetProductsByCategoryId(int categoryId, bool inDepth)
        {
            var query = inDepth
                ? "SELECT * FROM [Catalog].[Product] INNER JOIN [Catalog].[ProductCategories] on ProductCategories.ProductID = Product.ProductID WHERE [ProductCategories].CategoryID  IN (SELECT id FROM [Settings].[GetChildCategoryByParent](@categoryId)) AND [Product].[Enabled] = 1  AND [Product].[CategoryEnabled] = 1"
                : "SELECT * FROM [Catalog].[Product] INNER JOIN [Catalog].[ProductCategories] on ProductCategories.ProductID = Product.ProductID WHERE [ProductCategories].CategoryID = @categoryId AND [Product].[Enabled] = 1 AND [Product].[CategoryEnabled] = 1";

            var prouducts = SQLDataAccess.ExecuteReadList(query, CommandType.Text,
                                                          reader => new Product
            {
                ProductId        = SQLDataHelper.GetInt(reader, "ProductId"),
                Name             = SQLDataHelper.GetString(reader, "Name"),
                BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription", null),
                Description      = SQLDataHelper.GetString(reader, "Description", null),
                Discount         = SQLDataHelper.GetFloat(reader, "Discount"),
                //ShippingPrice = SQLDataHelper.GetFloat(reader, "ShippingPrice"),
                Size       = SQLDataHelper.GetString(reader, "Size"),
                Weight     = SQLDataHelper.GetFloat(reader, "Weight"),
                Ratio      = SQLDataHelper.GetDouble(reader, "Ratio"),
                Enabled    = SQLDataHelper.GetBoolean(reader, "Enabled", true),
                Recomended = SQLDataHelper.GetBoolean(reader, "Recomended"),
                New        = SQLDataHelper.GetBoolean(reader, "New"),
                BestSeller = SQLDataHelper.GetBoolean(reader, "Bestseller"),
                OnSale     = SQLDataHelper.GetBoolean(reader, "OnSale")
            },
                                                          new SqlParameter("@categoryId", categoryId));

            return(prouducts ?? new List <Product>());
        }
示例#27
0
        protected void CreateStaticPage()
        {
            if (!ValidateInput())
            {
                return;
            }
            var id = StaticPageService.AddStaticPage(new StaticPage
            {
                PageName = txtPageName.Text,
                PageText = fckPageText.Text,
                UrlPath  = txtSynonym.Text,
                ParentId = hfParentId.Value == "" ? 0 : SQLDataHelper.GetInt(hfParentId.Value),
                Meta     = new MetaInfo
                {
                    Type            = MetaType.StaticPage,
                    Title           = txtPageTitle.Text,
                    MetaKeywords    = txtMetaKeywords.Text,
                    MetaDescription = txtMetaDescription.Text,
                    H1 = txtH1.Text
                },
                IndexAtSiteMap = chkIndexAtSitemap.Checked,
                HasChildren    = false,
                Enabled        = chkEnabled.Checked,
                SortOrder      = txtSortOrder.Text.TryParseInt()
            });

            Response.Redirect(string.Format("StaticPage.aspx?PageID={0}", id));
        }
示例#28
0
        private static SiteMapData GetSiteMapDataFromReader(SqlDataReader reader)
        {
            var prefUrl = SettingsMain.SiteUrl;

            prefUrl = prefUrl.Contains("http://") ? prefUrl : "http://" + prefUrl;

            var siteMapData = new SiteMapData
            {
                Changefreq = DefaultChangeFreq,
                Priority   = DefaultPriority
            };

            if (reader.FieldCount == 1)
            {
                siteMapData.Loc     = prefUrl + UrlService.GetLink(ParamType.Category, SQLDataHelper.GetString(reader, "UrlPath"), SQLDataHelper.GetInt(reader, "CategoryId"));
                siteMapData.Lastmod = DateTime.Now;
            }
            else if (reader.GetName(0).ToLower() == "productid")
            {
                siteMapData.Loc     = prefUrl + UrlService.GetLink(ParamType.Product, SQLDataHelper.GetString(reader, "UrlPath"), SQLDataHelper.GetInt(reader, "Productid"));
                siteMapData.Lastmod = SQLDataHelper.GetDateTime(reader, "DateModified");
            }
            else if (reader.GetName(0).ToLower() == "newsid")
            {
                siteMapData.Loc     = prefUrl + UrlService.GetLink(ParamType.News, SQLDataHelper.GetString(reader, "UrlPath"), SQLDataHelper.GetInt(reader, "NewsID"));
                siteMapData.Lastmod = SQLDataHelper.GetDateTime(reader, "AddingDate");
            }
            else if (reader.GetName(0).ToLower() == "staticpageid")
            {
                siteMapData.Loc     = prefUrl + UrlService.GetLink(ParamType.StaticPage, SQLDataHelper.GetString(reader, "UrlPath"), SQLDataHelper.GetInt(reader, "StaticPageID"));
                siteMapData.Lastmod = SQLDataHelper.GetDateTime(reader, "ModifyDate");
            }
            return(siteMapData);
        }
示例#29
0
 private void LoadChildStaticPages(TreeNode node)
 {
     foreach (var page in StaticPageService.GetChildStaticPages(SQLDataHelper.GetInt(node.Value), false))
     {
         var newNode = new ButtonTreeNodeStaticPage
         {
             Text         = page.PageName,
             MessageToDel =
                 Server.HtmlEncode(string.Format(
                                       Resource.Admin_MasterPageAdminCatalog_Confirmation, page.PageName)),
             Value    = page.StaticPageId.ToString(CultureInfo.InvariantCulture),
             TreeView = tree
         };
         if (page.HasChildren)
         {
             newNode.Expanded         = false;
             newNode.PopulateOnDemand = true;
             newNode.NavigateUrl      = "StaticPages.aspx?ParentID=" + page.StaticPageId;
         }
         else
         {
             newNode.Expanded         = true;
             newNode.PopulateOnDemand = false;
             newNode.NavigateUrl      = "StaticPage.aspx?PageID=" + page.StaticPageId;
         }
         node.ChildNodes.Add(newNode);
     }
 }
示例#30
0
 public static List <KeyValuePair <string, int> > GetTopShippings()
 {
     return(SQLDataAccess.ExecuteReadList("[Order].[sp_GetShippingRating]", CommandType.StoredProcedure,
                                          reader =>
                                          new KeyValuePair <string, int>(SQLDataHelper.GetString(reader, "ShippingMethod"),
                                                                         SQLDataHelper.GetInt(reader, "Rating"))));
 }