コード例 #1
0
        public void Guardar()
        {
            try
            {
                string  numDocFactu = "";
                decimal id          = 0;
                string  ms          = "";
                if (txtCodigo.Text != "")
                {
                    if (Bus.VerificarCodigo(txtCodigo.Text, param.IdEmpresa))
                    {
                        MessageBox.Show("El código Ingresado Ya existe por favor ingrese uno diferente", param.Nombre_sistema);
                        return;
                    }
                }

                if (Validar())
                {
                    _Info.IdUsuario     = param.IdUsuario;
                    _Info.ip            = param.ip;
                    _Info.nom_pc        = param.nom_pc;
                    _Info.Fecha_Transac = DateTime.Now;

                    if (Bus.GrabarDB(_Info, ref id, ref numDocFactu, ref ms))
                    {
                        txtIdGuia.Text           = id.ToString();
                        btnGuardar.Enabled       = false;
                        btnguardarYsalir.Enabled = false;
                        ctrl_Cliente.Enabled     = false;
                        ctrl_SucBod.Enabled      = false;
                        if (txtCodigo.Text == "")
                        {
                            txtCodigo.Text         = "GUIR" + txtIdGuia.Text;
                            btnImprimirDoc.Enabled = true;
                        }
                        if (MessageBox.Show("Guía de Remisión # " + id + " Ingresada con éxito." + "\n" + "¿Desea Imprimir la Guía Remisión N° " + id + "?", "Imprimir", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            btnImprimir_Click(new Object(), new EventArgs());
                        }
                        _Accion = Cl_Enumeradores.eTipo_action.actualizar;
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }