private void DeleteHandler(object sender, EventArgs e) { if (_mouseLocation.RowIndex < 0 || _mouseLocation.RowIndex > _devices.Rows.Count - 1) { return; } string name = _devices.Rows[_mouseLocation.RowIndex].Cells[0].Value.ToString(); if (ConfirmationForm.Invoke(name) != DialogResult.OK) { return; } _devices.Rows.RemoveAt(_mouseLocation.RowIndex); for (int i = 0; i < _recipeDevicesValues.Count; i++) { if (_recipeDevicesValues[i].Item1 != name) { continue; } _recipeDevicesValues[i] = Tuple.Create("", _recipeDevicesValues[i].Item2); break; } OnDataChange?.Invoke(new[] { _deviceNames, _recipeDevicesValues }); OnLock?.Invoke(); }
private void DeleteHandler(object sender, EventArgs e) { if (_mouseLocation.RowIndex < 0 || _mouseLocation.RowIndex > _dgv.Rows.Count - 1) { return; } string name = _dgv.Rows[_mouseLocation.RowIndex].Cells[0].Value.ToString(); if (ConfirmationForm.Invoke(name) != DialogResult.OK) { return; } _dgv.Rows.RemoveAt(_mouseLocation.RowIndex); for (int i = 0; i < _data.Count; i++) { if (_data[i].Item1 != name) { continue; } _data[i] = Tuple.Create("", _data[i].Item2); break; } OnDataChange?.Invoke(_data); _state = State.Deleted; }
private void CerrarSesion() { if (EventosFlags.CierreCajaEstado == CierreCajaEstadoEnum.Abierto) { var confirmation = new ConfirmationForm(Resources.CerrarSesionConfirmacionCajaAbirta, Resources.TextoAceptar, Resources.TextoCancelar); if (confirmation.ShowDialog() == DialogResult.OK) { var cerrarCajaForm = new CerrarCaja(controlarMargenes: true); if (cerrarCajaForm.ShowDialog() == DialogResult.OK) { CerrarTodosLosTabs(); EventosFlags.CierreCajaEstado = CierreCajaEstadoEnum.Cerrado; ControlarCierreCaja(); ToggleAccionesRelacionadasACierreDeCaja(); MembershipProvider.Logoff(); ToggleLoginItems(); AbrirTab(new CierreCajaDetalle(cerrarCajaForm.CierreCajaId)); } } } else { Logoff(); } this.Text = this.Tag.ToString(); }
private void sincronizacionSecuencialStripMenuItem_Click(object sender, EventArgs e) { var user = SeguridadHelper.SolicitarPermisosUsuario(new List <string>() { "SuperAdministrador", "Administrador", "Encargado" }); if (user != 0) { var confirmation = new ConfirmationForm(Resources.SincronizacionConfimacion, Resources.TextoAceptar, Resources.TextoCancelar); if (confirmation.ShowDialog() == DialogResult.OK) { try { _sincronizacionManager.SincronizacionSecuencial(); } catch (Exception ex) { MessageBox.Show(Resources.SincronizacionError, Resources.SincronizacionTitulo); } } } }
public frmEditarCorreccionStock(int correccionId) { using (var frm = new ConfirmationForm("Desea eliminar la corrección?", "Aceptar", "Cancelar")) { var result = frm.ShowDialog(); if (result == DialogResult.OK) { //Eliminar var correcion = CorreccionStockRepository.Obtener(correccionId); var tipocorreccion = MotivoRepository.Obtener(t => t.MotivoCorreccionId == correcion.MotivoCorreccionId); EliminarCorreccion(correccionId); Stock = StockRepository.Obtener(s => s.ProductoId == correcion.ProductoId && s.MaxiKioscoId == AppSettings.MaxiKioscoId); ModificarStock((correcion.Cantidad * -1), tipocorreccion.SumarAStock); AgregarStockTransaccion(Stock, correcion.Cantidad * -1); MessageBox.Show("La corrección ha sido eliminada"); this.Close(); } } }
public static DialogResult ShowConfirmation(string message, MessageType type, string title = null, BaseForm parent = null) { if (string.IsNullOrEmpty(message)) { throw new ArgumentNullException(nameof(message)); } if (string.IsNullOrEmpty(title)) { title = "Intrebare"; } parent = parent ?? Application.MainForm; var form = new ConfirmationForm(message) { Location = parent.Location, Size = parent.Size, Title = title }; form.ApplyTheme(Application.UiTheme); form.MessageType = type; return(form.ShowDialog(parent)); }
public void btn_submit_Clicked() { // NEED TO DO VERIFICATION ON FORM. TRY CATCH ON REQUIRED EMPTY VARIABLES? if (string.IsNullOrEmpty(view.getMiddleName())) { personBuilder .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName()); if (string.IsNullOrEmpty(view.getEmergency())) { personBuilder .WithPrimaryContactOnly(view.getPhone()); if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else if (string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else { addressBuilder .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode()); } } else { personBuilder .WithAllContacts(view.getPhone(), view.getEmergency()); } } else { personBuilder .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName()); } gp = personBuilder.Build(); address = addressBuilder.Build(); GP practice = new GP(); practice.GPPractice = view.getPracticeName(); MemberDB.InsertGP(gp); AddressDB.InsertAddress(address); GPDB.InsertGP(practice); ConfirmationForm cForm = new ConfirmationForm(); ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm); cForm.Show(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ConfirmationForm confForm = new ConfirmationForm(); confForm.ShowDialog(); Application.Run(new MainForm()); }
public void btn_submit_Clicked() { appointment.AppointmentType = (Consult)Enum.Parse(typeof(Consult), view.getAppointmentType()); appointment.AppointmentDate = view.getAppointmentDate(); appointment.AppointmentTime = view.getAppointmentTime(); appointment.AppointmentDentist = view.getAppointmentDentist(); appointment.AppointmentNotes = view.getAppointmentNotes(); AppointmentDB.InsertAppointment(appointment); ConfirmationForm cForm = new ConfirmationForm(); ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm); cForm.Show(); }
private void btnGenerar_Click(object sender, EventArgs e) { if (ProveedorId != null || RubroId != null) { if (ProveedorId != null) { //Verifico si tiene facturas sin compras asociadas var facturasIds = FacturasRepository.Listado().Where(f => f.ProveedorId == ProveedorId).Select(f => f.FacturaId).ToList(); var compras = ComprasRepository.Listado().Where(c => facturasIds.Contains(c.FacturaId)).Count(); if (facturasIds.Count() != compras) { var mensaje = "El proveedor seleccionado tiene facturas no han sido completadas. Está seguro que desea continuar?"; using (var popup = new ConfirmationForm(mensaje, "Si", "No")) { var result = popup.ShowDialog(); if (result == DialogResult.OK) { GenerarReporte(); } else { DialogResult = DialogResult.None; } } } else { GenerarReporte(); } } else { GenerarReporte(); } } else { MessageBox.Show("Debe ingresar un proveedor y/o un rubro"); this.DialogResult = DialogResult.None; } }
public void ActualizarKioscoDesdeArchivo(OpenFileDialog openFileDialogSincronizacion) { //Abrimos dialogo para buscar el archivo de actualizacion. var openFileResult = openFileDialogSincronizacion.ShowDialog(); if (openFileResult == DialogResult.OK) { //Creamos ventana de confirmacion de actualizacion. var confirmation = new ConfirmationForm(Resources.SincronizacionConfirmacionActualizarDesdeArchivo, Resources.TextoAceptar, Resources.TextoCancelar); var confirmationResult = confirmation.ShowDialog(); if (confirmationResult == DialogResult.OK) { var dialog = new frmSincronizacionFeedback(_sincronizacionService, Uow, openFileDialogSincronizacion.FileName); dialog.ShowDialog(); } } }
internal bool ValidateAndAcceptFilename(string projectName, string path) { // invalid input can not be validated if (string.IsNullOrEmpty(projectName)) { return(false); } if (string.IsNullOrEmpty(path) || !File.Exists(path)) { return(false); } string[] projects = projectName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); string pname = projects[projects.Length - 1]; string fname = Path.GetFileNameWithoutExtension(path); if (string.IsNullOrEmpty(pname) || string.IsNullOrEmpty(fname)) { return(false); } if (0 == string.Compare(fname, pname, StringComparison.InvariantCultureIgnoreCase)) { return(true); } // ask the user if the file should be uploaded to a project with a different name ConfirmationForm form = new ConfirmationForm($"The filename '{fname}'|does not match|the project name '{pname}'||Do you want to upload anyway?"); if (DialogResult.No == form.ShowDialog()) { return(false); } return(true); }
private void CheckUltimaCajaCerrada() { if (EventosFlags.CierreCajaEstado == CierreCajaEstadoEnum.Abierto) { var ultimaCaja = CierreCajaRepository.Obtener(c => c.CierreCajaId == UsuarioActual.CierreCajaIdActual, c => c.Usuario); if (ultimaCaja.UsuarioId != UsuarioActual.UsuarioId) { var confirmation = new ConfirmationForm(string.Format(Resources.MensajeCerrarCajaAnterior, ultimaCaja.Usuario.NombreCompleto), Resources.TextoAceptar, Resources.TextoCancelar); if (confirmation.ShowDialog() == DialogResult.OK) { CerrarCaja(cancel: Logoff, controlarMargenes: false, cerrarSesion: false); } else { //Cerrar session Logoff(); } } } }
public void btn_submit_Clicked() { personBuilder .setMember((Member)Enum.Parse(typeof(Member), view.getMember())) .setGender((Gender)Enum.Parse(typeof(Gender), view.getGender())) .setDOB(view.getDOB()); if (string.IsNullOrEmpty(view.getMiddleName())) { personBuilder .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName()); if (string.IsNullOrEmpty(view.getEmergency())) { personBuilder .WithPrimaryContactOnly(view.getPhone()); if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else if (string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else { addressBuilder .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode()); } } else { personBuilder .WithAllContacts(view.getPhone(), view.getEmergency()); } } else { personBuilder .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName()); } member = personBuilder.Build(); MemberDB.InsertMember(member); address = addressBuilder.Build(); AddressDB.InsertAddress(address); if (view.getMember() == "Patient") { GPInformationForm gpForm = new GPInformationForm(); GPInformationPresenter gpPresenter = new GPInformationPresenter(gpForm); gpForm.Show(); } else { ConfirmationForm cForm = new ConfirmationForm(); ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm); cForm.Show(); } }
private void Aceptar() { if (PopupAbierto) { PopupAbierto = false; } else if (MensajeErrorAbierto) { MensajeErrorAbierto = false; } else if (ConfirmacionAbierta) { ConfirmacionAbierta = false; } else { if (dgvListado.Rows.Count > 0) { ConfirmacionAbierta = true; var frmConfirmar = new ConfirmationForm("Está seguro que desea guardar la transferencia?", "Si", "No"); if (frmConfirmar.ShowDialog() == DialogResult.OK) { var lineas = new List <TransferenciaProducto>(); for (int i = 0; i <= dgvListado.Rows.Count - 1; i++) { var linea = new TransferenciaProducto(); linea.Cantidad = int.Parse(dgvListado.Rows[i].Cells["Cantidad"].Value.ToString()); linea.Eliminado = false; linea.Identifier = Guid.NewGuid(); linea.PrecioVenta = Convert.ToDecimal(dgvListado.Rows[i].Cells["Unitario"].Value.ToString().Replace("$", "")); linea.ProductoId = (int)dgvListado.Rows[i].Cells["productoId"].Value; linea.Costo = dgvListado.Rows[i].Cells["Costo"].Value == null ? 0 : Convert.ToDecimal(dgvListado.Rows[i].Cells["Costo"].Value.ToString().Replace("$", "")); linea.FechaUltimaModificacion = DateTime.Now; linea.Orden = i + 1; linea.Desincronizado = true; linea.StockDestino = Convert.ToDecimal(dgvListado.Rows[i].Cells["StockActual"].Value.ToString()); linea.Identifier = Guid.Parse(dgvListado.Rows[i].Cells["Identifier"].Value.ToString()); linea.TransferenciaProductoId = Convert.ToInt32(dgvListado.Rows[i].Cells["TransferenciaProductoId"].Value.ToString()); lineas.Add(linea); } if (_operacion == "Crear") { var transferencia = new Transferencia { FechaCreacion = DateTime.Now, Identifier = Guid.NewGuid(), Eliminado = false, TransferenciaProductos = lineas, AutoNumero = _autoNumero, Desincronizado = true, DestinoId = AppSettings.MaxiKioscoId, FechaAprobacion = null, OrigenId = Origen.MaxiKioscoId, UsuarioId = UsuarioActual.UsuarioId }; Repository.Agregar(transferencia); } else { //Transferencia.TransferenciaProductos = lineas; var trans = Repository.Obtener(t => t.TransferenciaId == Transferencia.TransferenciaId, t => t.TransferenciaProductos); var originales = trans.TransferenciaProductos.Where(tp => !tp.Eliminado); var paraEliminar = originales.Select(o => o.TransferenciaProductoId).ToList(); var i = 1; foreach (var tp in lineas) { tp.Orden = i; if (tp.TransferenciaProductoId == 0) { tp.TransferenciaId = Transferencia.TransferenciaId; TransferenciaProductoRepository.Agregar(tp); } else { var original = originales.FirstOrDefault(o => tp.TransferenciaProductoId == o.TransferenciaProductoId); if (original != null) { original.Cantidad = tp.Cantidad; original.PrecioVenta = tp.PrecioVenta; original.ProductoId = tp.ProductoId; original.StockDestino = tp.StockDestino; original.StockOrigen = tp.StockOrigen; TransferenciaProductoRepository.Modificar(original); paraEliminar.Remove(original.TransferenciaProductoId); } } i++; } foreach (var id in paraEliminar) { TransferenciaProductoRepository.Eliminar(id); } trans.OrigenId = Transferencia.OrigenId; trans.DestinoId = Transferencia.DestinoId; trans.FechaUltimaModificacion = DateTime.Now; trans.Desincronizado = true; } Repository.Commit(); this.Close(); } } } }