private void DgvInsumos_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvInsumos.Enabled)
         {
             string rpta = "";
             int    fila = this.dgvInsumos.CurrentRow.Cells[0].RowIndex;
             if (this.agregarInsumos != null)
             {
                 this.agregarInsumos.ObtenerDatos(DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                 this.Close();
             }
             else if (this.detallePlato != null)
             {
                 this.detallePlato.DatosInsumos(DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
             }
         }
     }
     catch (Exception ex)
     {
         Mensajes.MensajeErrorCompleto(this.Name, "DgvInsumos_DoubleClick",
                                       "Hubo un error con la tabla de datos", ex.Message);
     }
 }
Exemple #2
0
        private void CastForm_ondgvDoubleClick(object sender, EventArgs e)
        {
            foreach (Form formulario in this.formsAbiertos)
            {
                if (formulario is FrmAgregarProveedor castForm)
                {
                    castForm.IsEditar = true;
                    castForm.AsignarDatos(DatagridString.ReturnValuesOfCells(sender, 0));
                    castForm.WindowState = FormWindowState.Normal;
                    castForm.Show();
                    castForm.Activate();
                    return;
                }
            }

            FrmAgregarProveedor form = new FrmAgregarProveedor
            {
                StartPosition = FormStartPosition.CenterScreen,
                Name          = "FrmAgregarProveedor",
                IsEditar      = true
            };

            form.AsignarDatos(DatagridString.ReturnValuesOfCells(sender, 0));
            form.FormClosed += Frm_FormClosed;
            form.Show();
            Form frm = (Form)form;

            this.formsAbiertos.Add(frm);
        }
Exemple #3
0
        private void DgvPlatos_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow row = this.dgvPlatos.CurrentRow;
                if (this.dgvPlatos.Enabled && this.dgvPlatos.Focused && row != null)
                {
                    string rpta = "OK";
                    int    fila = this.dgvPlatos.CurrentRow.Cells[0].RowIndex;
                    if (this.FrmAgregarPlato != null)
                    {
                        this.FrmAgregarPlato.ObtenerDatos
                            (DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                    }
                    else if (this.agregarDetallePlato != null)
                    {
                        this.agregarDetallePlato.ObtenerDatosPlato
                            (DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                    }
                    else if (this.InactivarPlatos)
                    {
                        Mensajes.MensajePregunta("¿Seguro desea inactivar el plato?",
                                                 "Continuar", "Cancelar", out DialogResult dialog);
                        if (dialog == DialogResult.Yes)
                        {
                            int id_plato = Convert.ToInt32(row.Cells["Id_plato"].Value);
                            rpta = NPlatos.InactivarPlato(id_plato);
                            if (rpta.Equals("OK"))
                            {
                                Mensajes.MensajeOkForm("Se inactivó el plato correctamente");
                                this.BuscarPlatos("COMPLETO", "");
                                return;
                            }
                            else
                            {
                                throw new Exception(rpta);
                            }
                        }
                    }

                    if (rpta.Equals("OK"))
                    {
                        this.Close();
                    }
                    else
                    {
                        throw new Exception(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "DgvPlatos_DoubleClick",
                                              "Hubo un error con la tabla de datos", ex.Message);
            }
        }
Exemple #4
0
        private void DgvEmpleados_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvEmpleados.Enabled)
                {
                    int    fila = this.dgvEmpleados.CurrentRow.Cells[0].RowIndex;
                    string rpta = "SIN ACCION";
                    if (this.FrmAgregarEmpleado != null)
                    {
                        rpta = "";
                        this.FrmAgregarEmpleado.ObtenerDatos
                            (DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                    }
                    else if (this.venta)
                    {
                        rpta              = "";
                        this.Tag          = DatagridString.ReturnValuesOfCells(sender, fila, out rpta);
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else if (this.facturar_pedido)
                    {
                        rpta              = "";
                        this.Tag          = DatagridString.ReturnValuesOfCells(sender, fila, out rpta);
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }

                    if (this.OnDataRow != null)
                    {
                        this.OnDataRow?.Invoke(dgvEmpleados.CurrentRow, e);
                        this.Close();
                    }

                    if (rpta.Equals("OK"))
                    {
                        this.Close();
                    }
                    else if (!rpta.Equals("SIN ACCION"))
                    {
                        throw new Exception(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "DgvEmpleados_DoubleClick",
                                              "Hubo un error con la tabla de datos", ex.Message);
            }
        }
Exemple #5
0
        private Cliente GetCliente(object row)
        {
            Cliente       cliente = new Cliente();
            List <string> vs      = DatagridString.ReturnValuesOfCells(row, 0);

            foreach (string ca in vs)
            {
                cliente.Id_cliente    = Convert.ToInt32(vs[0]);
                cliente.Fecha_ingreso = Convert.ToDateTime(vs[1]);
                cliente.Nombre        = Convert.ToString(vs[2]);
                cliente.Telefono      = Convert.ToString(vs[3]);
                cliente.Correo        = Convert.ToString(vs[4]);
            }
            return(cliente);
        }
Exemple #6
0
        private void DgvClientes_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow row = this.dgvClientes.CurrentRow;
                if (this.dgvClientes.Enabled & row != null)
                {
                    string rpta = "OK";
                    int    fila = this.dgvClientes.CurrentRow.Cells[0].RowIndex;
                    if (this.FrmAgregarCliente != null)
                    {
                        this.FrmAgregarCliente.ObtenerDatos
                            (DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                        this.Close();
                    }
                    else if (this.menuPedido != null)
                    {
                        this.menuPedido.ObtenerCliente
                            (DatagridString.ReturnValuesOfCells(sender, fila, out rpta));
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else if (this.venta)
                    {
                        rpta = "OK";
                        this.DialogResult = DialogResult.OK;
                        this.Tag          = DatagridString.ReturnValuesOfCells(sender, fila, out rpta);
                    }

                    this.OnDgvDoubleClick?.Invoke(row, e);

                    if (rpta.Equals("OK"))
                    {
                        this.Close();
                    }
                    else
                    {
                        throw new Exception(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "DgvClientes_DoubleClick",
                                              "Hubo un error con la tabla de datos", ex.Message);
            }
        }
        private void DatosUsuario_Load(object sender, EventArgs e)
        {
            DataTable table = NClientes.BuscarClientes("ID CLIENTE", this.Id_cliente.ToString());

            if (table != null)
            {
                string rpta;
                if (this.panel1.Controls.Count > 0)
                {
                    this.panel1.Controls.RemoveAt(0);
                }
                FrmAgregarCliente Frm = new FrmAgregarCliente();
                Frm.ObtenerDatos(DatagridString.ReturnValuesOfCells(table, 0, out rpta));
                Frm.TopLevel        = false;
                Frm.IsPedido        = true;
                Frm.onChangedEmail += Frm_onChangedEmail;
                Frm.FormBorderStyle = FormBorderStyle.None;
                Frm.Dock            = DockStyle.Fill;
                this.panel1.Controls.Add(Frm);
                this.panel1.Tag = Frm;
                Frm.Show();
            }
        }
        private void FrmRealizarPedido_Load(object sender, EventArgs e)
        {
            DialogResult dialog = this.Comprobacion();

            if (dialog == DialogResult.OK)
            {
                this.comandas.ObtenerReporte();

                this.lblMistico.Text =
                    "Realizar un nuevo pedido para la mesa " + this.Numero_mesa;
                if (this.IsEditar)
                {
                    try
                    {
                        string    rpta;
                        DataTable dtDetalle;
                        DataTable dtPedido =
                            NPedido.BuscarPedidosYDetalle("ID PEDIDO", this.Id_pedido.ToString(), out dtDetalle, out rpta);
                        if (dtPedido != null)
                        {
                            this.lblMesero.Text = "Mesero: " + Convert.ToString(dtPedido.Rows[0]["Nombre_empleado"]);
                            //Recorrer las tablas de pedido y detalle y crear las Listas
                            this.tablasPedido = new TablasPedido(this.IsEditar, this.Id_pedido, dtDetalle);
                            DataTable dtCliente =
                                NClientes.BuscarClientes("ID CLIENTE", Convert.ToString(dtPedido.Rows[0]["Id_cliente"]));
                            if (dtCliente != null)
                            {
                                this.contextMenuDatosPedido.ObtenerCliente(DatagridString.ReturnValuesOfCells(dtCliente, 0, out rpta));
                            }
                            else
                            {
                                throw new Exception("No se encontró el cliente");
                            }
                            Label lbl1 = new Label();
                            lbl1.AutoSize = true;
                            lbl1.Location = new System.Drawing.Point(this.dgvProductos.Location.X,
                                                                     this.panelProductosParaAgregar.Location.Y + this.panelProductosParaAgregar.Height);
                            this.Controls.Add(lbl1);
                            this.chkImprimirComandas.Visible = true;
                            this.chkImprimirComandas.Checked = true;

                            this.panelProductosParaAgregar.Visible = true;
                            this.dgvProductos.Location             = new System.Drawing.Point(this.dgvProductos.Location.X,
                                                                                              this.panelProductosParaAgregar.Location.Y + this.panelProductosParaAgregar.Height + lbl1.Height);
                            this.dgvProductos =
                                ConfiguracionDatagridview.ConfigurationGrid(this.dgvProductos);
                            this.dgvProductosEditar =
                                ConfiguracionDatagridview.ConfigurationGrid(this.dgvProductosEditar);
                            this.btnQuitar.Location =
                                new System.Drawing.Point(this.dgvProductos.Location.X - this.btnQuitarProductosEditado.Width - 2, this.dgvProductos.Location.Y);
                            this.btnQuitarProductosEditado.Visible = true;
                        }
                        else
                        {
                            throw new Exception(rpta);
                        }
                    }
                    catch (Exception ex)
                    {
                        Mensajes.MensajeErrorCompleto("TablasPedido.cs", "TablasPedido(bool isEditar, int id_pedido)",
                                                      "Hubo un error al inicializar las tablas del pedido para editar", ex.Message);
                    }
                    this.ActualizarProductos();
                }
                else
                {
                    this.panelProductosParaAgregar.Visible = false;
                    this.btnQuitarProductosEditado.Visible = false;
                    this.dgvProductos =
                        ConfiguracionDatagridview.ConfigurationGrid(this.dgvProductos);
                    this.tablasPedido = new TablasPedido();
                }
            }
            else
            {
                this.Close();
            }
        }