private void deleteEmployeeBtn_Click(object sender, EventArgs e) { Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario")); if (MessageBox.Show("¿Desea borrar la información del empleado seleccionado?.\n La información como cliente no será borrada al " + "realizar esta acción", "Borrar Empleado", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (formLogin.ShowDialog() == DialogResult.OK) { employee.delete(); EmployeePanel.Hide(); } } }
private void changeUserBtn_Click(object sender, EventArgs e) { Form_Login formLogin = new Form_Login("Iniciar Sesión"); DarkForm darkForm = new DarkForm(); if (MessageBox.Show(string.Format("¿Desea cambiar de usuario?.\nGuarde su información antes de continuar."), "", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } darkForm.Show(); if (formLogin.ShowDialog() == DialogResult.OK) { employee = new Empleado(formLogin.ID); displayHideTabs(); homeBtn.BackColor = homeBtn.Parent.BackColor;//changing color to load home panel homeBtn_Click((object)this, (EventArgs)null); try { (ContainerPanel.Controls[0] as Panel_Inicio).EmployeeID = employee.ID; } catch (Exception) { } var count = Application.OpenForms.Count; for (int i = 0; i < count; i++) { var item = Application.OpenForms[i]; if (item.GetType() == typeof(Panel_Ventas)) { (item as Panel_Ventas).setEmployee(employee.ID); } if (item.GetType() == typeof(Panel_Productos)) { (item as Panel_Productos).setEmployee(employee.ID); if (count > Application.OpenForms.Count) { i--; count = Application.OpenForms.Count; } } } } darkForm.Close(); }
private void t_Tick(object sender, EventArgs e) { Form_Login formLogin = new Form_Login("Iniciar Sesión"); SecondStartingWindow secondStartingWindow = new SecondStartingWindow(); (sender as Timer).Stop(); this.TopMost = false; if (Turno.isFirsUsageDateSet) { if (formLogin.ShowDialog() == DialogResult.OK) { this.Hide(); new Form1(formLogin.ID).Show(); } else { this.Close(); } } else { DarkForm darkForm = new DarkForm(); panelEmpleados_nuevoEmpleado empleadosNuevoEmpleado = new panelEmpleados_nuevoEmpleado(false); this.Hide(); darkForm.Show(); if (empleadosNuevoEmpleado.ShowDialog() == DialogResult.OK) { resetDefaultFonts(); if (secondStartingWindow.ShowDialog() == DialogResult.OK) { new Form1(empleadosNuevoEmpleado.newEmployeeID).Show(); } } else { this.Close(); } darkForm.Close(); } }
private void Paybtn_Click(object sender, EventArgs e) { FormCambio formCambio = new FormCambio(this.employee.salary); //DarkForm darkForm = new DarkForm(); Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario")); //darkForm.Show(); formLogin.ShowDialog(); Empleado empleado = new Empleado(formLogin.ID); if (formLogin.DialogResult == DialogResult.OK) { if (empleado.isAdmin) { /*try * { * this.printDocument1.PrinterSettings.PrinterName = this.printDialog1.PrinterSettings.PrinterName; * this.printDialog1.Document = this.printDocument1; * this.printDocument1.Print(); * } * catch (InvalidPrinterException) * { * int num2 = (int)MessageBox.Show("Registre una impresora para poder utilizar esta opción", "No se ha registrado impresora"); * }*/ openDrawer(); this.employee.paySalary(); formCambio.ShowDialog(); // goto label_7; } } if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin) { MessageBox.Show("No dispone de los permisos necesarios para realizar el pago"); } }
private void button1_Click(object sender, EventArgs e) { if (!Turno.shiftActive) { return; } DarkForm darkForm = new DarkForm(); Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario")); FormShiftAddMoney formShiftAddMoney = new FormShiftAddMoney(); darkForm.Show(); formLogin.ShowDialog(); Empleado empleado = new Empleado(formLogin.ID); if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin) { if (formShiftAddMoney.ShowDialog() == DialogResult.OK) { //<<< step1 >>> --Start //When outputting to a printer,a mouse cursor becomes like a hourglass. try { if (m_Drawer != null) { //Open the device //Use a Logical Device Name which has been set on the SetupPOS. m_Drawer.Open(); //Get the exclusive control right for the opened device. //Then the device is disable from other application. m_Drawer.Claim(1000); //Enable the device. m_Drawer.DeviceEnabled = true; //Open the drawer by using the "OpenDrawer" method. m_Drawer.OpenDrawer(); m_Drawer.DeviceEnabled = false; m_Drawer.Release(); m_Drawer.Close(); } else { useDefaultPrinter(); } } catch (Exception) { if (m_Drawer != null) { m_Drawer.Release(); m_Drawer.Close(); } useDefaultPrinter(); } //<<<step1>>>--End Turno.AddCashToDrawer(empleado.ID, formShiftAddMoney.cash, formShiftAddMoney.reason); MessageBox.Show("Se realizó correctamente"); this.setGroupBoxInfo(); } } else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1) { MessageBox.Show("No tiene los permisos necesarios para realizar esta acción"); } darkForm.Close(); }