Exemplo n.º 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
         }
     });
 }
Exemplo n.º 2
0
 public static int?GetChildCategoryIdByName(int parentId, string name)
 {
     return(SQLDataAccess.ExecuteReadOne(
                "SELECT CategoryID FROM [Catalog].[Category] WHERE [Name] = @Name AND [ParentCategory] = @ParentID",
                CommandType.Text,
                reader => SQLDataHelper.GetNullableInt(reader, "CategoryID"),
                new SqlParameter("@Name", name),
                new SqlParameter("@ParentID", parentId)));
 }
Exemplo n.º 3
0
 public static Offer GetOfferFromReader(SqlDataReader reader)
 {
     return(new Offer
     {
         ArtNo = SQLDataHelper.GetString(reader, "ArtNo"),
         Price = SQLDataHelper.GetFloat(reader, "Price"),
         Amount = SQLDataHelper.GetFloat(reader, "Amount"),
         SupplyPrice = SQLDataHelper.GetFloat(reader, "SupplyPrice"),
         ProductId = SQLDataHelper.GetInt(reader, "ProductID"),
         OfferId = SQLDataHelper.GetInt(reader, "OfferID"),
         ColorID = SQLDataHelper.GetNullableInt(reader, "ColorID"),
         SizeID = SQLDataHelper.GetNullableInt(reader, "SizeID"),
         Main = SQLDataHelper.GetBoolean(reader, "Main")
     });
 }
Exemplo n.º 4
0
 private static Review GetFromReader(SqlDataReader reader)
 {
     return new Review
     {
         ReviewId = SQLDataHelper.GetInt(reader, "ReviewId"),
         ParentId = SQLDataHelper.GetNullableInt(reader, "ParentId") ?? 0,
         EntityId = SQLDataHelper.GetInt(reader, "EntityId"),
         CustomerId = SQLDataHelper.GetGuid(reader, "CustomerId"),
         Name = SQLDataHelper.GetString(reader, "Name"),
         Email = SQLDataHelper.GetString(reader, "Email"),
         Text = SQLDataHelper.GetString(reader, "Text"),
         Checked = SQLDataHelper.GetBoolean(reader, "Checked"),
         AddDate = SQLDataHelper.GetDateTime(reader, "AddDate"),
         Ip = SQLDataHelper.GetString(reader, "IP")
     };
 }
Exemplo n.º 5
0
 public static Offer GetOfferFromReader(SqlDataReader reader)
 {
     return(new Offer
     {
         Price = SQLDataHelper.GetDecimal(reader, "Price"),
         Amount = SQLDataHelper.GetInt(reader, "Amount"),
         Unit = SQLDataHelper.GetString(reader, "Unit"),
         SupplyPrice = SQLDataHelper.GetDecimal(reader, "SupplyPrice"),
         OfferListId = SQLDataHelper.GetInt(reader, "OfferListId"),
         ProductId = SQLDataHelper.GetInt(reader, "ProductID"),
         OfferId = SQLDataHelper.GetInt(reader, "OfferID"),
         ShippingPrice = SQLDataHelper.GetDecimal(reader, "ShippingPrice"),
         MinAmount = SQLDataHelper.GetNullableInt(reader, "MinAmount"),
         MaxAmount = SQLDataHelper.GetNullableInt(reader, "MaxAmount")
     });
 }
Exemplo n.º 6
0
 public static Photo GetPhotoFromReader(SqlDataReader reader)
 {
     return(new Photo(
                SQLDataHelper.GetInt(reader, "PhotoId"),
                SQLDataHelper.GetInt(reader, "ObjId"),
                (PhotoType)Enum.Parse(typeof(PhotoType), SQLDataHelper.GetString(reader, "Type"), true))
     {
         Description = SQLDataHelper.GetString(reader, "Description"),
         ModifiedDate = SQLDataHelper.GetDateTime(reader, "ModifiedDate"),
         PhotoName = SQLDataHelper.GetString(reader, "PhotoName"),
         OriginName = SQLDataHelper.GetString(reader, "OriginName"),
         PhotoSortOrder = SQLDataHelper.GetInt(reader, "PhotoSortOrder"),
         Main = SQLDataHelper.GetBoolean(reader, "Main"),
         ColorID = SQLDataHelper.GetNullableInt(reader, "ColorID")
     });
 }
Exemplo n.º 7
0
        public static CustomerContact GetContactFromSqlDataReader(SqlDataReader reader)
        {
            var contact = new CustomerContact
            {
                CustomerContactID = SQLDataHelper.GetGuid(reader, "ContactID"),
                Address           = SQLDataHelper.GetString(reader, "Address"),
                City         = SQLDataHelper.GetString(reader, "City"),
                Country      = SQLDataHelper.GetString(reader, "Country"),
                Name         = SQLDataHelper.GetString(reader, "Name"),
                Zip          = SQLDataHelper.GetString(reader, "Zip"),
                RegionName   = SQLDataHelper.GetString(reader, "Zone"),
                CountryId    = SQLDataHelper.GetInt(reader, "CountryID"),
                RegionId     = SQLDataHelper.GetNullableInt(reader, "RegionID"),
                CustomerGuid = SQLDataHelper.GetGuid(reader, "CustomerID")
            };

            return(contact);
        }
Exemplo n.º 8
0
        public static IList <Offer> GetOffersByProductId(int productId)
        {
            List <Offer> p = SQLDataAccess.ExecuteReadList <Offer>("[Catalog].[sp_GetProductOffersByProductID]",
                                                                   CommandType.StoredProcedure,
                                                                   reader => new Offer
            {
                Price         = SQLDataHelper.GetDecimal(reader, "Price"),
                OfferListId   = SQLDataHelper.GetInt(reader, "OfferListId"),
                Unit          = SQLDataHelper.GetString(reader, "Unit"),
                Amount        = SQLDataHelper.GetInt(reader, "Amount"),
                SupplyPrice   = SQLDataHelper.GetDecimal(reader, "SupplyPrice"),
                ShippingPrice = SQLDataHelper.GetDecimal(reader, "ShippingPrice"),
                Multiplicity  = SQLDataHelper.GetInt(reader, "Multiplicity"),
                MinAmount     = SQLDataHelper.GetNullableInt(reader, "MinAmount"),
                MaxAmount     = SQLDataHelper.GetNullableInt(reader, "MaxAmount")
            }, new SqlParameter("@ProductID", productId));

            return(p);
        }
Exemplo n.º 9
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"),
                UseInDetails = SQLDataHelper.GetBoolean(reader, "UseInDetails"),
                UseInBrief = SQLDataHelper.GetBoolean(reader, "UseInBrief"),
                Expanded = SQLDataHelper.GetBoolean(reader, "Expanded"),

                Description = SQLDataHelper.GetString(reader, "Description"),
                Unit = SQLDataHelper.GetString(reader, "Unit"),
                Type = SQLDataHelper.GetInt(reader, "Type"),
                GroupId = SQLDataHelper.GetNullableInt(reader, "GroupId"),
            });
        }