Пример #1
0
        private void btnGuardarPedido_Click(object sender, EventArgs e)
        {
            try
            {
                int    idclienteorigen  = Convert.ToInt32((cboClienteO.SelectedItem as ComboboxItem).Value);
                int    idclientedestino = Convert.ToInt32((cboClienteD.SelectedItem as ComboboxItem).Value);
                string delivery         = txtDelivery.Text;
                double peso             = Convert.ToDouble(txtPeso.Text);
                double piezas           = Convert.ToDouble(txtPiezas.Text);
                string estatus          = "ACTIVO";
                Pedido pedido           = new Pedido(idclienteorigen, idclientedestino, delivery, peso, piezas, estatus);

                if (Accion == "ALTA")
                {
                    FormInicio.GuardaPedido(pedido);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaPedido(pedido);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaPedido(pedido);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }