SIAQ.BusinessProcess.Object.BPLugarDiligencia.insertLugarDiligencia C# (CSharp) Method

insertLugarDiligencia() public method

Metodo para insertar LugarDiligencia del sistema
BPLugarDiligencia.insertLugarDiligencia 27/ene/2014 Generador
public insertLugarDiligencia ( ENTLugarDiligencia oENTLugarDiligencia ) : ENTResponse
oENTLugarDiligencia SIAQ.Entity.Object.ENTLugarDiligencia
return SIAQ.Entity.Object.ENTResponse
        public ENTResponse insertLugarDiligencia(ENTLugarDiligencia oENTLugarDiligencia)
        {
            ENTResponse oENTResponse = new ENTResponse();
            try
            {
                // Consulta a base de datos
                DALugarDiligencia oDALugarDiligencia = new DALugarDiligencia();
                oENTResponse = oDALugarDiligencia.insertLugarDiligencia(oENTLugarDiligencia);
                // 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 insertLugarDiligencia()
        {
            BPLugarDiligencia oBPLugarDiligencia = new BPLugarDiligencia();
            ENTLugarDiligencia oENTLugarDiligencia = new ENTLugarDiligencia();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formilario
                oENTLugarDiligencia.Nombre = this.txtActionNombre.Text.Trim();
                oENTLugarDiligencia.Descripcion = this.txtActionDescripcion.Text.Trim();

                // Transacción
                oENTResponse = oBPLugarDiligencia.insertLugarDiligencia(oENTLugarDiligencia);

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

                // Transacción exitosa
                ClearActionPanel();

                // Actualizar Grid
                selectLugarDiligencia();

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

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