public ActionResult AddPropertiesForMaterial(int materialId, int sourceMaterialId, int sourceId, int subgroupId, List <PropertyFilter> properties)
        {
            bool success = _materialBinder.AddMaterialToMaterialNamesList(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow);

            if (success)
            {
                foreach (var propertyClient in properties)
                {
                    Comparison comparison = _basicBinder.GetComparison();

                    ElsevierMaterials.Models.Domain.Comparison.Property propertyComparison = _binder.GetProperty(propertyClient, comparison);

                    if (propertyComparison != null)
                    {
                        _materialBinder.ChangePropertyData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, ref propertyComparison);
                    }
                    else
                    {
                        _binder.AddProperty(materialId, sourceMaterialId, sourceId, subgroupId, propertyClient, ref propertyComparison, materialContextUow);
                        _binder.AddMaterial(materialId, sourceMaterialId, sourceId, subgroupId, propertyClient, propertyComparison, materialContextUow);
                    }
                }
            }

            return(Json(ResponseStatus.Success, new { success = success }, JsonRequestBehavior.AllowGet));
        }
        public ElsevierMaterials.Models.Domain.Comparison.Property GetProperty(PropertyFilter propertyClient, ElsevierMaterials.Models.Domain.Comparison.Comparison comparison)
        {
            ElsevierMaterials.Models.Domain.Comparison.Property propertyComparison = null;

            if (propertyClient.TypeId == 0 && propertyClient.SourceTypeId > 0)
            {
                propertyComparison = comparison.Properties.Where(m => m.PropertyInfo.SourceTypeId == propertyClient.SourceTypeId).FirstOrDefault();
            }
            else if (propertyClient.TypeId > 0)
            {
                propertyComparison = comparison.Properties.Where(m => m.PropertyInfo.TypeId == propertyClient.TypeId).FirstOrDefault();
            }
            else
            {
                propertyComparison = comparison.Properties.Where(m => m.PropertyInfo.RowId == propertyClient.RowId && m.PropertyInfo.ConditionId == propertyClient.ConditionId && m.PropertyInfo.GroupId == propertyClient.GroupId).FirstOrDefault();
            }
            return(propertyComparison);
        }
        public void AddProperties(int materialId, int sourceMaterialId, int sourceId, int subgroupId, List <PropertyFilter> properties, IMaterialsContextUow materialContextUow)
        {
            foreach (var propertyClient in properties)
            {
                ElsevierMaterials.Models.Domain.Comparison.Comparison comparison         = GetComparison();
                ElsevierMaterials.Models.Domain.Comparison.Property   propertyComparison = GetProperty(propertyClient, comparison);

                if (propertyComparison != null)
                {
                    _materialBinder.ChangePropertyData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, ref propertyComparison);
                }
                else
                {
                    ElsevierMaterials.Models.Condition condition = _conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient);
                    propertyComparison = _propertyBinder.FillPropertyData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition);
                    comparison.Properties.Add(propertyComparison);

                    ElsevierMaterials.Models.Domain.Comparison.Material material = _materialBinder.FillMaterialData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, propertyComparison, null);
                    propertyComparison.Materials.Add(material);
                }
            }
        }
 public void AddProperty(int materialId, int sourceMaterialId, int sourceId, int subgroupId, PropertyFilter propertyClient, ref ElsevierMaterials.Models.Domain.Comparison.Property propertyComparison, IMaterialsContextUow materialContextUow)
 {
     ElsevierMaterials.Models.Condition condition = _conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient);
     propertyComparison = _propertyBinder.FillPropertyData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition);
     ElsevierMaterials.Models.Domain.Comparison.Comparison comparison = GetComparison();
     comparison.Properties.Add(propertyComparison);
 }
 public void AddMaterial(int materialId, int sourceMaterialId, int sourceId, int subgroupId, PropertyFilter propertyClient, ElsevierMaterials.Models.Domain.Comparison.Property propertyComparison, IMaterialsContextUow materialContextUow)
 {
     ElsevierMaterials.Models.Domain.Comparison.Material material = _materialBinder.FillMaterialData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, propertyComparison, null);
     propertyComparison.Materials.Add(material);
 }