Пример #1
0
 private static PropertyValue GetPropertyValueFromReader(SqlDataReader reader)
 {
     return(new PropertyValue
     {
         PropertyValueId = SQLDataHelper.GetInt(reader, "PropertyValueID"),
         PropertyId = SQLDataHelper.GetInt(reader, "PropertyID"),
         Value = SQLDataHelper.GetString(reader, "Value"),
         SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"),
         Property = new Property
         {
             GroupId = SQLDataHelper.GetNullableInt(reader, "GroupId"),
             PropertyId = SQLDataHelper.GetInt(reader, "PropertyID"),
             Name = SQLDataHelper.GetString(reader, "PropertyName"),
             SortOrder = SQLDataHelper.GetInt(reader, "PropertySortOrder"),
             Expanded = SQLDataHelper.GetBoolean(reader, "Expanded"),
             UseInDetails = SQLDataHelper.GetBoolean(reader, "UseInDetails"),
             UseInFilter = SQLDataHelper.GetBoolean(reader, "UseInFilter"),
             UseInBrief = SQLDataHelper.GetBoolean(reader, "UseInBrief"),
             Type = SQLDataHelper.GetInt(reader, "Type"),
             Group = SQLDataHelper.GetNullableInt(reader, "GroupId") != null ? new PropertyGroup()
             {
                 PropertyGroupId = SQLDataHelper.GetInt(reader, "GroupId"),
                 Name = SQLDataHelper.GetString(reader, "GroupName"),
                 SortOrder = SQLDataHelper.GetInt(reader, "GroupSortOrder")
             }
                                :null
         }
     });
 }
Пример #2
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)));
 }
Пример #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
        /// <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>());
        }
Пример #6
0
 private static RoleAction GetCustomerRoleActionFromReader(SqlDataReader reader)
 {
     return(new RoleAction
     {
         Key = (RoleActionKey)Enum.Parse(typeof(RoleActionKey), SQLDataHelper.GetString(reader, "RoleActionKey")),
         Enabled = SQLDataHelper.GetBoolean(reader, "Enabled")
     });
 }
Пример #7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var commentId = SQLDataHelper.GetInt(grid.UpdatedRow["Id"]);
                var name      = grid.UpdatedRow["Name"];
                var email     = grid.UpdatedRow["Email"];
                var text      = grid.UpdatedRow["[Text]"];



                var comment = ReviewService.GetReview(commentId);
                comment.Name    = name;
                comment.Email   = email;
                comment.Text    = text;
                comment.Checked = SQLDataHelper.GetBoolean(grid.UpdatedRow["Checked"]);

                DateTime dt;
                if (DateTime.TryParse(grid.UpdatedRow["AddDate"], out dt))
                {
                    comment.AddDate = dt;
                }

                ReviewService.UpdateReview(comment);
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 & _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex -= 1;
                data = _paging.PageItems;
            }

            data.Columns.Add(new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            });
            if (_selectionFilter != null && _selectionFilter.Values != null)
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    Int32 intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, (string c) => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }
            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }
            grid.DataSource = data;
            grid.DataBind();
            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #8
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                int sortOrder = 0;
                if (int.TryParse(grid.UpdatedRow["SortOrder"], out sortOrder))
                {
                    var car = new Carousel()
                    {
                        CarouselID = SQLDataHelper.GetInt(grid.UpdatedRow["ID"]),
                        URL        = grid.UpdatedRow["URL"],
                        SortOrder  = sortOrder,
                        Enabled    = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"])
                    };
                    CarouselService.UpdateCarousel(car);

                    var photo = PhotoService.GetPhotoByObjId(car.CarouselID, PhotoType.Carousel);
                    photo.Description = grid.UpdatedRow["Description"];
                    PhotoService.UpdatePhoto(photo);
                }
            }
            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                //TODO fields validation
                try
                {
                    VoiceService.UpdateTheme(new VoiceTheme
                    {
                        VoiceThemeId    = int.Parse(grid.UpdatedRow["ID"]),
                        Name            = grid.UpdatedRow["Name"],
                        IsDefault       = SQLDataHelper.GetBoolean(grid.UpdatedRow["IsDefault"]),
                        IsClose         = SQLDataHelper.GetBoolean(grid.UpdatedRow["IsClose"]),
                        IsHaveNullVoice =
                            SQLDataHelper.GetBoolean(grid.UpdatedRow["IsHaveNullVoice"])
                    });
                }
                catch (Exception ex)
                {
                    MsgErr(ex.Message);
                }
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            data.Columns.Add(new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            });
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString(CultureInfo.InvariantCulture);
        }
Пример #10
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            btnUpdateCurrencies.Visible = CurrencyService.GetAllCurrencies(true).Find(c => c.Iso3 == "RUB" && c.Value == 1) != null;

            if (grid.UpdatedRow != null && grid.UpdatedRow["CurrencyValue"].TryParseDecimal() > 0)
            {
                var id    = SQLDataHelper.GetInt(grid.UpdatedRow["ID"]);
                var upCur = CurrencyService.GetCurrency(id);
                upCur.Name         = grid.UpdatedRow["Name"];
                upCur.Symbol       = grid.UpdatedRow["Code"];
                upCur.Value        = grid.UpdatedRow["CurrencyValue"].TryParseFloat();
                upCur.Iso3         = grid.UpdatedRow["CurrencyISO3"];
                upCur.NumIso3      = grid.UpdatedRow["CurrencyNumIso3"].TryParseInt();
                upCur.IsCodeBefore = SQLDataHelper.GetBoolean(grid.UpdatedRow["IsCodeBefore"]);
                upCur.PriceFormat  = grid.UpdatedRow["PriceFormat"];
                CurrencyService.UpdateCurrency(upCur);
                CurrencyService.RefreshCurrency();
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #11
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var   type         = (CouponType)Enum.Parse(typeof(CouponType), grid.UpdatedRow["Type"]);
                float value        = 0;
                float minimalPrice = 0;
                if (!(!float.TryParse(grid.UpdatedRow["Value"], out value) || (type == CouponType.Percent && value > 100) || value <= 0 || !float.TryParse(grid.UpdatedRow["MinimalOrderPrice"], out minimalPrice)))
                {
                    Coupon coupon = CouponService.GetCoupon(SQLDataHelper.GetInt(grid.UpdatedRow["ID"]));
                    coupon.Code              = grid.UpdatedRow["Code"];
                    coupon.Type              = type;
                    coupon.Enabled           = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"]);
                    coupon.Value             = value;
                    coupon.MinimalOrderPrice = minimalPrice;
                    CouponService.UpdateCoupon(coupon);
                }
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #12
0
 private static Carousel GetCarouselFromReader(IDataReader reader)
 {
     return(new Carousel
     {
         CarouselID = SQLDataHelper.GetInt(reader, "CarouselID"),
         URL = SQLDataHelper.GetString(reader, "URL"),
         SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"),
         Enabled = SQLDataHelper.GetBoolean(reader, "Enabled")
     });
 }
Пример #13
0
        public static bool GetActivity(List <XmlNode> collection, string value)
        {
            var setting = collection.FirstOrDefault(item => item.Attributes != null && item.Attributes["name"].Value.Equals(value));

            if (setting != null)
            {
                return(SQLDataHelper.GetBoolean(setting.Attributes["enabled"].Value));
            }
            return(false);
        }
Пример #14
0
 private static Property GetPropertyFromReader(SqlDataReader reader)
 {
     return(new Property
     {
         PropertyId = SQLDataHelper.GetInt(reader, "PropertyId"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"),
         UseInFilter = SQLDataHelper.GetBoolean(reader, "UseInFilter")
     });
 }
Пример #15
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var certificate =
                    GiftCertificateService.GetCertificateByID(SQLDataHelper.GetInt(grid.UpdatedRow["ID"]));

                //if (!certificate.Paid && SQLDataHelper.GetBoolean(grid.UpdatedRow["Paid"]) && !CustomerContext.CurrentCustomer.IsVirtual)
                //{
                //    GiftCertificateService.SendCertificateMails(certificate);
                //}
                OrderService.PayOrder(certificate.OrderId, SQLDataHelper.GetBoolean(grid.UpdatedRow["Paid"]));

                certificate.Enable = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enable"]);
                certificate.Used   = SQLDataHelper.GetBoolean(grid.UpdatedRow["Used"]);
                GiftCertificateService.UpdateCertificateById(certificate);
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #16
0
 /// <summary>
 /// Get Module From SQLDataReader
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 private static Module GetModuleFromReader(SqlDataReader reader)
 {
     return(new Module
     {
         StringId = SQLDataHelper.GetString(reader, "ModuleStringID"),
         IsInstall = SQLDataHelper.GetBoolean(reader, "IsInstall"),
         DateAdded = SQLDataHelper.GetDateTime(reader, "DateAdded"),
         DateModified = SQLDataHelper.GetDateTime(reader, "DateModified"),
         Version = SQLDataHelper.GetString(reader, "Version")
     });
 }
Пример #17
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                int sortOrder = 0;
                if (Int32.TryParse(grid.UpdatedRow["SortOrder"], out sortOrder))
                {
                    OrderService.UpdateOrderStatus(
                        new OrderStatus
                    {
                        StatusID   = SQLDataHelper.GetInt(grid.UpdatedRow["ID"]),
                        StatusName = grid.UpdatedRow["StatusName"],
                        IsDefault  = SQLDataHelper.GetBoolean(grid.UpdatedRow["IsDefault"]),
                        Command    = (OrderStatusCommand)SQLDataHelper.GetInt(grid.UpdatedRow["CommandID"]),
                        IsCanceled = SQLDataHelper.GetBoolean(grid.UpdatedRow["IsCanceled"]),
                        Color      = grid.UpdatedRow["Color"],
                        SortOrder  = sortOrder
                    });
                }
            }


            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 & _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex -= 1;
                data = _paging.PageItems;
            }

            data.Columns.Add(new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            });
            if (_selectionFilter != null && _selectionFilter.Values != null)
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    Int32 intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }
            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }
            grid.DataSource = data;
            grid.DataBind();
            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #18
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var part = StaticBlockService.GetPagePart(SQLDataHelper.GetInt(grid.UpdatedRow["ID"]));

                part.InnerName = grid.UpdatedRow["InnerName"];
                part.Key       = grid.UpdatedRow["[Key]"];
                part.Enabled   = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"]);

                if (part.InnerName.IsNotEmpty() && part.Key.IsNotEmpty())
                {
                    StaticBlockService.UpdatePagePart(part);
                }
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Пример #19
0
 private static CustomOption GetCustomOptionFromReader(SqlDataReader reader)
 {
     return(new CustomOption
     {
         CustomOptionsId = SQLDataHelper.GetInt(reader, "CustomOptionsID"),
         Title = SQLDataHelper.GetString(reader, "Title"),
         InputType = (CustomOptionInputType)SQLDataHelper.GetInt(reader, "InputType"),
         IsRequired = SQLDataHelper.GetBoolean(reader, "IsRequired"),
         SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"),
         ProductId = SQLDataHelper.GetInt(reader, "ProductID")
     });
 }
Пример #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 public static Subscription GetSubscriptionFromReader(SqlDataReader reader)
 {
     return(new Subscription
     {
         Id = SQLDataHelper.GetInt(reader, "Id"),
         Email = SQLDataHelper.GetString(reader, "Email"),
         Subscribe = SQLDataHelper.GetBoolean(reader, "Subscribe"),
         SubscribeDate = SQLDataHelper.GetDateTime(reader, "SubscribeDate"),
         UnsubscribeDate = SQLDataHelper.GetDateTime(reader, "UnsubscribeDate"),
         UnsubscribeReason = SQLDataHelper.GetString(reader, "UnsubscribeReason")
     });
 }
Пример #21
0
 public static City GetCityFromReader(SqlDataReader reader)
 {
     return(new City
     {
         CityId = SQLDataHelper.GetInt(reader, "CityID"),
         Name = SQLDataHelper.GetString(reader, "CityName"),
         RegionId = SQLDataHelper.GetInt(reader, "RegionID"),
         CitySort = SQLDataHelper.GetInt(reader, "CitySort"),
         DisplayInPopup = SQLDataHelper.GetBoolean(reader, "DisplayInPopup"),
         PhoneNumber = SQLDataHelper.GetString(reader, "PhoneNumber")
     });
 }
Пример #22
0
 public static Country GetCountryFromReader(SqlDataReader reader)
 {
     return(new Country
     {
         CountryId = SQLDataHelper.GetInt(reader, "CountryID"),
         Iso2 = SQLDataHelper.GetString(reader, "CountryISO2"),
         Iso3 = SQLDataHelper.GetString(reader, "CountryISO3"),
         Name = SQLDataHelper.GetString(reader, "CountryName"),
         DisplayInPopup = SQLDataHelper.GetBoolean(reader, "DisplayInPopup"),
         SortOrder = SQLDataHelper.GetInt(reader, "SortOrder")
     });
 }
Пример #23
0
 private static AbandonedCartTemplate GetTemplateFromReader(SqlDataReader reader)
 {
     return(new AbandonedCartTemplate
     {
         Id = SQLDataHelper.GetInt(reader, "Id"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         Subject = SQLDataHelper.GetString(reader, "Subject"),
         Body = SQLDataHelper.GetString(reader, "Body"),
         SendingTime = SQLDataHelper.GetInt(reader, "SendingTime"),
         Active = SQLDataHelper.GetBoolean(reader, "Active"),
     });
 }
Пример #24
0
 private static StaticBlock GetPagePartFromReader(SqlDataReader reader)
 {
     return(new StaticBlock(SQLDataHelper.GetInt(reader, "StaticBlockID"))
     {
         Key = SQLDataHelper.GetString(reader, "key"),
         InnerName = SQLDataHelper.GetString(reader, "InnerName"),
         Content = SQLDataHelper.GetString(reader, "Content"),
         Added = SQLDataHelper.GetDateTime(reader, "Added"),
         Modified = SQLDataHelper.GetDateTime(reader, "Modified"),
         Enabled = SQLDataHelper.GetBoolean(reader, "Enabled")
     });
 }
Пример #25
0
        public static Dictionary <string, bool> GetActivities(List <XmlNode> collection)
        {
            var result = new Dictionary <string, bool>();

            foreach (var item in collection)
            {
                if (item.Attributes != null && !result.ContainsKey(item.Attributes["name"].Value))
                {
                    result.Add(item.Attributes["name"].Value, SQLDataHelper.GetBoolean(item.Attributes["enabled"].Value));
                }
            }
            return(result);
        }
Пример #26
0
        private static TaxElement ReadTax(SqlDataReader reader)
        {
            var t = new TaxElement
            {
                TaxId       = SQLDataHelper.GetInt(reader, "TaxId"),
                Enabled     = SQLDataHelper.GetBoolean(reader, "Enabled"),
                Name        = SQLDataHelper.GetString(reader, "Name"),
                Rate        = SQLDataHelper.GetFloat(reader, "Rate"),
                ShowInPrice = SQLDataHelper.GetBoolean(reader, "ShowInPrice")
            };

            return(t);
        }
Пример #27
0
 private static CallbackCustomer GetCallbackCustomerFromReader(SqlDataReader reader)
 {
     return(new CallbackCustomer
     {
         ID = SQLDataHelper.GetInt(reader, "ID"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         Phone = SQLDataHelper.GetString(reader, "Phone"),
         DateAdded = SQLDataHelper.GetDateTime(reader, "DateAdded"),
         Comment = SQLDataHelper.GetString(reader, "Comment"),
         AdminComment = SQLDataHelper.GetString(reader, "AdminComment"),
         Processed = SQLDataHelper.GetBoolean(reader, "Processed"),
     });
 }
Пример #28
0
 private static Answer GetAnswerFromReader(SqlDataReader reader)
 {
     return(new Answer
     {
         AnswerId = SQLDataHelper.GetInt(reader["AnswerID"]),
         FkidTheme = SQLDataHelper.GetInt(reader["FKIDTheme"]),
         Name = SQLDataHelper.GetString(reader["Name"]).Trim(),
         CountVoice = SQLDataHelper.GetInt(reader["CountVoice"]),
         Sort = SQLDataHelper.GetInt(reader["Sort"]),
         IsVisible = SQLDataHelper.GetBoolean(reader["IsVisible"]),
         DateAdded = SQLDataHelper.GetDateTime(reader["DateAdded"]),
         DateModify = SQLDataHelper.GetDateTime(reader["DateModify"])
     });
 }
Пример #29
0
 private static Currency GetCurrencyFromReader(IDataReader reader)
 {
     return(new Currency
     {
         CurrencyID = SQLDataHelper.GetInt(reader, "CurrencyID"),
         Value = SQLDataHelper.GetDecimal(reader, "CurrencyValue"),
         Iso3 = SQLDataHelper.GetString(reader, "CurrencyIso3"),
         Symbol = SQLDataHelper.GetString(reader, "Code"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         PriceFormat = SQLDataHelper.GetString(reader, "PriceFormat", string.Empty),
         IsCodeBefore = SQLDataHelper.GetBoolean(reader, "IsCodeBefore"),
         NumIso3 = SQLDataHelper.GetInt(reader, "CurrencyNumIso3")
     });
 }
Пример #30
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                int sort = 0;
                int.TryParse(grid.UpdatedRow["SortOrder"], out sort);
                Brand brand = BrandService.GetBrandById(SQLDataHelper.GetInt(grid.UpdatedRow["ID"]));
                brand.Name      = grid.UpdatedRow["BrandName"];
                brand.Enabled   = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"]);
                brand.SortOrder = sort;
                BrandService.UpdateBrand(brand);
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    var intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }