Example #1
0
        public MaterialGroups toRecord(dynamic record)
        {
            MaterialGroups mt = new MaterialGroups();


            mt.AbsEntry          = record.AbsEntry;
            mt.Description       = record.Description;
            mt.MaterialGroupCode = record.MaterialGroupCode;


            return(mt);
        }
Example #2
0
 /// <summary>
 /// Add material group operation
 /// </summary>
 /// <param name="Model">-editor model(universal model for data exchange)</param>
 /// <returns>true- operation has done successful</returns>        
 public bool ADDMaterialGroup(EditorModel Model)
 {
     bool ret = true;
     MaterialGroups creation = new MaterialGroups{Name=Model.NewMaterialGroupName};
     try {
         DBBase.Context.MaterialGroups.Add(creation);
         DBBase.Context.SaveChanges();
     }
     catch{
         ret = false;
     }
     return ret;
 }
Example #3
0
        public void Add(ShapeNode node)
        {
            List <ShapeNode> shapeList;

            if (MaterialGroups.ContainsKey(node.Material))
            {
                shapeList = MaterialGroups[node.Material];
            }
            else
            {
                shapeList = GetOrCreateShapeList();
                MaterialGroups.Add(node.Material, shapeList);
            }

            shapeList.Add(node);
        }
        public DataTable GetDataTable(List <Material> materials)
        {
            try {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.MasterData.Materials,
                    new SuperGrid.ColumnDefinition("Material", "Material", typeof(Material), inUI: false),
                    new SuperGrid.ColumnDefinition("Material Id", "Material Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Material Group", "Material Group", typeof(string), visible: true),
                    new SuperGrid.ColumnDefinition("Code", "Code", typeof(string)),
                    new SuperGrid.ColumnDefinition("Description", "Description", typeof(string))
                    );

                dataTable.BeginLoadData();

                foreach (var item in materials)
                {
                    var id          = item.Id;
                    var groupId     = new MaterialGroups().GetById(item.MaterialGroupId).Description;
                    var code        = item.Code;
                    var description = item.Description;
                    var row         = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        id,
                        groupId,
                        code,
                        description
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex) {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }