public InsertMaterial(Configuration Conf)
        {
            InitializeComponent();
            conf = Conf;

            Text = "Добавить материал";
        }
        public InsertDevice(Configuration Conf, int ItemId, BaseDeviceType DevType)
        {
            InitializeComponent();

            conf = Conf;
            devType = DevType;
            itemId = ItemId;

            this.Text = devType == BaseDeviceType.Saw ?
                "Изменить конфигурацию пилы" : "Изменить конфигурацию шлифовального станка";

            DeviceList GoalList = devType == BaseDeviceType.Saw ?
                conf.Saws : conf.Grinders;

            int DeviceIndex = GoalList.GetIndexById(itemId);

            textBox1.Text = GoalList[DeviceIndex].Text;
            textBox2.Text = GoalList[DeviceIndex].Responsible;
            textBox4.Text = GoalList[DeviceIndex].ServiceTimePeriod.ToString();
            textBox5.Text = GoalList[DeviceIndex].ServiceTime.ToString();

            DefaultMaterialId = GoalList[DeviceIndex].DefaultMaterialId;

            for (int i = 0; i < GoalList[DeviceIndex].SupportedMaterials.Count; i++)
            {
                mpl.Add((MaterialPair)GoalList[DeviceIndex].SupportedMaterials[i].Clone());
            }

            LoadMaterials();
            LoadSupMaterials();
        }
        public InsertOrder(Configuration Conf, int ItemId)
        {
            InitializeComponent();

            conf = Conf;
            itemId = ItemId;

            LoadCustomers();

            int OrderIndex = conf.Orders.GetIndexById(itemId);

            textBox1.Text = conf.Orders[OrderIndex].Id.ToString();

            if (conf.Orders[OrderIndex].DeadLine != null)
            {
                checkBox1.Checked = true;
                dateTimePicker2.Value = conf.Orders[OrderIndex].DeadLine.Value;
            }

            foreach (ComboBoxItem item in comboBox1.Items)
            {
                if (item.Id == conf.Orders[OrderIndex].CustomerId)
                {
                    comboBox1.SelectedItem = item;
                    break;
                }
            }

            dateTimePicker1.Value = conf.Orders[OrderIndex].Date;
        }
        public InsertCustomer(Configuration Сonf)
        {
            InitializeComponent();

            conf = Сonf;

            this.Text = "Добавить нового клиента";
        }
        public InsertOrder(Configuration Conf)
        {
            InitializeComponent();

            conf = Conf;
            textBox1.Text = conf.Orders.GetFreeId().ToString();

            LoadCustomers();
        }
        public InsertMaterial(Configuration Conf, int ItemId)
        {
            InitializeComponent();
            conf = Conf;
            itemId = ItemId;
            Text = "Изменить материал";

            int itemIndex = conf.Materials.GetIndexById(itemId);
            textBox1.Text = conf.Materials[itemIndex].Text;
            textBox2.Text = conf.Materials[itemIndex].SawingTime.ToString();
            textBox3.Text = conf.Materials[itemIndex].PolishingTime.ToString();
            textBox4.Text = conf.Materials[itemIndex].Description;
        }
        public InsertCustomer(Configuration Сonf, int ItemId)
        {
            InitializeComponent();

            conf = Сonf;
            itemId = ItemId;

            this.Text = "Изменить параметры клиента";

            int CustIndex = conf.Customers.GetIndexById(itemId);
            textBox1.Text = conf.Customers[CustIndex].Text;
            textBox2.Text = conf.Customers[CustIndex].Phone;
            textBox3.Text = conf.Customers[CustIndex].Address;
        }
        public ConfigWindow(Configuration Conf)
        {
            InitializeComponent();
            original_conf = Conf;
            conf = (Configuration)original_conf.Clone();

            LoadMaterials();
            LoadSaws();
            LoadGrinders();
            LoadProtucts();
            LoadCustomers();
            LoadOrders();
            dateTimePicker1.Value = conf.BaseTime;
        }
        public InsertProduction(Configuration Conf, int ItemId)
        {
            InitializeComponent();
            conf = Conf;
            itemId = ItemId;
            Text = "Изменить продукцию";

            int ProdIndex = conf.Productions.GetIndexById(ItemId);

            textBox1.Text = conf.Productions[ProdIndex].Text;
            ProductionSizeList psl = conf.Productions[ProdIndex].SupSizes;
            foreach (ProductionSize item in psl)
            {
                listBox1.Items.Add(item.Clone());
            }
        }
        public InsertDevice(Configuration Conf, BaseDeviceType DevType)
        {
            InitializeComponent();

            conf = Conf;
            devType = DevType;

            if (devType == BaseDeviceType.Saw)
            {
                this.Text = "Добавить новую пилу";
            }

            this.Text = devType == BaseDeviceType.Saw ?
                "Добавить новую пилу" : "Добавить шлифовальный станок";

            LoadMaterials();
        }
        public object Clone()
        {
            Configuration clone = new Configuration();

            clone.baseTime = baseTime;
            clone.materials = (MaterialList)materials.Clone();
            clone.saws = (DeviceList)saws.Clone();
            clone.grinders = (DeviceList)grinders.Clone();
            clone.productions = (ProductionList)productions.Clone();
            clone.customers = (CustomerList)customers.Clone();
            clone.orders = (OrderList)orders.Clone();
            clone.tasks = (TaskList)tasks.Clone();

            return clone;
        }
 public void Assign(Configuration Obj)
 {
     baseTime = Obj.baseTime;
     materials = (MaterialList)Obj.materials.Clone();
     saws = (DeviceList)Obj.saws.Clone();
     grinders = (DeviceList)Obj.grinders.Clone();
     productions = (ProductionList)Obj.productions.Clone();
     customers = (CustomerList)Obj.customers.Clone();
     orders = (OrderList)Obj.orders.Clone();
     tasks = (TaskList)Obj.tasks.Clone();
 }
 public InsertProduction(Configuration Conf)
 {
     InitializeComponent();
     conf = Conf;
     Text = "Добавить продукцию";
 }