public static void CreateTax(TaxElement t) { using (var da = new SQLDataAccess()) { da.cmd.CommandText = "INSERT INTO [Catalog].[Tax]([Name], [Enabled], [Priority], [DependsOnAddress], [ShowInPrice], [RegNumber], [CountryID], [RateType], [FederalRate]) VALUES (@name, @enabled, @priority, @dependsOnAddress, @showInPrice, @regNumber, @countryId, @rateType, @federalRate); SELECT scope_identity()"; da.cmd.CommandType = CommandType.Text; da.cmd.Parameters.Clear(); da.cmd.Parameters.AddWithValue("@name", t.Name); da.cmd.Parameters.AddWithValue("@enabled", t.Enabled); da.cmd.Parameters.AddWithValue("@priority", t.Priority); da.cmd.Parameters.AddWithValue("@dependsOnAddress", (int)t.DependsOnAddress); da.cmd.Parameters.AddWithValue("@showInPrice", t.ShowInPrice); da.cmd.Parameters.AddWithValue("@regNumber", t.RegNumber ?? (object)DBNull.Value); da.cmd.Parameters.AddWithValue("@countryId", t.CountryID); da.cmd.Parameters.AddWithValue("@rateType", (int)t.Type); da.cmd.Parameters.AddWithValue("@federalRate", t.FederalRate); da.cnOpen(); t.TaxId = SQLDataHelper.GetInt(da.cmd.ExecuteScalar()); da.cnClose(); if (t.RegionalRates != null) { da.cnOpen(); da.cmd.CommandText = "INSERT INTO [Catalog].[TaxRegionRate] ([TaxId], [RegionID], [RegionRate]) VALUES (@TaxId, @regionId, @regionRate)"; foreach (var rr in t.RegionalRates) { da.cmd.Parameters.Clear(); da.cmd.Parameters.AddWithValue("@TaxId", t.TaxId); da.cmd.Parameters.AddWithValue("@regionId", rr.RegionId); da.cmd.Parameters.AddWithValue("@regionRate", rr.Rate); da.cmd.ExecuteNonQuery(); } da.cnClose(); } } }
protected void lbDeleteSelectedFromCategory_Click(object sender, EventArgs e) { if (!_inverseSelection) { if (_selectionFilter != null) { foreach (var id in _selectionFilter.Values) { CategoryService.DeleteCategoryAndLink(SQLDataHelper.GetInt(id), SQLDataHelper.GetInt(Request["categoryid"])); } } } else { foreach (var p in _paging.ItemsIds <int>("[Product].[ProductID] as ID").Where(id => !_selectionFilter.Values.Contains(id.ToString()))) { CategoryService.DeleteCategoryAndLink(p, SQLDataHelper.GetInt(Request["categoryid"])); } } CategoryService.RecalculateProductsCountManual(); Response.Redirect("Catalog.aspx" + Request.Url.Query); }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { foreach (var item in MenuService.GetAllChildIdByParent(SQLDataHelper.GetInt(id), _menuType)) { MenuService.DeleteMenuItemById(item, _menuType); } } } else { var itemsIds = _paging.ItemsIds <int>("MenuItemID as ID"); foreach (var mItemId in itemsIds.Where(mId => !_selectionFilter.Values.Contains(mId.ToString()))) { foreach (var id in MenuService.GetAllChildIdByParent(mItemId, _menuType)) { MenuService.DeleteMenuItemById(id, _menuType); } } } if (_menuType == MenuService.EMenuType.Top) { CacheManager.RemoveByPattern(CacheNames.GetMainMenuCacheObjectName()); } if (_menuType == MenuService.EMenuType.Bottom) { var cacheName = CacheNames.GetBottomMenuCacheObjectName(); if (CacheManager.Contains(cacheName)) { CacheManager.Remove(cacheName); } } } }
protected void lbSetNotChecked_Click(object sender, EventArgs e) { if ((_selectionFilter == null) || (_selectionFilter.Values == null)) { return; } if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { ReviewService.CheckReview(SQLDataHelper.GetInt(id), false); } } else { var itemsIds = _paging.ItemsIds <int>("ReviewId as ID"); foreach (int id in itemsIds.Where(iId => !_selectionFilter.Values.Contains(iId.ToString()))) { ReviewService.CheckReview(id, false); } } }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteCategory") { NewsService.DeleteNewsCategory(SQLDataHelper.GetInt(e.CommandArgument)); } if (e.CommandName == "AddCategory") { try { GridViewRow footer = grid.FooterRow; if (!UrlService.IsAvailableUrl(ParamType.NewsCategory, ((TextBox)footer.FindControl("txtNewUrlPath")).Text)) { lblError.Text = Resource.Admin_SynonymExist; lblError.Visible = true; return; } var temp = new NewsCategory { Name = ((TextBox)footer.FindControl("txtNewName")).Text, UrlPath = ((TextBox)footer.FindControl("txtNewUrlPath")).Text, SortOrder = ((TextBox)footer.FindControl("txtNewSortOrder")).Text.TryParseInt() }; NewsService.InsertNewsCategory(temp); } catch (Exception ex) { Debug.LogError(ex); } grid.ShowFooter = false; } if (e.CommandName == "CancelAdd") { grid.ShowFooter = false; } }
private static OrderByRequest GetOrderByRequestFromReader(SqlDataReader reader) { return(new OrderByRequest { OrderByRequestId = SQLDataHelper.GetInt(reader, "OrderByRequestId"), ProductId = SQLDataHelper.GetInt(reader, "ProductID"), OfferId = SQLDataHelper.GetInt(reader, "OfferID"), ProductName = SQLDataHelper.GetString(reader, "ProductName"), ArtNo = SQLDataHelper.GetString(reader, "ArtNo"), Quantity = SQLDataHelper.GetFloat(reader, "Quantity"), UserName = SQLDataHelper.GetString(reader, "UserName"), Email = SQLDataHelper.GetString(reader, "Email"), Phone = SQLDataHelper.GetString(reader, "Phone"), Comment = SQLDataHelper.GetString(reader, "Comment"), IsComplete = SQLDataHelper.GetBoolean(reader, "IsComplete"), RequestDate = SQLDataHelper.GetDateTime(reader, "RequestDate"), Code = SQLDataHelper.GetString(reader, "Code"), CodeCreateDate = SQLDataHelper.GetDateTime(reader, "CodeCreateDate", DateTime.MinValue), LetterComment = SQLDataHelper.GetString(reader, "LetterComment"), Options = SQLDataHelper.GetString(reader, "Options"), }); }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "StatusDelete") { if (!OrderService.DeleteOrderStatus(SQLDataHelper.GetInt(e.CommandArgument))) { MsgErr(Resource.Admin_OrderStatuses_DeleteFailed); } } if (e.CommandName == "Add") { GridViewRow footer = ((AdvGridView)sender).FooterRow; string name = ((TextBox)footer.FindControl("txtStatusNameAdd")).Text; string color = ((TextBox)footer.FindControl("txtColorAdd")).Text; bool isDefault = ((CheckBox)footer.FindControl("chkIsDefaultAdd")).Checked; bool canceled = ((CheckBox)footer.FindControl("chkCanceledAdd")).Checked; int commandId = SQLDataHelper.GetInt(((DropDownList)footer.FindControl("ddlCommandIDAdd")).SelectedValue); int sortOrder = ((TextBox)footer.FindControl("txtAddSortOrder")).Text.TryParseInt(); if (!string.IsNullOrEmpty(name)) { OrderService.AddOrderStatus(new OrderStatus { StatusID = 0, StatusName = name, IsDefault = isDefault, Command = (OrderStatusCommand)commandId, IsCanceled = canceled, Color = color, SortOrder = sortOrder }); grid.ShowFooter = false; } } if (e.CommandName == "CancelAdd") { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc"); grid.ShowFooter = false; } }
private static void LoadChildCategories(TreeNode node) { foreach (Category c in CategoryService.GetChildCategoriesByCategoryId(SQLDataHelper.GetInt(node.Value), false)) { var newNode = new TreeNode { Text = c.Name + @" (" + c.ProductsCount + @")", Value = c.CategoryId.ToString() }; if (c.HasChild) { newNode.Expanded = false; newNode.PopulateOnDemand = true; } else { newNode.Expanded = true; newNode.PopulateOnDemand = false; } node.ChildNodes.Add(newNode); } }
private static void LoadChildMenuItems(TreeNode node) { foreach (var c in MenuService.GetChildMenuItemsByParentId(SQLDataHelper.GetInt(node.Value), MenuService.EMenuType.Top)) { var newNode = new TreeNode { Text = c.MenuItemName, Value = c.MenuItemID.ToString() }; if (c.HasChild) { newNode.Expanded = false; newNode.PopulateOnDemand = true; } else { newNode.Expanded = true; newNode.PopulateOnDemand = false; } node.ChildNodes.Add(newNode); } }
protected void lbDeleteSelected1_Click(object sender, EventArgs e) { if (!_inverseSelection) { if (_selectionFilter != null) { foreach (var id in _selectionFilter.Values) { ProductService.DeleteProduct(SQLDataHelper.GetInt(id), true); } } } else { foreach (int id in _paging.ItemsIds <int>("[Product].[ProductID] as ID").Where(id => !_selectionFilter.Values.Contains(id.ToString()))) { ProductService.DeleteProduct(id, true); } } CategoryService.RecalculateProductsCountManual(); _needReloadTree = true; }
public static int GetSelectedSubCategoriesCount(int parentCategoryId, int taxID) { using (var da = new SQLDataAccess()) { da.cmd.CommandType = CommandType.Text; da.cmd.CommandText = @"SELECT count(*) FROM [Catalog].[Category] inner join [Catalog].[TaxSelectedCategories] on [Category].[CategoryID] = [TaxSelectedCategories].[CategoryID] where [Category].[ParentCategory] = @ParentCategory and [Category].[CategoryID] <> @ParentCategory and [TaxID] = @TaxID"; //"Select Count([WhereHasTax]) from (SELECT (select count(Product.ID) from catalog.Product inner join catalog.TaxMappingOnProduct on TaxMappingOnProduct.ProductID = Product.ID inner join Catalog.ProductCategories on ProductCategories.ProductID = Product.ID where ProductCategories.CategoryID= p.ID) AS [WhereHasTax] FROM [Catalog].[Category] AS p WHERE [ParentCategory] = @id AND ID <> '0' ) as Row where [WhereHasTax] > 0 "; da.cmd.Parameters.Clear(); da.cmd.Parameters.AddWithValue("@ParentCategory", parentCategoryId); da.cmd.Parameters.AddWithValue("@TaxID", taxID); da.cnOpen(); var result = SQLDataHelper.GetInt(da.cmd.ExecuteScalar()); da.cnClose(); return(result); } }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { CustomerGroupService.DeleteCustomerGroup(SQLDataHelper.GetInt(id)); } } else { var itemsIds = _paging.ItemsIds <int>("CustomerGroupId as ID"); //IEnumerable<int> ids = CustomerGroupService.GetCustomerGroupListIds(); foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture)))) { CustomerGroupService.DeleteCustomerGroup(id); } } } }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { RedirectSeoService.DeleteRedirectSeo(SQLDataHelper.GetInt(id)); } } else { var itemsIds = _paging.ItemsIds <int>("ID"); // List<int> ids = CountryService.GetAllCountryID(); foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture)))) { RedirectSeoService.DeleteRedirectSeo(id); } } } }
private void LoadChildCategories(TreeNode node) { foreach (var c in CategoryService.GetChildCategoriesByCategoryId(SQLDataHelper.GetInt(node.Value), false).Where(c => c.CategoryId != ExceptId && !AnotherExceptIds.Contains(c.CategoryId))) { var newNode = new TreeNode { Text = string.Format("{0} ({1})", c.Name, c.ProductsCount), Value = c.CategoryId.ToString() }; if (c.HasChild) { newNode.Expanded = false; newNode.PopulateOnDemand = true; } else { newNode.Expanded = true; newNode.PopulateOnDemand = false; } node.ChildNodes.Add(newNode); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Page.Request.QueryString["Page"] == null) { return; } string curPage = Page.Request.QueryString["Page"].Split('#')[0]; if (Helpers.ValidationHelper.IsValidPositiveIntNumber(curPage)) { CurrentPageIndex = SQLDataHelper.GetInt(curPage); } else { return; } OnSelectedPageChanged(new EventArgs()); }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteCustomerGroup") { CustomerGroupService.DeleteCustomerGroup(SQLDataHelper.GetInt(e.CommandArgument)); } if (e.CommandName == "AddCustomerGroup") { GridViewRow footer = grid.FooterRow; float discount = 0; if (!float.TryParse(((TextBox)footer.FindControl("txtNewGroupDiscount")).Text, out discount)) { discount = -1; } if (discount < 0 || string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewGroupName")).Text)) { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc"); return; } var customerGroup = new CustomerGroup { GroupName = ((TextBox)footer.FindControl("txtNewGroupName")).Text, GroupDiscount = discount, }; CustomerGroupService.AddCustomerGroup(customerGroup); grid.ShowFooter = false; } if (e.CommandName == "CancelAdd") { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc"); grid.ShowFooter = false; } }
public static IList <PropertyValue> GetPropertyValuesByCategories(int categoryId, bool useDepth) { return(SQLDataAccess.ExecuteReadList <PropertyValue>( "[Catalog].[sp_GetPropertyInFilter]", CommandType.StoredProcedure, reader => new PropertyValue { PropertyValueId = SQLDataHelper.GetInt(reader, "PropertyValueID"), PropertyId = SQLDataHelper.GetInt(reader, "PropertyID"), Value = SQLDataHelper.GetString(reader, "Value"), Property = new Property { PropertyId = SQLDataHelper.GetInt(reader, "PropertyID"), Name = SQLDataHelper.GetString(reader, "PropertyName"), SortOrder = SQLDataHelper.GetInt(reader, "PropertySortOrder"), Expanded = SQLDataHelper.GetBoolean(reader, "PropertyExpanded"), Type = SQLDataHelper.GetInt(reader, "PropertyType"), Unit = SQLDataHelper.GetString(reader, "PropertyUnit") } }, new SqlParameter("@categoryId", categoryId), new SqlParameter("@useDepth", useDepth))); }
public static PaymentMethod GetPaymentMethodFromReader(SqlDataReader reader, bool loadPic = false) { var method = PaymentMethod.Create((PaymentType)SQLDataHelper.GetInt(reader, "PaymentType")); method.PaymentMethodId = SQLDataHelper.GetInt(reader, "PaymentMethodID"); method.Name = SQLDataHelper.GetString(reader, "Name"); method.Enabled = SQLDataHelper.GetBoolean(reader, "Enabled"); method.Description = SQLDataHelper.GetString(reader, "Description"); method.SortOrder = SQLDataHelper.GetInt(reader, "SortOrder"); method.ExtrachargeType = (ExtrachargeType)SQLDataHelper.GetInt(reader, "ExtrachargeType"); method.Extracharge = SQLDataHelper.GetFloat(reader, "Extracharge"); method.Parameters = GetPaymentMethodParameters(method.PaymentMethodId); if (loadPic) { method.IconFileName = new Photo(SQLDataHelper.GetInt(reader, "PhotoId"), SQLDataHelper.GetInt(reader, "ObjId"), PhotoType.Payment) { PhotoName = SQLDataHelper.GetString(reader, "PhotoName") } } ; return(method); }
//TODO vladimir, доделать когда закончим допиливать методы оплаты и доставки public static List <KeyValuePair <string, int> > GetPaymentTypeRating() { var result = new List <KeyValuePair <string, int> >(); using (var db = new SQLDataAccess()) { db.cmd.CommandText = "[Order].[sp_GetPaymentRating]"; db.cmd.CommandType = CommandType.StoredProcedure; db.cmd.Parameters.Clear(); db.cnOpen(); using (SqlDataReader reader = db.cmd.ExecuteReader()) { while (reader.Read()) { result.Add(new KeyValuePair <string, int>(SQLDataHelper.GetString(reader, "PaymentMethod"), SQLDataHelper.GetInt(reader, "Rating"))); } reader.Close(); } db.cnClose(); } return(result); }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { if (_menuType == MenuService.EMenuType.Top) { CacheManager.RemoveByPattern(CacheNames.GetMainMenuCacheObjectName()); } else if (_menuType == MenuService.EMenuType.Bottom) { var cacheName = CacheNames.GetBottomMenuCacheObjectName(); if (CacheManager.Contains(cacheName)) { CacheManager.Remove(cacheName); } } foreach (var id in MenuService.GetAllChildIdByParent(SQLDataHelper.GetInt(e.CommandArgument), _menuType)) { MenuService.DeleteMenuItemById(id, _menuType); } } }
protected void SaveStaticPage() { if (!ValidateInput()) { return; } var page = StaticPageService.GetStaticPage(StaticPageId); page.PageName = txtPageName.Text; page.PageText = fckPageText.Text; page.UrlPath = txtSynonym.Text; page.ParentId = SQLDataHelper.GetInt(hfParentId.Value); page.IndexAtSiteMap = chkIndexAtSitemap.Checked; page.ModifyDate = DateTime.Now; page.Enabled = chkEnabled.Checked; page.SortOrder = txtSortOrder.Text.TryParseInt(); page.Meta = new MetaInfo(0, StaticPageId, MetaType.StaticPage, txtPageTitle.Text, txtMetaKeywords.Text, txtMetaDescription.Text, txtH1.Text); StaticPageService.UpdateStaticPage(page); LoadStaticPage(); }
public static Dictionary <DateTime, int> GetOrdersCountByPeriod(DateTime minDate, DateTime maxDate) { var sums = new Dictionary <DateTime, int>(); using (var db = new SQLDataAccess()) { db.cmd.CommandText = "[Order].[sp_GetCountByMonths]"; db.cmd.CommandType = CommandType.StoredProcedure; db.cmd.Parameters.Clear(); db.cmd.Parameters.AddWithValue("@MinDate", minDate); db.cmd.Parameters.AddWithValue("@MaxDate", maxDate); db.cnOpen(); using (SqlDataReader reader = db.cmd.ExecuteReader()) while (reader.Read()) { sums.Add( new DateTime(SQLDataHelper.GetInt(reader, "Year"), SQLDataHelper.GetInt(reader, "Month"), 1), SQLDataHelper.GetInt(reader, "Count")); } db.cnClose(); return(sums); } }
private void LoadChildCategories2(TreeNode node) { foreach (var c in CategoryService.GetChildCategoriesByCategoryId(SQLDataHelper.GetInt(node.Value), false)) { var newNode = new TreeNode { Text = SelectCategory(c.CategoryId, ModuleName, c.Name), Value = c.CategoryId.ToString(), NavigateUrl = ExportFeedNew + "?moduleid=" + ModuleName + "&CatId=" + c.CategoryId }; if (c.HasChild) { newNode.Expanded = false; newNode.PopulateOnDemand = true; } else { newNode.Expanded = true; newNode.PopulateOnDemand = false; } node.ChildNodes.Add(newNode); } }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteCountry") { CountryService.Delete(SQLDataHelper.GetInt(e.CommandArgument)); } if (e.CommandName == "AddCountry") { var footer = grid.FooterRow; if ( string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewName")).Text) || string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewISO2")).Text) || string.IsNullOrEmpty(((TextBox)footer.FindControl("txtNewISO3")).Text) ) { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc"); return; } CountryService.Add(new Country { Name = ((TextBox)footer.FindControl("txtNewName")).Text, Iso2 = ((TextBox)footer.FindControl("txtNewISO2")).Text, Iso3 = ((TextBox)footer.FindControl("txtNewISO3")).Text, DisplayInPopup = ((CheckBox)footer.FindControl("chkNewDisplayInPopup")).Checked, SortOrder = ((TextBox)footer.FindControl("txtNewSortOrder")).Text.TryParseInt() }); grid.ShowFooter = false; } if (e.CommandName == "CancelAdd") { grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc"); grid.ShowFooter = false; } }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteTheme") { VoiceService.DeleteTheme(SQLDataHelper.GetInt(e.CommandArgument)); } if (e.CommandName == "AddTheme") { //TODO validate input try { VoiceService.AddTheme(new VoiceTheme { Name = ((TextBox)grid.FooterRow.FindControl("txtNewName")).Text, IsDefault = ((CheckBox)grid.FooterRow.FindControl("chkNewIsDefault")).Checked, IsHaveNullVoice = ((CheckBox)grid.FooterRow.FindControl("chkNewIsHaveNullVoice")). Checked, IsClose = ((CheckBox)grid.FooterRow.FindControl("chkNewIsClose")).Checked }); grid.ShowFooter = false; } catch (Exception ex) { MsgErr(ex.Message); } } if (e.CommandName == "CancelAdd") { grid.ShowFooter = false; } }
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; case ProductOnMain.TypeFlag.OnSale: subCmd = "OnSale=1"; break; case ProductOnMain.TypeFlag.Recomended: subCmd = "Recomended=1"; break; } string cmd = "Select Brand.BrandID, Brand.BrandName, UrlPath, Brand.SortOrder from Catalog.Brand where BrandID in (select BrandID from Catalog.Product where " + subCmd + " ) and enabled=1 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") })); }
protected IEnumerable <ExportFeedProduts> GetProduts(string moduleName) { return(SQLDataAccess.ExecuteReadIEnumerable <ExportFeedProduts>("[Settings].[sp_GetExportFeedProducts]", CommandType.StoredProcedure, reader => new ExportFeedProduts { ProductID = SQLDataHelper.GetInt(reader, "ProductID"), Amount = SQLDataHelper.GetInt(reader, "Amount"), UrlPath = SQLDataHelper.GetString(reader, "UrlPath"), Price = SQLDataHelper.GetDecimal(reader, "Price"), Discount = SQLDataHelper.GetDecimal(reader, "Discount"), ParentCategory = SQLDataHelper.GetInt(reader, "ParentCategory"), Name = SQLDataHelper.GetString(reader, "Name"), Description = SQLDataHelper.GetString(reader, "Description"), BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription"), Photo = SQLDataHelper.GetString(reader, "Photo"), //Added by Evgeni BrandName = SQLDataHelper.GetString(reader, "BrandName"), ArtNo = SQLDataHelper.GetString(reader, "ArtNo"), }, new SqlParameter("@moduleName", moduleName), new SqlParameter("@selectedCurrency", ExportFeed.GetModuleSetting(moduleName, "Currency")), new SqlParameter("@onlyCount", false))); }
public static Category GetCategoryFromReader(SqlDataReader reader) { return(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"), Description = SQLDataHelper.GetString(reader, "Description"), BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription"), Enabled = SQLDataHelper.GetBoolean(reader, "Enabled"), DisplayStyle = SQLDataHelper.GetString(reader, "DisplayStyle"), DisplayChildProducts = SQLDataHelper.GetBoolean(reader, "DisplayChildProducts"), DisplayBrandsInMenu = SQLDataHelper.GetBoolean(reader, "DisplayBrandsInMenu"), DisplaySubCategoriesInMenu = SQLDataHelper.GetBoolean(reader, "DisplaySubCategoriesInMenu"), //MiniPicture = SQLDataHelper.GetString(reader, "MiniPicture"), TotalProductsCount = SQLDataHelper.GetInt(reader, "Total_Products_Count"), UrlPath = SQLDataHelper.GetString(reader, "UrlPath"), ParentsEnabled = SQLDataHelper.GetBoolean(reader, "HirecalEnabled"), Sorting = (ESortOrder)SQLDataHelper.GetInt(reader, "Sorting") }); }
/// <summary> /// delete category by categoryId /// </summary> /// <param name="categoryId"></param> /// <param name="updateCache">refresh cache</param> /// <returns>return list of file namme image</returns> private static IEnumerable <int> DeleteCategory(int categoryId, bool updateCache) { if (categoryId == 0) { throw new Exception("deleting Root catregory"); } if (updateCache) { CacheManager.Remove(CacheNames.GetCategoryCacheObjectName(categoryId)); CacheManager.RemoveByPattern("MenuCatalog"); var cacheName = CacheNames.GetBottomMenuCacheObjectName(); if (CacheManager.Contains(cacheName)) { CacheManager.Remove(cacheName); } } return(SQLDataAccess.ExecuteReadIEnumerable("[Catalog].[sp_DeleteCategoryWithSubCategoies]", CommandType.StoredProcedure, reader => SQLDataHelper.GetInt(reader, "CategoryID"), new SqlParameter("@id", categoryId))); }
protected IEnumerable <ExportFeedProduts> GetProduts(string moduleName) { return(SQLDataAccess.ExecuteReadIEnumerable <ExportFeedProduts>("[Settings].[sp_GetExportFeedProducts]", CommandType.StoredProcedure, reader => new ExportFeedProduts { ProductId = SQLDataHelper.GetInt(reader, "ProductID"), OfferId = SQLDataHelper.GetInt(reader, "OfferId"), //Заменяем настоящий ArtNo на альтернативный из свойств ArtNo = GetAltArtNoFromProperty(SQLDataHelper.GetInt(reader, "ProductID")), Amount = SQLDataHelper.GetInt(reader, "Amount"), UrlPath = SQLDataHelper.GetString(reader, "UrlPath"), Price = SQLDataHelper.GetFloat(reader, "Price"), ShippingPrice = SQLDataHelper.GetFloat(reader, "ShippingPrice"), Discount = SQLDataHelper.GetFloat(reader, "Discount"), ParentCategory = SQLDataHelper.GetInt(reader, "ParentCategory"), Name = SQLDataHelper.GetString(reader, "Name"), Description = SQLDataHelper.GetString(reader, "Description"), BriefDescription = SQLDataHelper.GetString(reader, "BriefDescription"), Photos = SQLDataHelper.GetString(reader, "Photos"), SalesNote = SQLDataHelper.GetString(reader, "SalesNote"), ColorId = SQLDataHelper.GetInt(reader, "ColorId"), ColorName = SQLDataHelper.GetString(reader, "ColorName"), SizeId = SQLDataHelper.GetInt(reader, "SizeId"), SizeName = SQLDataHelper.GetString(reader, "SizeName"), BrandName = SQLDataHelper.GetString(reader, "BrandName"), Main = SQLDataHelper.GetBoolean(reader, "Main"), GoogleProductCategory = SQLDataHelper.GetString(reader, "GoogleProductCategory"), Gtin = SQLDataHelper.GetString(reader, "Gtin"), Adult = SQLDataHelper.GetBoolean(reader, "Adult"), ManufacturerWarranty = SQLDataHelper.GetBoolean(reader, "ManufacturerWarranty") }, new SqlParameter("@moduleName", moduleName), new SqlParameter("@selectedCurrency", ExportFeed.GetModuleSetting(moduleName, "Currency")), new SqlParameter("@onlyCount", false))); }