Exemplo n.º 1
0
        private void ProcessPackagingMethod(Module.PriceConfiguration.DTO.PriceConfigurationDto dtoItem, PriceConfigurationEntities context, int id, int userId, int productElementId)
        {
            PriceConfiguration dbItem = null;

            if (id > 0)
            {
                dbItem = context.PriceConfiguration.FirstOrDefault(s => s.Season.Equals(dtoItem.Season) && s.ProductElementID.Value == productElementId);

                if (dbItem == null)
                {
                    return;
                }

                dtoItem.PriceConfigurationID = dbItem.PriceConfigurationID;
            }
            else
            {
                dbItem = new PriceConfiguration()
                {
                    ProductElementID = productElementId, Season = dtoItem.Season, UpdatedBy = userId, UpdatedDate = DateTime.Now
                };
                context.PriceConfiguration.Add(dbItem);
            }

            converter.DTO2DB_UpdatePackagingMethod(dtoItem, dbItem);
        }
Exemplo n.º 2
0
        private void ProcessCushionColor(Module.PriceConfiguration.DTO.PriceConfigurationDto dtoItem, PriceConfigurationEntities context, int id, int userId, int productElementId)
        {
            PriceConfiguration dbItem = null;

            if (id > 0)
            {
                dbItem = context.PriceConfiguration.FirstOrDefault(o => o.Season.Equals(dtoItem.Season) && o.ProductElementID.Value == productElementId);
            }
            else
            {
                dbItem = new PriceConfiguration();
                context.PriceConfiguration.Add(dbItem);

                dbItem.Season           = dtoItem.Season;
                dbItem.ProductElementID = productElementId;
            }

            converter.DTO2DB_UpdateCushionColor(dtoItem, dbItem);

            dbItem.UpdatedBy   = userId;
            dbItem.UpdatedDate = DateTime.Now;
        }