Пример #1
0
        public DataTable UnitListToDataTable(Business.Arrays.UnitArray data)
        {
            DataTable result = new DataTable();

            result.Columns.Add("Unit", typeof(string));

            for (int i = 0; i < data.List.Size; ++i)
            {
                Business.Unit unit   = data.List[i];
                DataRow       newRow = result.NewRow();

                newRow[0] = unit.Name;

                result.Rows.Add(newRow);
            }
            return(result);
        }
Пример #2
0
        static public void Save(Business.Arrays.UnitArray values)
        {
            _serializer.ClearBinary();
            for (int i = 0; i < values.List.Size; ++i)
            {
                if (Exists(values.List[i]))
                {
                    MessageBox.Show("Value: " + values.List[i].Name + " alredy exists.");
                    continue;
                }

                if (values.List[i].IdUnit == -1)
                {
                    values.List[i].IdUnit = FilesConfigurations.UnitsId();
                    FilesConfigurations.PlusUnitsId();
                }

                _serializer.SaveData(ConvertToFile(values.List[i]));
            }
        }