Beispiel #1
0
        public void Set_dataGridView_List(InventorySystemContainer ISC)
        {
            dataGridView_List.Rows.Clear();

            if (Loaded)
            {
                List <DevicePC> list_pc = ISC.Get_Main_Device_List().Get_PCList();

                int list_size_pc = list_pc.Count;
                int i;

                for (i = 0; i < list_size_pc; i++)
                {
                    dataGridView_List.Rows.Add();

                    dataGridView_List.Rows[i].Cells[0].Value = i + 1;
                    dataGridView_List.Rows[i].Cells[1].Value = list_pc[i].ID;
                    dataGridView_List.Rows[i].Cells[2].Value = list_pc[i].Name;
                    dataGridView_List.Rows[i].Cells[3].Value = list_pc[i].Type;
                    dataGridView_List.Rows[i].Cells[4].Value = list_pc[i].RegistrationDate;
                }

                List <DeviceMonitor> list_mon = ISC.Get_Main_Device_List().Get_MonList();

                int list_size_mon = list_mon.Count;

                int j = 0;
                for (i = list_size_pc; i < list_size_pc + list_size_mon; i++)
                {
                    dataGridView_List.Rows.Add();

                    dataGridView_List.Rows[i].Cells[0].Value = i + 1;
                    dataGridView_List.Rows[i].Cells[1].Value = list_mon[j].ID;
                    dataGridView_List.Rows[i].Cells[2].Value = list_mon[j].Name;
                    dataGridView_List.Rows[i].Cells[3].Value = list_mon[j].Type;
                    dataGridView_List.Rows[i].Cells[4].Value = list_mon[j].RegistrationDate;
                    j++;
                }

                List <DevicePrinter> list_pr = ISC.Get_Main_Device_List().Get_PrList();

                int list_size_pr = list_pr.Count;

                j = 0;
                for (i = list_size_pc + list_size_mon; i < list_size_pc + list_size_mon + list_size_pr; i++)
                {
                    dataGridView_List.Rows.Add();

                    dataGridView_List.Rows[i].Cells[0].Value = i + 1;
                    dataGridView_List.Rows[i].Cells[1].Value = list_pr[j].ID;
                    dataGridView_List.Rows[i].Cells[2].Value = list_pr[j].Name;
                    dataGridView_List.Rows[i].Cells[3].Value = list_pr[j].Type;
                    dataGridView_List.Rows[i].Cells[4].Value = list_pr[j].RegistrationDate;
                    j++;
                }
            }
        }
Beispiel #2
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (!Saved)
            {
                if (BufferContainer.Get_Main_Device_List().Get_MonList().Count != 0 ||
                    BufferContainer.Get_Main_Device_List().Get_PCList().Count != 0 ||
                    BufferContainer.Get_Main_Device_List().Get_PrList().Count != 0)
                {
                    MainInvSysContainers.Add(BufferContainer);

                    Saved = true;

                    BufferContainer = new InventorySystemContainer();
                    BufferContainer = null;
                    BufferDate      = DateTime.MinValue;

                    FileSystem.Save_Container_List(MainInvSysContainers);

                    Create_Dates_List();
                    Set_dataGridView_List();
                }
            }
            else if (Saved)
            {
                BufferContainer = new InventorySystemContainer(ChosenDate);
                BufferContainer = (InventorySystemContainer)Get_MainInvSysContainer(ChosenDate).Clone();

                BufferDate = DateTime.Now;

                BufferContainer.CreationDate = BufferDate;

                MainInvSysContainers.Add(BufferContainer);

                Saved = true;

                BufferContainer = new InventorySystemContainer();
                BufferContainer = null;
                BufferDate      = DateTime.MinValue;

                FileSystem.Save_Container_List(MainInvSysContainers);

                Create_Dates_List();
                Set_dataGridView_List();
            }
        }