public IDictionary <int, int> TreeCount(IList <int> results, IMaterialsContextUow context) { IDictionary <int, int> records = new Dictionary <int, int>(); var treeCounts = context.TreeCounts.AllAsNoTracking.Where(t => results.Contains(t.Id)); var types = treeCounts.Where(t => t.TypeId != null).GroupBy(t => t.TypeId).Select(t => new { Id = t.Key, Num = t.Sum(s => s.TypeCount) }); var classes = treeCounts.Where(t => t.ClassId != null).GroupBy(t => t.ClassId).Select(t => new { Id = t.Key, Num = t.Sum(s => s.ClassCount) }); var subClasses = treeCounts.Where(t => t.SubClassId != null).GroupBy(t => t.SubClassId).Select(t => new { Id = t.Key, Num = t.Sum(s => s.SubClassCount) }); var groups = treeCounts.Where(t => t.GroupId != null).GroupBy(t => t.GroupId).Select(t => new { Id = t.Key, Num = t.Sum(s => s.GroupCount) }); foreach (var item in types) { records.Add((int)item.Id, item.Num); } foreach (var item in classes) { records.Add((int)item.Id, item.Num); } foreach (var item in subClasses) { records.Add((int)item.Id, item.Num); } foreach (var item in groups) { records.Add((int)item.Id, item.Num); } return(records); }
public ICollection <Material> GetAllEquivalentMaterialsEn(int id, IMaterialsContextUow context) { FullTextSearch cl = context.FullTextSearch.GetMaterialById(id); string sessionId = System.Web.HttpContext.Current.Session["TotalMateriaSession"].ToString(); ICollection <Material> tmp = context.Materials.GetMaterialByEquivalence(id, cl, sessionId); return(tmp); }
//TODO: Ova metoda moze bolje da se napise! public string GetPropertyValue(int materialId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient) { PropertyWithConvertedValues prop = context.PropertiesWithConvertedValues.All.Where(m => m.MaterialId == materialId && m.SubgroupId == subgroupId && m.GroupId == propertyClient.GroupId && m.RowId == propertyClient.ConditionId && m.PropertyId == propertyClient.TypeId).FirstOrDefault(); string value = ""; string unit = ""; string note = ""; string text = ""; FillValueForPropertyUnitType(prop.ConvValue, prop.ConvValueMin, prop.ConvValueMax, prop.OrigValueText, text, prop.Temperature, prop.DefaultUnit, out value, out note, out unit); return(value); }
public ConditionModel FillElsCondition(int materialId, int subgroupId, IMaterialsContextUow context, RecordLink conditionObj, MaterialProperty prop, int type) { ConditionModel condition = new ConditionModel(); condition.ConditionId = (int)conditionObj.RowID; condition.Properties = new List <Property>(); condition.ConditionName = FillElsConditionName(conditionObj); string unitName = prop.OrigUnit == null ? "" : context.Units.Find(n => n.UnitId == prop.OrigUnit).UnitText; ElsevierMaterials.Models.Property property = context.PropertiesWithConvertedValues.GetPropertyInfoForMaterialForSelectedMetric(context.PreferredNames.Find(o => o.PN_ID == prop.PropertyId).PN, materialId, subgroupId, conditionObj.RowID, prop.PropertyId, prop.ValueId, type, unitName); condition.Properties.Add(property); return(condition); }
public double GetPropertyTemperature(int materialId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient) { MaterialProperty propCond = context.MaterialProperties.All.Where(m => m.MaterialId == materialId && m.SubgroupId == subgroupId && m.RowId == propertyClient.ConditionId && m.PropertyId == propertyClient.TypeId && m.ValueId == propertyClient.RowId).FirstOrDefault(); if (propCond.Temperature != null) { return((double)propCond.Temperature); } else { return(20); } }
public PropertyBasicInfo FillPropertyBasicData(IMaterialsContextUow context, PropertyFilter propertyClient, PropertyBasicInfo property) { if (property == null) { property = new PropertyBasicInfo(); } property.TypeId = propertyClient.TypeId; property.SourceTypeId = propertyClient.SourceTypeId; property.GroupId = propertyClient.GroupId; property.RowId = propertyClient.RowId; property.ConditionId = propertyClient.ConditionId; property.Group = context.PreferredNames.Find(p => p.PN_ID == propertyClient.GroupId).PN; return(property); }
public void FillElsMaterial(int materialId, int subgroupId, int sourceMaterialId, IMaterialsContextUow context, MaterialDetailsModel model, int type) { int setId = (int)context.RecordLinks.All.Where(m => m.MaterialID == materialId && m.SubgroupID == subgroupId).FirstOrDefault().SetID; IList <RecordLink> conditions = context.RecordLinks.All.Where(n => n.MaterialID == materialId && n.SubgroupID == subgroupId).ToList(); IDictionary <ProductGroup.ProductGroupType, ProductGroup> listOfGroups = new Dictionary <ProductGroup.ProductGroupType, ProductGroup>(); IList <ConditionModel> conditionWithProperties = new List <ConditionModel>(); foreach (var conditionObj in conditions) { IList <MaterialProperty> propertiesPerCond = context.MaterialProperties.All.Where(m => m.MaterialId == materialId && m.SubgroupId == subgroupId && m.RowId == conditionObj.RowID).ToList(); foreach (var prop in propertiesPerCond) { ProductGroup.ProductGroupType groupId = (ProductGroup.ProductGroupType)context.Trees.Find(n => n.PN_ID == prop.PropertyId).BT_ID; if (!listOfGroups.ContainsKey(groupId)) { conditionWithProperties = new List <ConditionModel>(); ConditionModel condition = new ConditionElsBinder().FillElsCondition(materialId, subgroupId, context, conditionObj, prop, type); conditionWithProperties.Add(condition); ProductGroup productGroup = FillElsProductGroup(conditionWithProperties, groupId, context); productGroup.MaterialConditions = productGroup.MaterialConditions.OrderBy(c => c.ConditionName).ToList(); listOfGroups.Add(groupId, productGroup); } else { ProductGroup selectedGroup = listOfGroups[groupId]; if (!selectedGroup.MaterialConditions.Any(v => v.ConditionId == conditionObj.RowID)) { ConditionModel condition = new ConditionElsBinder().FillElsCondition(materialId, subgroupId, context, conditionObj, prop, type); selectedGroup.MaterialConditions.Add(condition); } else { ConditionModel condition = selectedGroup.MaterialConditions.Where(v => v.ConditionId == conditionObj.RowID).FirstOrDefault(); string unitName = prop.OrigUnit == null ? "" : context.Units.Find(n => n.UnitId == prop.OrigUnit).UnitText; ElsevierMaterials.Models.Property property = context.PropertiesWithConvertedValues.GetPropertyInfoForMaterialForSelectedMetric(context.PreferredNames.Find(o => o.PN_ID == prop.PropertyId).PN, materialId, subgroupId, conditionObj.RowID, prop.PropertyId, prop.ValueId, type, unitName); condition.Properties.Add(property); } } listOfGroups[groupId].PropertyCount++; } } model.Properties = new PropertiesModel(); OrderPropertiesGroups(model, listOfGroups); }
public IList <ConditionModel> GetGroupMaterialConditions(int materialId, int subgroupId, int groupId, IMaterialsContextUow context) { IList <ConditionModel> conditionsList = new List <ConditionModel>(); IList <GroupMaterialCondition> conditions = context.GroupMaterialConditions.AllAsNoTracking.Where(n => n.MaterialID == materialId && n.SubgroupID == subgroupId && n.GroupId == groupId).ToList(); foreach (var record in conditions) { ConditionModel materialCondition = new ConditionModel(); materialCondition.ProductGroupId = (ProductGroup.ProductGroupType)groupId; materialCondition.Properties = new List <ElsevierMaterials.Models.Property>(); materialCondition.ConditionId = record.ConditionId; materialCondition.ProductFormId = record.ProductFormId; materialCondition.ConditionIdProductFormId = record.ConditionId + ";" + record.ProductFormId; materialCondition.ConditionName = ""; materialCondition.MaterialDescription = record.MaterialDescription; materialCondition.Thickness = record.Thickness; if (record.Condition != null && record.Condition != "") { materialCondition.ConditionName = record.Condition; } if (record.ProductForm != null && record.ProductForm != "") { materialCondition.ConditionName = materialCondition.ConditionName + ((materialCondition.ConditionName != "") ? "; " + record.ProductForm : record.ProductForm); } if (record.Thickness != null && record.Thickness != "") { materialCondition.ConditionName = materialCondition.ConditionName + ((materialCondition.ConditionName != "") ? "; " + record.Thickness : record.Thickness); } if (record.MaterialDescription != null && record.MaterialDescription != "") { materialCondition.ConditionName = materialCondition.ConditionName + ((materialCondition.ConditionName != "") ? "; " + record.MaterialDescription : record.MaterialDescription); } if (record.Phase != null && record.Phase != "") { materialCondition.ConditionName = materialCondition.ConditionName + ((materialCondition.ConditionName != "") ? "; " + record.Phase : record.Phase); } if (materialCondition.ConditionName == null || materialCondition.ConditionName == "") { materialCondition.ConditionName = "All"; } materialCondition.ConditionName = materialCondition.ConditionName.TrimStart(';').TrimStart(); conditionsList.Add(materialCondition); } conditionsList = conditionsList.OrderBy(c => c.ConditionName).ToList(); return(conditionsList); }
public string GetPropertiesForExport(int sourceMaterialId, int sourceId, int subgroupId, List <PropertyFilter> properties, ElsevierMaterials.Models.Domain.Export.Exporter exporter, out List <PropertyFilter> propertiesForExport, IMaterialsContextUow materialContextUow) { propertiesForExport = new List <PropertyFilter>(); PropertyBinder propertyBinder = new PropertyBinder(); ConditionBinder conditionBinder = new ConditionBinder(); string message = ""; string propertes1 = ""; string propertes2 = ""; string ulOpen = "<ul>"; string ulClose = "</ul>"; string title1 = "The following properties are added to export: "; string title2 = "The following properties cannot be exported: "; foreach (var addedProperty in properties) { ElsevierMaterials.Models.Condition condition = conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty); int notMappedPropertyId = addedProperty.SourceTypeId != 0 ? addedProperty.SourceTypeId : addedProperty.TypeId; TMPropertyTypeEnum propertyId = MapElsPropertyId(notMappedPropertyId, (SourceTypeEnum)sourceId); if (!exporter.Properties.Contains(propertyId)) { if (propertes2 == "") { propertes2 = propertes2 + ulOpen; } propertes2 = propertes2 + "<li>" + propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty, condition) + "</li>"; } else { propertiesForExport.Add(addedProperty); if (propertes1 == "") { propertes1 = propertes1 + ulOpen; } propertes1 = propertes1 + "<li>" + propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty, condition) + "</li>"; } } if (propertes1 != "" && propertes2 != "") { message = title1 + propertes1 + ulClose + "<br/>" + title2 + propertes2 + ulClose; } else if (propertes1 != "") { message = title1 + propertes1 + ulClose; } else if (propertes2 != "") { message = title2 + propertes2 + ulClose; } return(message); }
public string FillPropertyValue(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, Condition condition) { string value = ""; switch (sourceId) { case 1: value = _propertyElsBinder.GetPropertyValue(materialId, subgroupId, context, propertyClient); break; case 2: value = _propertyTMMetalsBinder.GetPropertyValue(propertyClient, condition); break; case 3: value = _propertyTMPlusBinder.GetPropertyValue(propertyClient, condition); break; default: break; } //TODO: formatiranje vrednosti izbaciti u utillity klasu if (value.Contains("<hr")) { value = value.Split(new string[] { "<hr" }, StringSplitOptions.None)[0]; } if (value.Contains("≥")) { value = value.Replace("≥", ""); } if (value.Contains("≤")) { value = value.Replace("≤", ""); } if (value.Contains("-") && !value.Contains("E")) { if (value.Split('-')[0] != "") { value = value.Split('-')[0]; } } return(value); }
public ElsevierMaterials.Models.Domain.Export.Property AddProperty(int sourceMaterialId, int sourceId, int subgroupId, ElsevierMaterials.Models.Domain.Export.Material material, ElsevierMaterials.Models.Domain.Export.Property property, IMaterialsContextUow materialContextUow, PropertyFilter propertyClient, ElsevierMaterials.Models.Condition condition) { if (property == null) { property = new ElsevierMaterials.Models.Domain.Export.Property(); PropertyBasicInfo propertyInfo = _propertyBinder.FillPropertyBasicData(materialContextUow, propertyClient, null); property.ElsBasicInfo = propertyInfo; property.ElsBasicInfo.Name = _propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition); property.ElsBasicInfo.Unit = _propertyBinder.FillPropertyUnit(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition); material.Properties.Add(property); } property.Value = _propertyBinder.FillPropertyValue(material.MaterialInfo.MaterialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition); property.Temperature = _propertyBinder.FillPropertyTemperature(material.MaterialInfo.MaterialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition); return(property); }
public IList <ConditionModel> GetGroupTestConditions(int materialId, int subgroupId, int groupId, int conditionId, int productFormId, string materialDescription, string thickness, IMaterialsContextUow context) { IList <ConditionModel> conditionsList = new List <ConditionModel>(); var conditions = context.GroupTestConditions.AllAsNoTracking.Where(n => n.MaterialID == materialId && n.SubgroupID == subgroupId && n.GroupId == groupId && n.ConditionId == conditionId && n.ProductFormId == productFormId); IList <GroupTestCondition> testConditions = conditions.Where(m => m.MaterialDesc.Trim() == materialDescription.Trim() && m.Thickness.Trim() == thickness.Trim()).ToList(); foreach (var record in testConditions) { ConditionModel cm = GetDataForSlectedTestCondition(materialId, subgroupId, groupId, record.RowID, context); conditionsList.Add(cm); } conditionsList = conditionsList.OrderBy(c => c.ConditionName).ToList(); return(conditionsList); }
public Material AddMaterial(ElsevierMaterials.Models.Domain.Export.Exporter exporter, Material material, int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow materialContextUow) { if (material == null) { ElsevierMaterials.Models.Domain.Material.MaterialBasicInfo materialBasicInfo = _materialBinder.GetMaterialInfo(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow); material = new Material(); material.MaterialInfo.MaterialId = materialId; material.MaterialInfo.SourceMaterialId = sourceMaterialId; material.MaterialInfo.SourceId = sourceId; material.MaterialInfo.SubgroupId = subgroupId; material.MaterialInfo.Name = materialBasicInfo.Name; material.MaterialInfo.SubgroupName = materialBasicInfo.SubgroupName; if (exporter.Materials.Count > 0) { material.MaterialInfo.RowId = exporter.Materials.Max(m => m.MaterialInfo.RowId) + 1; } else { material.MaterialInfo.RowId = 1; } material.MaterialInfo.TypeId = materialBasicInfo.TypeId; material.MaterialInfo.TypeName = materialBasicInfo.TypeName; material.MaterialInfo.Standard = materialBasicInfo.Standard; exporter.Materials.Add(material); } return(material); }
public ElsevierMaterials.Models.Domain.Material.MaterialBasicInfo GetMaterialInfo(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context) { return(context.Materials.AllAsNoTracking.Where(s => s.MaterialId == materialId && s.SourceMaterialId == sourceMaterialId && s.SourceId == sourceId && s.SubgroupId == subgroupId).Select(m => new ElsevierMaterials.Models.Domain.Material.MaterialBasicInfo { MaterialId = m.MaterialId, Name = m.Name, SourceId = m.SourceId, SourceMaterialId = m.SourceMaterialId, Standard = m.Standard, SubgroupId = m.SubgroupId, SubgroupName = (m.SourceText == "-" ? "" : m.SourceText.Replace("<br>", " ").Replace("<br >", " ").Replace("<br />", " ").Replace("<br/>", " ") + "; ") + (m.Standard == "-" ? "" : m.Standard.Replace("<br>", " ").Replace("<br >", " ").Replace("<br />", " ").Replace("<br/>", " ") + "; ") + (m.Specification == "-" ? "" : m.Specification.Replace("<br>", " ").Replace("<br >", " ").Replace("<br />", " ").Replace("<br/>", " ")) }).FirstOrDefault()); }
public IList <ChemicalPropertyModel> GetChemicalPropertiesData(int materialId, int subgroupId, int groupId, IMaterialsContextUow context) { IList <ChemicalPropertyModel> model = new List <ChemicalPropertyModel>(); var prop = context.PropertiesWithConvertedValues.AllAsNoTracking.Where(m => m.MaterialId == materialId && m.SubgroupId == subgroupId).Select(m => new { m.GroupId, m.PropertyId, m.ConvValue, m.ConvValueMax, m.ConvValueMin, m.DefaultUnit, m.DefaultUnitId, m.OriginalUnit, m.OrigUnitId, m.OrigValue, m.OrigValueMax, m.OrigValueMin, m.UsUnit, m.Temperature, m.UsValue, m.UsValueMax, m.UsValueMin, m.ValueId, m.RowId }); ChemicalPropertyModel item = new ChemicalPropertyModel(); IList <GroupChemicalPropertyAll> groupChemicalProperties = context.GroupChemicalPropertyAll.AllAsNoTracking.Where(m => m.MaterialID == materialId && m.SubgroupID == subgroupId && m.GroupId == groupId).OrderBy(m => m.PropertyID).ThenBy(m => m.Phase).ThenBy(m => m.X_unit_lbl).ThenBy(m => m.Condition).ToList(); IList <string> temperatureReplace = new List <string>(); //IList<int> propIds=groupChemicalProperties.Select(p=>p.PropertyID).Distinct().ToList(); //IList<string> phasesList = groupChemicalProperties.Select(p => p.Phase).Distinct().ToList(); //var propNames= context.PreferredNames.AllAsNoTracking.Where(p=>propIds.Contains(p.PN_ID) ).Select(p=>new {Key=p.PN_ID, Value=p.PN}); var condModel = new ChemicalConditionModel(); string prevPhase = ""; string prevPropName = ""; foreach (GroupChemicalPropertyAll itemProp in groupChemicalProperties) { var propData = prop.Where(p => p.PropertyId == itemProp.PropertyID && p.RowId == itemProp.RowID && p.GroupId == itemProp.GroupId && p.ValueId == itemProp.ValueID).FirstOrDefault(); if ((prevPhase == "" || prevPropName == "") || (prevPhase != itemProp.Phase || prevPropName != itemProp.PropertyName)) { item = new ChemicalPropertyModel(); item.GroupId = itemProp.GroupId; item.PropertyId = itemProp.PropertyID; //item.PropertyName = propNames.Where(p => p.Key == itemProp.PropertyID).Select(p => p.Value).FirstOrDefault(); item.Phase = itemProp.Phase; item.PhaseId = itemProp.PhaseId; item.PropertyName = itemProp.PropertyName; item.PNameAndPhase = itemProp.PropertyName + ", " + itemProp.Phase; if (item.PNameAndPhase.Trim().EndsWith(",")) { item.PNameAndPhase = ElsevierMaterialsMVC.BL.Helpers.TransformFunctions.RemoveLast(item.PNameAndPhase.Trim(), ","); } prevPhase = itemProp.Phase; prevPropName = itemProp.PropertyName; item.ConditionList = new List <ChemicalConditionModel>(); temperatureReplace = new List <string>(); item.DiagramID = itemProp.DiagramID; condModel = SetChemicalConditionModel(itemProp, temperatureReplace, context); if (itemProp.DiagramID != null) { condModel.PropertyUnits = itemProp.Y_unit_lbl; condModel.USPropertyUnits = itemProp.Y_unit_lbl; condModel.DefaultPropertyUnits = itemProp.Y_unit_lbl; condModel.VariableUnits = itemProp.X_unit_lbl; condModel.DefaultVariableUnits = itemProp.X_unit_lbl; condModel.USVariableUnits = itemProp.X_unit_lbl; condModel.Notes = itemProp.cit_record_id != null ? "note" : ""; condModel.cit_record_id = itemProp.cit_record_id; if (condModel.TemperatureList == null) { condModel.TemperatureList = new List <ChemicalConditionPointModel>(); } var diagPoints = context.DiagramPoints.AllAsNoTracking.Where(p => p.DiagramID == itemProp.DiagramID).OrderBy(p => p.PointOrder); foreach (var point in diagPoints) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Origin }); condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Default }); condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Us }); } condModel.PropertyRange = itemProp.Y_range; condModel.VariableRange = itemProp.X_range; //condModel.VariableUnits = ""; if (condModel.TemperatureList != null && condModel.TemperatureList.Count > 1) { condModel.HasMultipleTemperatures = true; foreach (string s in temperatureReplace) { condModel.Name = condModel.Name.Replace(s, ""); } } } else { if (propData.OriginalUnit != null) { condModel.PropertyUnits = propData.OriginalUnit; } if (propData.UsUnit != null) { condModel.USPropertyUnits = propData.UsUnit; } if (propData.DefaultUnit != null) { condModel.DefaultPropertyUnits = propData.DefaultUnit; } if (itemProp.Temperature != null) { if (condModel.TemperatureList == null) { condModel.TemperatureList = new List <ChemicalConditionPointModel>(); } if (propData.OrigValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.OrigValue, type = ChemicalUnitValuesType.Origin }); } if (propData.ConvValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.ConvValue, type = ChemicalUnitValuesType.Default }); } if (propData.UsValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.UsValue, type = ChemicalUnitValuesType.Us }); } } condModel.PropertyRange = propData.OrigValue == null ? "" : ((double)(propData.OrigValue)).ToString("0.####"); condModel.DefaultPropertyRange = propData.ConvValue == null ? "" : ((double)propData.ConvValue).ToString("0.####"); condModel.USPropertyRange = propData.UsValue == null ? "" : ((double)propData.UsValue).ToString("0.####"); condModel.DefaultVariableUnits = "°C"; condModel.VariableUnits = ""; condModel.Notes = ""; } item.ConditionList.Add(condModel); model.Add(item); } else { ChemicalPropertyModel property = model.Where(m => m.PropertyId == itemProp.PropertyID && m.Phase == itemProp.Phase).FirstOrDefault(); if (!property.ConditionList.Where(c => c.RowId == itemProp.RowID).Any()) { condModel = SetChemicalConditionModel(itemProp, temperatureReplace, context); property.ConditionList.Add(condModel); } var condModelPrev = new ChemicalConditionModel(); var condModelNew = new ChemicalConditionModel(); var newCondition = false; condModelPrev = property.ConditionList.Where(c => c.RowId == itemProp.RowID).FirstOrDefault(); condModelNew = SetChemicalConditionModel(itemProp, temperatureReplace, context); if (condModelPrev.Name != condModelNew.Name) { newCondition = true; condModel = condModelNew; } else { condModel = condModelPrev; } if (itemProp.DiagramID != null) { condModel.PropertyUnits = itemProp.Y_unit_lbl; condModel.USPropertyUnits = itemProp.Y_unit_lbl; condModel.DefaultPropertyUnits = itemProp.Y_unit_lbl; condModel.VariableUnits = itemProp.X_unit_lbl; condModel.DefaultVariableUnits = itemProp.X_unit_lbl; condModel.USVariableUnits = itemProp.X_unit_lbl; condModel.Notes = itemProp.cit_record_id != null ? "note" : ""; condModel.cit_record_id = itemProp.cit_record_id; if (condModel.TemperatureList == null) { condModel.TemperatureList = new List <ChemicalConditionPointModel>(); } var diagPoints = context.DiagramPoints.AllAsNoTracking.Where(p => p.DiagramID == itemProp.DiagramID).OrderBy(p => p.PointOrder); foreach (var point in diagPoints) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Origin }); condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Default }); condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)point.X_value, Y = (double)point.Y_value, type = ChemicalUnitValuesType.Us }); } condModel.PropertyRange = itemProp.Y_range; condModel.VariableRange = itemProp.X_range; if (condModel.TemperatureList != null && condModel.TemperatureList.Count > 1) { condModel.HasMultipleTemperatures = true; foreach (string s in temperatureReplace) { condModel.Name = condModel.Name.Replace(s, ""); } } } else { if (propData.OriginalUnit != null) { condModel.PropertyUnits = propData.OriginalUnit; } if (propData.UsUnit != null) { condModel.USPropertyUnits = propData.UsUnit; } if (propData.DefaultUnit != null) { condModel.DefaultPropertyUnits = propData.DefaultUnit; } if (itemProp.Temperature != null) { if (condModel.TemperatureList == null) { condModel.TemperatureList = new List <ChemicalConditionPointModel>(); } if (propData.OrigValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.OrigValue, type = ChemicalUnitValuesType.Origin }); } if (propData.ConvValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.ConvValue, type = ChemicalUnitValuesType.Default }); } if (propData.UsValue != null) { condModel.TemperatureList.Add(new ChemicalConditionPointModel() { X = (double)itemProp.Temperature, Y = (double)propData.UsValue, type = ChemicalUnitValuesType.Us }); } } condModel.PropertyRange = propData.OrigValue == null ? "" : ((double)(propData.OrigValue)).ToString("0.####"); condModel.DefaultPropertyRange = propData.ConvValue == null ? "" : ((double)propData.ConvValue).ToString("0.####"); condModel.USPropertyRange = propData.UsValue == null ? "" : ((double)propData.UsValue).ToString("0.####"); condModel.DefaultVariableUnits = "°C"; condModel.VariableUnits = ""; condModel.Notes = ""; if (condModel.TemperatureList != null && condModel.TemperatureList.Count > 1) { condModel.HasMultipleTemperatures = true; foreach (string s in temperatureReplace) { condModel.Name = condModel.Name.Replace(s, ""); } } } if (newCondition) { item.ConditionList.Add(condModel); } } } double propMin = double.MaxValue; double propMax = double.MinValue; double valMin = double.MaxValue; double valMax = double.MinValue; for (int i = 0; i < model.Count; i++) { for (int j = 0; j < model[i].ConditionList.Count; j++) { if (model[i].ConditionList[j].Name == "") { model[i].ConditionList[j].Name = "As received"; } if (model[i].ConditionList[j].TemperatureList != null && (model[i].ConditionList[j].TemperatureList.Where(p => p.type == ChemicalUnitValuesType.Origin).Count()) > 1) { model[i].ConditionList[j].TemperatureList = model[i].ConditionList[j].TemperatureList.OrderBy(p => p.type).ThenBy(p => p.X).ThenBy(P => P.Y).ToList(); foreach (var k in model[i].ConditionList[j].TemperatureList.Where(p => p.type == ChemicalUnitValuesType.Origin)) { if (valMin > k.X) { valMin = k.X; } if (valMax < k.X) { valMax = k.X; } if (propMin > k.Y) { propMin = k.Y; } if (propMax < k.Y) { propMax = k.Y; } } if (model[i].DiagramID == null) { model[i].ConditionList[j].VariableRange = valMin.ToString("0.####") + " — " + valMax.ToString("0.####"); model[i].ConditionList[j].PropertyRange = propMin.ToString("0.####") + " — " + propMax.ToString("0.####"); } model[i].ConditionList[j].VariableUnits = model[i].ConditionList[j].VariableUnits != ""?model[i].ConditionList[j].VariableUnits:"°C"; model[i].ConditionList[j].PropertyUnits = model[i].ConditionList[j].PropertyUnits; propMin = double.MaxValue; propMax = double.MinValue; foreach (var k in model[i].ConditionList[j].TemperatureList.Where(p => p.type == ChemicalUnitValuesType.Default)) { if (propMin > k.Y) { propMin = k.Y; } if (propMax < k.Y) { propMax = k.Y; } } model[i].ConditionList[j].DefaultPropertyRange = propMin.ToString("0.####") + " — " + propMax.ToString("0.####"); propMin = double.MaxValue; propMax = double.MinValue; foreach (var k in model[i].ConditionList[j].TemperatureList.Where(p => p.type == ChemicalUnitValuesType.Us)) { if (propMin > k.Y) { propMin = k.Y; } if (propMax < k.Y) { propMax = k.Y; } } model[i].ConditionList[j].USPropertyRange = propMin.ToString("0.####") + " — " + propMax.ToString("0.####"); } } } return(model); }
public ElsevierController() { _materialContextUow = new MaterialsContextUow(); }
public string FillPropertyUnit(int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, Condition condition) { string unit = ""; EquivalentProperty eq = context.EquivalentProperties.AllAsNoTracking.Where(m => m.PropertyId == propertyClient.TypeId && m.SourceId == sourceId).FirstOrDefault(); switch (sourceId) { case 1: unit = FillMappedPropertyUnit(eq); break; case 2: if (eq != null) { unit = FillMappedPropertyUnit(eq); } else { ElsevierMaterials.Models.Property propertyTm = FillNotMappedProperty(propertyClient, condition); unit = propertyTm.OrigUnit; } break; case 3: if (eq != null) { unit = FillMappedPropertyUnit(eq); } else if (propertyClient.TypeId == 0 || eq == null) { ElsevierMaterials.Models.Property propertyTm = FillNotMappedProperty(propertyClient, condition); if (propertyTm != null) { unit = propertyTm.OrigUnit; } } else { unit = ""; } break; default: unit = ""; break; } return(unit.Replace("<sup>", "^").Replace("</sup>", "").Replace("<sub>", "").Replace("</sub>", "").Replace("°", "°")); }
public string FillPropertyName(int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, Condition condition) { string name = ""; EquivalentProperty eq = context.EquivalentProperties.AllAsNoTracking.Where(m => m.PropertyId == propertyClient.TypeId && m.SourceId == sourceId).FirstOrDefault(); //TODO: Source stavi u Enum: 1- els, 2-TMMetals, 3-TMPlus switch (sourceId) { case 1: name = FillMappedPropertyName(context, propertyClient); break; case 2: if (eq != null) { name = FillMappedPropertyName(context, propertyClient); } else { ElsevierMaterials.Models.Property propertyTm = FillNotMappedProperty(propertyClient, condition); name = propertyTm.PropertyName; } break; case 3: if (eq != null) { name = FillMappedPropertyName(context, propertyClient); } if (propertyClient.TypeId == 0 || eq == null) { ElsevierMaterials.Models.Property propertyTm = FillNotMappedProperty(propertyClient, condition); if (propertyTm != null) { name = propertyTm.PropertyName; } } break; default: break; } return(name); }
public string FillMappedPropertyName(IMaterialsContextUow context, PropertyFilter propertyClient) { //TODO: verovatno treba da je taxonomy id =2 i uradjen innerjoin sa proerties??? return(context.PreferredNames.Find(p => p.PN_ID == propertyClient.TypeId).PN); }
public double FillPropertyTemperature(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, Condition condition) { double temperature = 20; switch (sourceId) { case 1: temperature = _propertyElsBinder.GetPropertyTemperature(materialId, subgroupId, context, propertyClient); break; case 2: temperature = _propertyTMMetalsBinder.GetPropertyTemperature(propertyClient, condition); break; case 3: temperature = _propertyTMPlusBinder.GetPropertyTemperature(propertyClient, condition); break; default: break; } return(temperature); }
private ChemicalConditionModel SetChemicalConditionModel(GroupChemicalPropertyAll itemProp, IList <string> temperatureReplace, IMaterialsContextUow context) { ChemicalConditionModel condModel = new ChemicalConditionModel(); condModel.RowId = itemProp.RowID; condModel.ValueId = itemProp.ValueID; condModel.HasMultipleTemperatures = false; condModel.Name = ""; if (itemProp.Condition != null && itemProp.Condition != "") { condModel.Name = ElsevierMaterialsMVC.BL.Helpers.TransformFunctions.RemoveLast(itemProp.Condition, ";"); } return(condModel); }
public ProductGroup FillElsProductGroup(IList <ConditionModel> conditionWithProperties, ProductGroup.ProductGroupType groupId, IMaterialsContextUow context) { string nameP = context.PreferredNames.Find(p => p.PN_ID == (int)groupId).PN; ProductGroup productGroup = new ProductGroup(); productGroup.ProductGroupId = groupId; productGroup.ProductGroupName = nameP; productGroup.Conditions = conditionWithProperties.OrderBy(c => c.ConditionName).ToList(); productGroup.ConditionId = conditionWithProperties[0].ConditionId; return(productGroup); }
public ConditionModel GetDataForSlectedTestCondition(int materialId, int subgroupId, int groupId, int rowId, IMaterialsContextUow context) { GroupTestCondition slectedTestCondition = context.GroupTestConditions.AllAsNoTracking.Where(n => n.MaterialID == materialId && n.SubgroupID == subgroupId && n.GroupId == groupId && n.RowID == rowId).FirstOrDefault(); ConditionModel conditionModel = new ConditionModel(); conditionModel.ProductGroupId = (ProductGroup.ProductGroupType)groupId; conditionModel.Properties = new List <ElsevierMaterials.Models.Property>(); conditionModel.RowId = rowId; conditionModel.ConditionName = ""; if (slectedTestCondition.Temperature != null && slectedTestCondition.Temperature != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; " + slectedTestCondition.Temperature : slectedTestCondition.Temperature); } if (slectedTestCondition.Basis != null && slectedTestCondition.Basis != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Basis: " + slectedTestCondition.Basis : "Basis: " + slectedTestCondition.Basis); } if (slectedTestCondition.TestType != null && slectedTestCondition.TestType != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; " + slectedTestCondition.TestType : slectedTestCondition.TestType); } if (slectedTestCondition.StressRatio != null && slectedTestCondition.StressRatio != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Stress ratio: " + slectedTestCondition.StressRatio : "Stress ratio: " + slectedTestCondition.StressRatio); } if (slectedTestCondition.SpecimenOrientation != null && slectedTestCondition.SpecimenOrientation != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Specimen orientation: " + slectedTestCondition.SpecimenOrientation : "Specimen orientation: " + slectedTestCondition.SpecimenOrientation); } if (slectedTestCondition.HoldingTemperature != null && slectedTestCondition.HoldingTemperature != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Holding temperature: " + slectedTestCondition.HoldingTemperature : "Holding temperature: " + slectedTestCondition.HoldingTemperature); } if (slectedTestCondition.HoldingTime != null && slectedTestCondition.HoldingTime != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Holding time: " + slectedTestCondition.HoldingTime : "Holding time: " + slectedTestCondition.HoldingTime); } if (slectedTestCondition.SpecimenType != null && slectedTestCondition.SpecimenType != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; " + slectedTestCondition.SpecimenType : slectedTestCondition.SpecimenType); } if (slectedTestCondition.Comment != null && slectedTestCondition.Comment != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; " + slectedTestCondition.Comment : slectedTestCondition.Comment); } if (slectedTestCondition.TSCF != null && slectedTestCondition.TSCF != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; Theoretical stress concentration factor: " + slectedTestCondition.TSCF : "Theoretical stress concentration factor: " + slectedTestCondition.TSCF); } if (slectedTestCondition.Pressure != null && slectedTestCondition.Pressure != "") { conditionModel.ConditionName = conditionModel.ConditionName + ((conditionModel.ConditionName != "") ? "; " + slectedTestCondition.Pressure : slectedTestCondition.Pressure); } if (conditionModel.ConditionName == null || conditionModel.ConditionName == "") { conditionModel.ConditionName = "All"; } conditionModel.ConditionName = conditionModel.ConditionName.TrimStart(';').TrimStart(); IList <PropertyWithConvertedValues> propertiesPerCond = context.PropertiesWithConvertedValues.All.Where(m => m.MaterialId == materialId && m.SubgroupId == subgroupId && m.GroupId == slectedTestCondition.GroupId && m.RowId == slectedTestCondition.RowID).ToList(); foreach (var prop in propertiesPerCond) { ElsevierMaterials.Models.Property propertyObj = new PropertyElsBinder().GetPropertyDataNew(materialId, subgroupId, slectedTestCondition, prop); conditionModel.Properties.Add(propertyObj); } conditionModel.Properties = conditionModel.Properties.OrderBy(m => m.PropertyId).ToList(); return(conditionModel); }
public ElsevierMaterials.Models.Domain.Comparison.Property FillPropertyData(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, ElsevierMaterials.Models.Condition condition) { ElsevierMaterials.Models.Domain.Comparison.Comparison comparison = GetComparison(); PropertyBasicInfo propertyInfo = _propertyBinder.FillPropertyBasicData(context, propertyClient, null); ElsevierMaterials.Models.Domain.Comparison.Property property = new ElsevierMaterials.Models.Domain.Comparison.Property(); property.PropertyInfo = propertyInfo; property.PropertyInfo.Name = _propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, context, propertyClient, condition); property.PropertyInfo.Unit = _propertyBinder.FillPropertyUnit(sourceMaterialId, sourceId, subgroupId, context, propertyClient, condition); return(property); }
public void AddPropertiesForMaterial(int sourceMaterialId, int sourceId, int subgroupId, List <PropertyFilter> propertiesForExport, Material material, IMaterialsContextUow materialContextUow) { foreach (var propertyClient in propertiesForExport) { Property property = material.Properties.Where(m => m.ElsBasicInfo.GroupId == propertyClient.GroupId && m.ElsBasicInfo.TypeId == propertyClient.TypeId && m.ElsBasicInfo.SourceTypeId == propertyClient.SourceTypeId).FirstOrDefault(); ElsevierMaterials.Models.Condition condition = _conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient); property = AddProperty(sourceMaterialId, sourceId, subgroupId, material, property, materialContextUow, propertyClient, condition); } }
public IList <Material> GetEquivalentMaterials(int id, GridDescriptor request, IMaterialsContextUow context) { IList <Material> tmp = GetAllEquivalentMaterials(id, context); return(tmp.Page(request.Pager).ToList()); }
public Condition FillConditionData(int subgroupId, int sourceMaterialId, int sourceId, int groupId, int conditionId, IMaterialsContextUow context) { string sessionId = System.Web.HttpContext.Current.Session["TotalMateriaSession"].ToString(); IService service = new TotalMateriaService(); IPlusService servicePLUS = new TMPlusService(); Condition condition = null; if (groupId == 806) { PropertiesContainer mechanical = servicePLUS.GetMechanicalPLUSPropertiesFromService(sessionId, sourceMaterialId, subgroupId); IList <TabConditionAndData> mechanicalCondition = mechanical.Model.Where(m => m.ConditionId == conditionId).ToList(); condition = new Condition(); condition.Properties = new List <Property>(); foreach (var item in mechanicalCondition) { condition.ConditionName = item.Condition; condition.ConditionId = item.ConditionId; foreach (var prop in item.DataForCondition) { foreach (var row in prop.Rows) { string tempString = ""; if (!string.IsNullOrEmpty(row.Item3)) { if (tempString != "") { tempString += "; " + row.Item3; } else { tempString += row.Item3; } } if (tempString != "") { tempString += "; " + row.Item2; } else { tempString += row.Item2; } condition.Properties.Add(new Property() { SourcePropertyId = prop.PropertyId, PropertyName = prop.Header.ToLower(), OrigUnit = prop.Unit.Replace("(", "").Replace(")", ""), OrigValue = row.Item1, OrigValueText = tempString }); } } condition.Properties = condition.Properties.OrderBy(s => s.PropertyName).ToList(); int count = 0; foreach (var prop in condition.Properties) { var st = context.EquivalentProperties.AllAsNoTracking.Where(s => s.SourcePropertyId == prop.SourcePropertyId && s.SourceId == 3).FirstOrDefault(); if (st != null) { prop.PropertyId = st.PropertyId; prop.SourcePropertyId = st.SourcePropertyId; prop.PropertyName = st.Name; prop.ValueId = count; count = count + 1; } else { prop.ValueId = count; count = count + 1; } } } } else { PropertiesContainer physical = servicePLUS.GetPhysicalPropertiesPLUSFromService(sessionId, sourceMaterialId); IList <TabConditionAndData> physicalCondition = physical.Model.Where(m => m.ConditionId == conditionId).ToList(); condition = new Condition(); condition.Properties = new List <Property>(); foreach (var item in physicalCondition) { condition.ConditionName = item.Condition; condition.ConditionId = item.ConditionId; foreach (var prop in item.DataForCondition) { foreach (var row in prop.Rows) { string tempString = ""; if (!string.IsNullOrEmpty(row.Item3)) { if (tempString != "") { tempString += "; " + row.Item3; } else { tempString += row.Item3; } } if (tempString != "") { tempString += "; " + row.Item2; } else { tempString += row.Item2; } condition.Properties.Add(new Property() { SourcePropertyId = prop.PropertyId, PropertyName = prop.Header.ToLower(), OrigUnit = prop.Unit.Replace("(", "").Replace(")", ""), OrigValue = row.Item1, OrigValueText = tempString }); } } condition.Properties = condition.Properties.OrderBy(s => s.PropertyName).ToList(); int count = 0; foreach (var prop in condition.Properties) { var st = context.EquivalentProperties.AllAsNoTracking.Where(s => s.SourcePropertyId == prop.SourcePropertyId && s.SourceId == 3).FirstOrDefault(); if (st != null) { prop.PropertyId = st.PropertyId; prop.SourcePropertyId = st.SourcePropertyId; prop.PropertyName = st.Name; prop.ValueId = count; count = count + 1; } else { prop.ValueId = count; count = count + 1; } } } } return(condition); }
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 SubgroupsModel GetSubgroupsModel(GridDescriptor request, SearchSubgroupsFilters filters, IMaterialsContextUow context) { SubgroupsModel model = new SubgroupsModel(); model.Descriptor = request; ICollection <Material> materials = GetAllEquivalentMaterialsEn(filters.MaterialId, context); model.MaterialInfo = materials.FirstOrDefault(); var standardList = materials.Select(m => new PropertyGroupModel { PropertyGroupModelName = m.Standard }).Distinct(new PropertyGroupComparer()).OrderBy(m => m.PropertyGroupModelName).ToList(); var sourcesInitial = materials.Select(m => string.Concat(m.SourceId, "#", m.DatabookId)).Distinct(); int databookId = 0; if (filters.SourceId > 0) { bool isInt = int.TryParse(filters.Source.Split('#')[1], out databookId); databookId = isInt ? databookId : 0; materials = materials.Where(m => m.SourceId == filters.SourceId && m.DatabookId == databookId).ToList(); } if (filters.StandardId != null && filters.StandardId != "" && filters.StandardId != "0") { materials = materials.Where(m => m.Standard == filters.StandardId).ToList(); } if (filters.Specification != "" && filters.Specification != null) { materials = materials.Where(m => m.Specification.ToLower().Contains(filters.Specification.ToLower())).ToList(); } IEnumerable <Material> materialsEnum = materials.AsEnumerable(); SearchFilterColumnsAll columnFilters = (SearchFilterColumnsAll)System.Web.HttpContext.Current.Session["SubgroupListResults"]; if (columnFilters != null) { foreach (SearchFilterColumns f in columnFilters.AllFilters.Where(c => c.Filter != null && c.Filter.Trim() != "")) { string oneFilter = f.Filter.Trim().ToUpper(); if (f.Name == "Reference") { materialsEnum = materialsEnum.Where(m => m.SourceText != null && m.SourceText.ToUpper().Contains(oneFilter)); } else if (f.Name == "Supplier") { materialsEnum = materialsEnum.Where(m => m.Manufacturer != null && m.Manufacturer.ToUpper().Contains(oneFilter)); } else if (f.Name == "Std. Org. / Country") { materialsEnum = materialsEnum.Where(m => m.Standard != null && m.Standard.ToUpper().Contains(oneFilter)); } else if (f.Name == "Specification") { materialsEnum = materialsEnum.Where(m => m.Specification != null && m.Specification.ToUpper().Contains(oneFilter)); } else if (f.Name == "Filler") { materialsEnum = materialsEnum.Where(m => m.Filler != null && m.Filler.ToUpper().Contains(oneFilter)); } } } model.Materials = materialsEnum.ToList(); model.Descriptor.Pager.TotalRecordCount = model.Materials.Count; model.Descriptor = request; if (model.Materials.Count > 0) { model.Name = model.Materials[0].Name; } else { model.Name = ""; } SearchSubgroupCondition filterModel = new SearchSubgroupCondition(); filterModel.SourceId = filters.SourceId; filterModel.StandardId = filters.StandardId; filterModel.Specification = filters.Specification; filterModel.FullText = filters.filter; filterModel.ShowPropertiesFilters = false; //IEnumerable<string> subSources = sourcesInitial.Select(m => string.Concat(m.SourceId, "#", m.DatabookId)).Distinct(); filterModel.Sources = context.Sources.AllAsNoTracking.Where(s => s.Id == 0 || /* for All */ sourcesInitial.Contains(string.Concat(s.Id, "#", s.Databook_id)) ).ToList(); filterModel.PropertyGroups = standardList; filterModel.MaterialId = filters.MaterialId; filterModel.ShowPropertiesFilters = false; filterModel.FromBrowse = filters.FromBrowse; filterModel.FromAdvanced = filters.FromAdvanced; filterModel.SelectedSource = filters.Source; model.Filters = filterModel; return(model); }
public MaterialBasicInfo GetMaterialInfo(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow materialContextUow) { MaterialBasicInfo material = null; switch (sourceId) { case 1: material = _materialElsBinder.GetMaterialInfo(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow); break; case 2: material = _materialTMMetalsBinder.GetMaterialInfo(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow); break; case 3: material = _materialTMPlusBinder.GetMaterialInfo(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow); break; default: break; } FullTextSearch fts = materialContextUow.FullTextSearch.GetMaterialById(materialId); material.TypeId = fts.type_ID; material.TypeName = fts.material_type; return(material); }