SIAQ.BusinessProcess.Object.BPPais.insertcatPais C# (CSharp) Method

insertcatPais() public method

Metodo para insertar catPais del sistema
BPcatPaisinsertcatPais 27/ene/2014 Generador
public insertcatPais ( ENTPais entPais ) : ENTResponse
entPais SIAQ.Entity.Object.ENTPais
return SIAQ.Entity.Object.ENTResponse
        public ENTResponse insertcatPais(ENTPais entPais)
        {
            ENTResponse oENTResponse = new ENTResponse();
            try
            {
                // Consulta a base de datos
                DAPais datacatPais = new DAPais();
                oENTResponse = datacatPais.insertcatPais(entPais);
                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }
                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }
            }
            catch (Exception ex)
            {
                oENTResponse.ExceptionRaised(ex.Message);
            }
            // Resultado
            return oENTResponse;
        }

Usage Example

Example #1
0
        private void InsertPais()
        {
            BPPais oBPPais = new BPPais();
            ENTPais oENTPais = new ENTPais();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTPais.Nombre = this.txtActionNombre.Text.Trim();
                oENTPais.Descripcion = this.txtActionDescripcion.Text.Trim();
                oENTPais.Activo = Int16.Parse(this.ddlActionStatus.SelectedItem.Value);

                // Transacción
                oENTResponse = oBPPais.insertcatPais(oENTPais);

                // Validaciones
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Transacción exitosa
                ClearActionPanel();

                // Actualizar grid
                selectPais();

                // Mensaje de usuario
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('País creado con éxito!'); focusControl('" + this.txtNombre.ClientID + "');", true);

            }
            catch (Exception ex) { throw (ex); }
        }