static void Main(string[] args) { try { // Reading serialized files Stock.ReadComponents(); Stock.ReadDevices(); SerialsNumbers.ReadSerialsNumbers(); // Login operator LoginOperators.Login.OperatorLog = new LoginOperators.Operator("Test", "Console", 9999, 9999); // Work order selection CoreSystem.SelectedOrder = new InternalOrder(9999, ECode.CNT_BioPanel_ACC, EType.PanelAccess, 3); // Device creation using your own creation method CoreSystem.LoadDevices(EType.PanelAccess, EValidation.Finger); CoreSystem.PreviewDevices.Add(CoreSystem.DeviceAssembly); // Manual addition of device CoreSystem.PreviewDevices.Add(new AccessControl(ECode.CNT_A60_ID, EType.AccessControl, EValidation.Finger)); CoreSystem.PreviewDevices.Add(new AccessPanel(ECode.CNT_BioPanel_ACC, EType.PanelAccess, EValidation.Finger)); CoreSystem.PreviewDevices.Add(new Attendance(ECode.CNT_E7_CR, EType.Attendance, EValidation.Finger)); // All data in the list is printed Console.WriteLine(Device.Info(CoreSystem.PreviewDevices)); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); }
/// <summary> /// Add a device. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddDevice_Click(object sender, EventArgs e) { try { if (CoreSystem.SelectedOrder.ETypeDevice == eType && !(CoreSystem.ListAssembly is null) && this.pressButton == true) { if (CoreSystem.PreviewDevices.Count < CoreSystem.SelectedOrder.CountDevice || MessageBox.Show($"The quantity requested in the order has already been reached. Do you want to assemble the device anyway?", "LIMIT DEVICES", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { if (Stock.ThereIsStock(CoreSystem.ListAssembly, out string component)) { CoreSystem.LoadDevices(eType, eValidation); CoreSystem.PreviewDevices.Add(CoreSystem.DeviceAssembly); this.pgbStatusOrder.Value = (int)((float)CoreSystem.PreviewDevices.Count / CoreSystem.SelectedOrder.CountDevice * 100); Device.SaveLogDevices(CoreSystem.DeviceAssembly, "Assembly"); CoreSystem.DeviceAssembly = null; SerialsNumbers.SaveSerialsNumbers(); DAO.ModifyListComponents(Stock.ComponentsStock); PressButton(); LoadListAssembly(); TrasparentButtonsSubPanel(); HideSubMenu(); this.lblSerialNumber.Text = "--"; } else { MessageBox.Show($"The missing materials are:\n\n{component}", "NO STOCK COMPONENTS!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("The device to be assembled must be of the same type as the order", "TYPE ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "NO ADD DEVICE!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Load Form Default /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmAssembly_Load(object sender, EventArgs e) { try { this.lblErrorList.Visible = false; LoadOrderSelected(); HideSubMenu(); EnableButtons(); SerialsNumbers.ReadSerialsNumbers(); CoreSystem.ListAssembly = null; if (!(CoreSystem.SelectedOrder is null) && !(CoreSystem.PreviewDevices is null)) { ButtonForType(CoreSystem.SelectedOrder.ETypeDevice); this.dgvPreview.DataSource = new BindingList <Device>(CoreSystem.PreviewDevices); } } catch (Exception ex) { this.Enabled = false; MessageBox.Show(ex.Message, "NO DATA DEVICES!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }