Example #1
0
        static void fillMap()
        {
            if (mapProductType == null)
            {
                mapProductType = new Dictionary <String, ProductTypeEntity>();
            }

            ProductTypeEntity type1 = new ProductTypeEntity();

            type1.Id          = "1";
            type1.Code        = "B";
            type1.Description = "Bahan";
            type1.Expiration  = false;

            mapProductType.Add(type1.Id, type1);

            ProductTypeEntity type2 = new ProductTypeEntity();

            type2.Id          = "2";
            type2.Code        = "A";
            type2.Description = "Alat";
            type2.Expiration  = true;

            mapProductType.Add(type2.Id, type2);
        }
Example #2
0
        public async void ProductTypeUpdate()
        {
            // Arrange
            this.QuarryDbContext.ProductTypes.AddRange(
                new ProductTypeEntity()
            {
                ProductTypeId = 1, ProductTypeName = "Slab", CompanyId = 1, DeletedInd = false
            },
                new ProductTypeEntity()
            {
                ProductTypeId = 2, ProductTypeName = "Tile", CompanyId = 1, DeletedInd = false
            });
            await this.SaveChangesAsync(this.QuarryDbContext);

            ProductTypeModel model = new ProductTypeModel()
            {
                ProductTypeId = 2, ProductTypeName = "Boulder"
            };

            // Act
            AjaxModel <NTModel> ajaxModel = await this.Controller.ProductTypeUpdate(model);

            // Assert
            ProductTypeEntity entity = this.QuarryDbContext.ProductTypes.Where(e => e.ProductTypeId == 2).First();

            Assert.Equal(entity.ProductTypeName, "Boulder");
            Assert.Equal(ajaxModel.Message, QuarryMessages.ProductTypeSaveSuccess);
        }
 public ProductTypeWindowViewModel(ChildWindow aChildWindow, ProductTypeEntity aProductTypeEntity)
 {
     childWindow       = aChildWindow;
     ProductTypeEntity = aProductTypeEntity;
     OnOK     = new DelegateCommand(OnOKCommand);
     OnCancel = new DelegateCommand(OnCancelCommand);
 }
 public ProductTypeEntity ByProductTypeNameGetInfo(ProductTypeEntity entity)
 {
     CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("ByProductTypeNameGetInfo");
     command.SetParameterValue("@ProductTypeName", entity.ProductTypeName);
     command.SetParameterValue("@SysNo", entity.SysNo);
     ProductTypeEntity result = command.ExecuteEntity<ProductTypeEntity>();
     return result;
 }
        private void OnAddCommand()
        {
            AddProductTypeEntity             = new ProductTypeEntity();
            AddProductTypeEntity.ProductType = new ProductManager.Web.Model.product_type();
            ProductTypeWindow productTypeWindow = new ProductTypeWindow(AddProductTypeEntity);

            productTypeWindow.Closed += productTypeWindow_Closed;
            productTypeWindow.Show();
        }
Example #6
0
        private void cmbType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ProductTypeEntity type = ((sender as ComboBox)).SelectedItem as ProductTypeEntity;

            if (type != null)
            {
                lblNotif.Text = type.Expiration ? "Expire Notification" : "Aging Notification";
            }
        }
 public int ByProductTypeNameGetInfo(string productTypeName, string sysno)
 {
     int SysNo;
     int.TryParse(sysno, out SysNo);
     ProductTypeEntity entity = new ProductTypeEntity() { ProductTypeName = productTypeName, SysNo = SysNo };
     ProductTypeEntity cheEntity = ProductTypeFacade.ByProductTypeNameGetInfo(entity);
     if (cheEntity == null || cheEntity.SysNo == 0)
     {
         return 1;
     }
     return 0;
 }
Example #8
0
        public List <ProductStockEntity> getStocks(ProductTypeEntity type)
        {
            var request = new RestRequest("product/stock", Method.GET);

            client.AddHandler("application/json", util.JsonSerializer.Default);
            request.JsonSerializer = util.JsonSerializer.Default;

            request.AddQueryParameter("type", type.Id);

            IRestResponse <TCommonResponse <List <ProductStockEntity> > > products = client.Execute <TCommonResponse <List <ProductStockEntity> > >(request);

            return(products.Data.Data);
        }
 public int Create(ProductTypeEntity obj)
 {
     obj.InDate = DateTime.Now;
     obj.InUser = WebContext.LoginUser.UserName;
     obj.Status = 0;
     if (obj.SysNo == 0)
     {
         return ProductTypeFacade.InsertProductType(obj);
     }
     else
     {
         return ProductTypeFacade.UpdateProductType(obj);
     }
 }
Example #10
0
 private void cmbType_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ProductTypeEntity type = ((sender as ComboBox)).SelectedItem as ProductTypeEntity;
     if (type != null)
     {
         dataGrid.Columns[3].Header = type.Expiration ? "Expired Date" : "Aging Date";
         dataGrid.Columns[7].Header = type.Expiration ? "Expiry Notif" : "Aging Notif";
         loadData();
         //dataGrid.ItemsSource = null;
         //dataGrid.ItemsSource = productStocks.Where(x => x.Product.Type!=null && string.Equals(x.Product.Type.Id, type.Id));
         //MessageBox.Show("change");
         //lblNotif.Text = type.Expiration ? "Expire Notification" : "Aging Notification";
     }
 }
 public int InsertProductType(ProductTypeEntity entity)
 {
     CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("InsertProductType");
     command.SetParameterValue("@ParentSysNo", entity.ParentSysNo);
     command.SetParameterValue("@ProductTypeName", entity.ProductTypeName);
     command.SetParameterValue("@Order", entity.Order);
     command.SetParameterValue("@Status", entity.Status);
     command.SetParameterValue("@InUser", entity.InUser);
     command.SetParameterValue("@InDate", entity.InDate);
     object obj = command.ExecuteScalar();
     if (obj != null)
         return Convert.ToInt32(obj);
     else
         return 0;
 }
        private void loadOperationProductType_Completed(object sender, EventArgs e)
        {
            ProductTypeEntityList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.product_type product_type in loadOperation.Entities)
            {
                ProductTypeEntity productTypeEntity = new ProductTypeEntity();
                productTypeEntity.ProductType = product_type;
                productTypeEntity.Update();
                ProductTypeEntityList.Add(productTypeEntity);
            }
            UpdateChanged("ProductTypeEntityList");
            IsBusy = false;
        }
        private static void CheckProduct(WatchType watch, ProductTypeEntity watchProductTypeEntity, IProductTypeEntityRepository productTypeEntityRepo, long savedWatchId)
        {
            var watchNeedlesCount       = watch.Needles.Count;
            var watchEntityNeedlesCount = watchProductTypeEntity.Parts.Count(p => p.Child.TypeName.Equals(nameof(NeedleType)));

            Assert.AreEqual(watchNeedlesCount, watchEntityNeedlesCount, "Different number of needles");

            var watchfaceEntity = watchProductTypeEntity.Parts.First(p => p.Child.TypeName.Equals(nameof(WatchfaceType))).Child;

            Assert.NotNull(watchfaceEntity, "There is no watchface");

            var identity     = (ProductIdentity)watch.Identity;
            var byIdentifier = productTypeEntityRepo.GetByIdentity(identity.Identifier, identity.Revision);

            Assert.NotNull(byIdentifier, "New version of watch not found by identifier ");
            Assert.AreEqual(savedWatchId, byIdentifier.Id, "Different id´s");
        }
Example #14
0
        public async void ProductTypeAdd()
        {
            // Arrange
            ProductTypeModel model = new ProductTypeModel()
            {
                ProductTypeId = 0, ProductTypeName = "Tile"
            };

            // Act
            AjaxModel <NTModel> ajaxModel = await this.Controller.ProductTypeAdd(model);

            // Assert
            ProductTypeEntity entity = this.QuarryDbContext.ProductTypes.Last();

            Assert.Equal(entity.ProductTypeName, "Tile");
            Assert.Equal(ajaxModel.Message, QuarryMessages.ProductTypeSaveSuccess);
        }
Example #15
0
        public List <ProductEntity> getProducts(ProductTypeEntity type)
        {
            var request = new RestRequest("product/list/filter", Method.GET);

            client.AddHandler("application/json", util.JsonSerializer.Default);
            request.JsonSerializer = util.JsonSerializer.Default;

            List <KeyValue> listFilter = new List <KeyValue>();
            KeyValue        keyValue   = new KeyValue();

            keyValue.Key   = "productType";
            keyValue.Value = type.Id;
            listFilter.Add(keyValue);

            string strListFilter = JsonConvert.SerializeObject(listFilter);

            request.AddQueryParameter("field", strListFilter);

            IRestResponse <TCommonResponsePaging <ProductEntity> > products = client.Execute <TCommonResponsePaging <ProductEntity> >(request);

            return(products.Data.Paging.Data);
        }
Example #16
0
        /// <summary>
        /// Load all parts of the product
        /// </summary>
        private void LoadParts(IUnitOfWork uow, ProductTypeEntity typeEntity, IProductType productType, IDictionary <long, IProductType> loadedProducts)
        {
            // Let's get nasty!
            // Load children
            var type = productType.GetType();

            foreach (var part in LinkStrategies[type.Name].Values)
            {
                object value    = null;
                var    property = type.GetProperty(part.PropertyName);
                if (typeof(IProductPartLink).IsAssignableFrom(property.PropertyType))
                {
                    var linkEntity = FindLink(part.PropertyName, typeEntity);
                    if (linkEntity != null)
                    {
                        var link = LinkConstructors[$"{type.Name}.{property.Name}"]();
                        link.Id = linkEntity.Id;
                        part.LoadPartLink(linkEntity, link);
                        link.Product = (ProductType)Transform(uow, linkEntity.Child, true, loadedProducts, link);
                        value        = link;
                    }
                }
                else if (typeof(IList).IsAssignableFrom(property.PropertyType))
                {
                    var linkEntities = FindLinks(part.PropertyName, typeEntity);
                    var links        = (IList)Activator.CreateInstance(property.PropertyType);
                    foreach (var linkEntity in linkEntities)
                    {
                        var link = LinkConstructors[$"{type.Name}.{property.Name}"]();
                        link.Id = linkEntity.Id;
                        part.LoadPartLink(linkEntity, link);
                        link.Product = (ProductType)Transform(uow, linkEntity.Child, true, loadedProducts, link);
                        links.Add(link);
                    }
                    value = links;
                }
                property.SetValue(productType, value);
            }
        }
Example #17
0
        private IProductType Transform(IUnitOfWork uow, ProductTypeEntity typeEntity, bool full, IDictionary <long, IProductType> loadedProducts = null, IProductPartLink parentLink = null)
        {
            // Build cache if this wasn't done before
            if (loadedProducts == null)
            {
                loadedProducts = new Dictionary <long, IProductType>();
            }

            // Take converted product from dictionary if we already transformed it
            if (loadedProducts.ContainsKey(typeEntity.Id))
            {
                return(loadedProducts[typeEntity.Id]);
            }

            // Strategy to load product and its parts
            var strategy = TypeStrategies[typeEntity.TypeName];

            // Load product
            var product = TypeConstructors[typeEntity.TypeName]();

            product.Id       = typeEntity.Id;
            product.Name     = typeEntity.Name;
            product.State    = (ProductState)typeEntity.CurrentVersion.State;
            product.Identity = new ProductIdentity(typeEntity.Identifier, typeEntity.Revision);
            strategy.LoadType(typeEntity.CurrentVersion, product);

            // Don't load parts and parent for partial view
            if (full)
            {
                LoadParts(uow, typeEntity, product, loadedProducts);
            }

            // Assign instance to dictionary of loaded products
            loadedProducts[typeEntity.Id] = product;

            return(product);
        }
Example #18
0
 /// <inheritdoc />
 public IProductType TransformType(IUnitOfWork context, ProductTypeEntity typeEntity, bool full)
 {
     return(Transform(context, typeEntity, full));
 }
        private void SeedData(AppDbContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.Migrate();

            #region Create some product types

            var cabinet = new ProductTypeEntity
            {
                Id     = Guid.NewGuid(),
                Name   = "Cabinet",
                Slug   = "cabinet",
                Status = Domain.ProductTypes.ProductTypeStatus.Published
            };

            var backsplash = new ProductTypeEntity
            {
                Id     = Guid.NewGuid(),
                Name   = "Backsplash",
                Slug   = "backsplash",
                Status = Domain.ProductTypes.ProductTypeStatus.Published
            };

            #endregion

            #region Create some product categories

            var wallCabinet = new ProductCategoryEntity
            {
                Id          = Guid.NewGuid(),
                Name        = "Wall Cabinet",
                Slug        = "wall-cabinet",
                Status      = Domain.ProductCategories.ProductCategoryStatus.Published,
                ProductType = cabinet
            };

            var vanityCabinet = new ProductCategoryEntity
            {
                Id          = Guid.NewGuid(),
                Name        = "Vanity Cabinet",
                Slug        = "vanity-cabinet",
                Status      = Domain.ProductCategories.ProductCategoryStatus.Published,
                ProductType = cabinet
            };

            var wallTileBacksplash = new ProductCategoryEntity
            {
                Id          = Guid.NewGuid(),
                Name        = "Wall Tile Backsplash",
                Slug        = "wall-tile-backsplash",
                Status      = Domain.ProductCategories.ProductCategoryStatus.Published,
                ProductType = backsplash
            };

            #endregion

            #region Create some products

            var bengalStoneWallTileBacksplash = new ProductEntity
            {
                Id              = Guid.NewGuid(),
                Name            = "Bengal Stone Wall Tile Backsplash",
                Slug            = "bengal-stone-wall-tile-backsplash",
                Status          = Domain.Products.ProductStatus.Published,
                ProductCategory = wallTileBacksplash,
                ProductImages   = new List <ProductImageEntity>
                {
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "bengal-1",
                        IsThumbnail = true,
                        Ordinal     = 1
                    }
                },
                ProductSpecifications = new List <ProductSpecificationEntity>
                {
                    new ProductSpecificationEntity
                    {
                        Value = "bengal-specification-1",
                        Price = 23.4
                    },
                    new ProductSpecificationEntity
                    {
                        Value           = "bengal-specification-2",
                        Price           = 40,
                        DiscountedPrice = 30
                    },
                    new ProductSpecificationEntity
                    {
                        Value           = "bengal-specification-3",
                        Price           = 20,
                        DiscountedPrice = 12.5
                    }
                }
            };

            var metroCarreraWallTileBacksplash = new ProductEntity
            {
                Id              = Guid.NewGuid(),
                Name            = "Metro Carrera Wall Tile Backsplash",
                Slug            = "metro-carrera-wall-tile-backsplash",
                Status          = Domain.Products.ProductStatus.Published,
                ProductCategory = wallTileBacksplash,
                ProductImages   = new List <ProductImageEntity>
                {
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "carrera-1",
                        IsThumbnail = true,
                        Ordinal     = 1
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "carrera-2",
                        IsThumbnail = false,
                        Ordinal     = 2
                    }
                },
                ProductSpecifications = new List <ProductSpecificationEntity>
                {
                    new ProductSpecificationEntity
                    {
                        Value = "carrera-specification-1",
                        Price = 23
                    },
                    new ProductSpecificationEntity
                    {
                        Value           = "carrera-specification-2",
                        Price           = 20,
                        DiscountedPrice = 10
                    }
                }
            };

            var cabinetChoices = new ProductEntity
            {
                Id              = Guid.NewGuid(),
                Name            = "Cabinet Choices",
                Slug            = "cabinet-choices",
                Status          = Domain.Products.ProductStatus.Published,
                ProductCategory = wallCabinet,
                ProductImages   = new List <ProductImageEntity>
                {
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-1",
                        IsThumbnail = false,
                        Ordinal     = 1
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-2",
                        IsThumbnail = true,
                        Ordinal     = 2
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-3",
                        IsThumbnail = false,
                        Ordinal     = 3
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-4",
                        IsThumbnail = false,
                        Ordinal     = 4
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-5",
                        IsThumbnail = false,
                        Ordinal     = 5
                    },
                    new ProductImageEntity
                    {
                        Id          = Guid.NewGuid(),
                        Url         = "cabinet-choice-6",
                        IsThumbnail = false,
                        Ordinal     = 6
                    }
                }
            };

            #endregion

            context.ProductTypes.Add(cabinet);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.ProductTypes.ProductType",
                SequenceNumber = 1,
                EventType      = "Domain.ProductTypes.Events.ProductTypeCreated",
                EntityId       = cabinet.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.ProductTypes.Add(backsplash);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.ProductTypes.ProductType",
                SequenceNumber = 2,
                EventType      = "Domain.ProductTypes.Events.ProductTypeCreated",
                EntityId       = backsplash.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.ProductCategories.Add(wallCabinet);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.ProductCategories.ProductCategory",
                SequenceNumber = 1,
                EventType      = "Domain.ProductCategories.Events.ProductCategoryCreated",
                EntityId       = wallCabinet.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.ProductCategories.Add(vanityCabinet);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.ProductCategories.ProductCategory",
                SequenceNumber = 2,
                EventType      = "Domain.ProductCategories.Events.ProductCategoryCreated",
                EntityId       = vanityCabinet.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.ProductCategories.Add(wallTileBacksplash);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.ProductCategories.ProductCategory",
                SequenceNumber = 3,
                EventType      = "Domain.ProductCategories.Events.ProductCategoryCreated",
                EntityId       = wallTileBacksplash.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.Products.Add(bengalStoneWallTileBacksplash);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.Products.Product",
                SequenceNumber = 1,
                EventType      = "Domain.Products.Events.ProductCreated",
                EntityId       = bengalStoneWallTileBacksplash.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.Products.Add(metroCarreraWallTileBacksplash);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.Products.Product",
                SequenceNumber = 2,
                EventType      = "Domain.Products.Events.ProductCreated",
                EntityId       = metroCarreraWallTileBacksplash.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.Products.Add(cabinetChoices);
            context.DomainEvents.Add(new DomainEventEntity
            {
                AggregateType  = "Domain.Products.Product",
                SequenceNumber = 3,
                EventType      = "Domain.Products.Events.ProductCreated",
                EntityId       = cabinetChoices.Id,
                TimeStamp      = DateTime.UtcNow
            });

            context.SaveChanges();
        }
 public int UpdateProductType(ProductTypeEntity entity)
 {
     CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("UpdateProductType");
     command.SetParameterValue("@SysNo", entity.SysNo);
     command.SetParameterValue("@ParentSysNo", entity.ParentSysNo);
     command.SetParameterValue("@ProductTypeName", entity.ProductTypeName);
     command.SetParameterValue("@Order", entity.Order);
     command.SetParameterValue("@Status", entity.Status);
     command.SetParameterValue("@InUser", entity.InUser);
     command.SetParameterValue("@InDate", entity.InDate);
     return command.ExecuteNonQuery();
 }
 public ProductTypeEntity ByProductTypeNameGetInfo(ProductTypeEntity entity)
 {
     return ObjectFactory<IProductTypeDataAccess>.Instance.ByProductTypeNameGetInfo(entity);
 }
Example #22
0
 /// <summary>
 /// Find the link for this property name
 /// </summary>
 private static PartLink FindLink(string propertyName, ProductTypeEntity typeEntity)
 {
     return(typeEntity.Parts.FirstOrDefault(p => p.PropertyName == propertyName));
 }
 public static int InsertProductType(ProductTypeEntity entity)
 {
     return RestClient.Post<int>("ProductTypeService/InsertProductType", entity);
 }
Example #24
0
 public List <ProductStockEntity> getProductStock(ProductTypeEntity type)
 {
     return(productService.getStocks(type));
 }
Example #25
0
 public static ProductTypeDto ToProductTypeDto(this ProductTypeEntity request) => new ProductTypeDto
 {
     ProductTypeCode = request.ProductTypeCode,
     ProductTypeName = request.ProductTypeName
 };
 public static int UpdateProductType(ProductTypeEntity entity)
 {
     return RestClient.Post<int>("ProductTypeService/UpdateProductType", entity);
 }
Example #27
0
        public bool SaveProduct(Models.Publisher.CreateProductModel _createModel, string UserIdentity, Models.Core.FileUpload fileUpload)
        {
            //Creamos los repositorios
            SiteRepository        siteRepository        = new SiteRepository();
            AspNetUserRepository  aspNetUserRepository  = new AspNetUserRepository();
            ProductTypeRepository productTypeRepository = new ProductTypeRepository();
            PartnerRepository     partnerRepository     = new PartnerRepository();
            ProductRepository     productRepository     = new ProductRepository();

            //Obtenemos los conjuntos
            List <SiteEntity>        sites        = siteRepository.GetAll().ToList();
            List <AspNetUserEntity>  users        = aspNetUserRepository.GetAll().ToList();
            List <ProductTypeEntity> productstype = productTypeRepository.GetAll().ToList();
            List <PartnerEntity>     partners     = partnerRepository.GetAll().ToList();

            //Obtenemos las entidades deseadas.
            SiteEntity site = (from s in sites
                               where s.IdSite == _createModel.SiteTypeSelecc
                               select s).FirstOrDefault();
            AspNetUserEntity user = (from u in users
                                     where u.Id == UserIdentity
                                     select u).FirstOrDefault();

            ProductTypeEntity productType = (from pr in productstype
                                             where pr.IdProductType == _createModel.ProductTypeSelect
                                             select pr).FirstOrDefault();
            PartnerEntity partner = (from p in partners
                                     where p.IdPartner == _createModel.ParterTypeSelect
                                     select p).FirstOrDefault();

            ProductEntity product = new ProductEntity
            {
                //AspNetUser = user,
                AspNetUsers_Id             = UserIdentity,
                IdProduct                  = Guid.NewGuid(),
                Price                      = _createModel.PriceSelecc,
                ShortDescription           = _createModel.Name,
                FullDescription            = string.Empty,
                StartTime                  = Helpers.DateTimeHelper.GetCurrentDateString(),
                EndTime                    = Helpers.DateTimeHelper.GetCurrentDateString(0, 30),
                RegistrationDate           = DateTime.Now,
                SITE_IdSite                = site.IdSite,
                PRODUCT_TYPE_IdProductType = productType.IdProductType,
                PARTNER_IdPartner          = partner.IdPartner,
                Image                      = string.Empty,
                IsActive                   = true,
                IsPremium                  = _createModel.IsPremium
            };

            if (fileUpload != null)
            {
                product.Image = Helpers.AzureStorageHelper.CreateBlobImageFile(fileUpload.FileData, fileUpload.Filextension);
            }
            else
            {
                product.Image = Helpers.AzureStorageHelper.CreateBlobImageFile(getImageFromUrl(""), ".png");
            }


            productRepository.Add(product);

            if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_SUBSCRIBERS)) ||
                _createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_PUSH_CREW)) ||
                _createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_PUSH_ENGAGE)))
            {
                AddProductSettingEntity(product, "pushApiToken", _createModel.Token);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_MAIL_CHIMP)))
            {
                AddProductSettingEntity(product, "mailChimpApiToken", _createModel.Token);
                AddProductSettingEntity(product, "mailChimpList", _createModel.ListMCSelecc);
                AddProductSettingEntity(product, "mailChimpTemplate", Convert.ToString(_createModel.TemplateMCSelecc));
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_CAMPAIGN_MONITOR)))
            {
                AddProductSettingEntity(product, "campaignMonitorApiToken", _createModel.Token);
                AddProductSettingEntity(product, "campaignMonitorList", _createModel.ListCMSelecc);
                AddProductSettingEntity(product, "campaignMonitorClient", Convert.ToString(_createModel.ClientCMSelecc));
                AddProductSettingEntity(product, "campaignMonitorSegment", Convert.ToString(_createModel.SegmentCMSelecc));
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_AWEBER)))
            {
                AddProductSettingEntity(product, "aweberApiToken", _createModel.Token);
                AddProductSettingEntity(product, "aweberList", _createModel.ListAWSelecc);
                AddProductSettingEntity(product, "aweberApplicationKey", _createModel.providerAWeberApiResult.ApplicationKey);
                AddProductSettingEntity(product, "aweberApplicationSecret", _createModel.providerAWeberApiResult.ApplicationSecret);
                AddProductSettingEntity(product, "aweberOAuthToken", _createModel.providerAWeberApiResult.OAuthToken);
                AddProductSettingEntity(product, "aweberOAuthTokenSecret", _createModel.providerAWeberApiResult.OAuthTokenSecret);
                AddProductSettingEntity(product, "aweberOauthVerifier", _createModel.providerAWeberApiResult.OauthVerifier);
                AddProductSettingEntity(product, "aweberCallbackURL", _createModel.providerAWeberApiResult.CallbackURL);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_SEND_GRID)))
            {
                AddProductSettingEntity(product, "sendGridApiToken", _createModel.Token);
                AddProductSettingEntity(product, "sendGridList", _createModel.ListSGSelecc);
                AddProductSettingEntity(product, "sendGridSender", _createModel.SenderSGSelecc);
                AddProductSettingEntity(product, "sendGridUnsubscribeGroup", _createModel.UnsubscribeGroupSGSelecc);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_ACTIVE_CAMPAIGN)))
            {
                AddProductSettingEntity(product, "activeCampaignApiToken", _createModel.Token);
                AddProductSettingEntity(product, "activeCampaignList", _createModel.ListACSelecc);
                AddProductSettingEntity(product, "activeCampaignUrl", _createModel.URLACSelecc);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_GETRESPONSE)))
            {
                AddProductSettingEntity(product, "getResponseApiToken", _createModel.Token);
                AddProductSettingEntity(product, "getResponseList", _createModel.ListGRSelecc);
                AddProductSettingEntity(product, "getResponseFromField", _createModel.FromFieldGRSelecc);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_ICONTACT)))
            {
                // Crear campaign y guardar el Id
                string IdCampaign = string.Empty;

                AddProductSettingEntity(product, "icontactIdCampaign", _createModel.IContact.IdCampaign);
                AddProductSettingEntity(product, "icontactApiAppId", _createModel.IContact.ApiAppId);
                AddProductSettingEntity(product, "icontactUserName", _createModel.IContact.ApiUserName);
                AddProductSettingEntity(product, "icontactUserPassword", _createModel.IContact.ApiUserPassword);
                AddProductSettingEntity(product, "icontactAccountId", _createModel.IContact.AccountId);
                AddProductSettingEntity(product, "icontactClientFolderId", _createModel.IContact.ClientFolderId);
                AddProductSettingEntity(product, "icontactIdList", _createModel.IContact.ListId);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_SENDINBLUE)))
            {
                //Store product settings
                AddProductSettingEntity(product, "sendinBlueApiKey", _createModel.Token);
                AddProductSettingEntity(product, "sendinBlueCategory", _createModel.SendinBlue.Category);
                AddProductSettingEntity(product, "sendinBlueFromEmail", _createModel.SendinBlue.FromEmail);
                AddProductSettingEntity(product, "sendinBlueListId", _createModel.SendinBlue.ListIds[0].ToString());
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_ONE_SIGNAL)))
            {
                AddProductSettingEntity(product, "oneSignalApiKey", _createModel.Token);
                AddProductSettingEntity(product, "oneSignalAppId", _createModel.ListAppOSSelecc);
                AddProductSettingEntity(product, "oneSignalAppKey", _createModel.AuthAppOSSelecc);
            }
            else if (_createModel.ParterTypeSelect.Equals(new Guid(Utils.Constants.PROVIDER_MAILJET)))
            {
                AddProductSettingEntity(product, "mailJetApiKey", _createModel.Token);
                AddProductSettingEntity(product, "mailJetList", _createModel.ListMJSelecc);
                AddProductSettingEntity(product, "mailJetSegment", _createModel.SegmentMJSelecc);
                AddProductSettingEntity(product, "mailJetSecretKey", _createModel.SecretKeyMJ);
            }

            return(true);
        }
 public int UpdateProductType(ProductTypeEntity entity)
 {
     return ObjectFactory<IProductTypeDataAccess>.Instance.UpdateProductType(entity);
 }
 public static ProductTypeEntity ByProductTypeNameGetInfo(ProductTypeEntity entity)
 {
     return RestClient.Post<ProductTypeEntity>("ProductTypeService/ByProductTypeNameGetInfo", entity);
 }
Example #30
0
 public List <ProductStockEntity> getProductStock(ProductTypeEntity type)
 {
     throw new NotImplementedException();
 }
Example #31
0
 /// <summary>
 /// Find all links for this product name
 /// </summary>
 private static IEnumerable <PartLink> FindLinks(string propertyName, ProductTypeEntity typeEntity)
 {
     return(typeEntity.Parts.Where(p => p.PropertyName == propertyName));
 }
 public ProductTypeWindow(ProductTypeEntity aProductTypeEntity)
 {
     InitializeComponent();
     this.DataContext = new ProductTypeWindowViewModel(this, aProductTypeEntity);
 }