SIAQ.BusinessProcess.Object.BPMedioComunicacion.searchcatMedioComunicacion C# (CSharp) Method

searchcatMedioComunicacion() public method

Metodo para obtener las catMedioComunicacion del sistema
BPcatMedioComunicacion.searchcatMedioComunicacion 27/ene/2014 Generador
public searchcatMedioComunicacion ( ENTMedioComunicacion entMedioComunicacion ) : ENTResponse
entMedioComunicacion SIAQ.Entity.Object.ENTMedioComunicacion
return SIAQ.Entity.Object.ENTResponse
        public ENTResponse searchcatMedioComunicacion(ENTMedioComunicacion entMedioComunicacion)
        {
            ENTResponse oENTResponse = new ENTResponse();
            try
            {
                // Consulta a base de datos
                DAMedioComunicacion datacatMedioComunicacion = new DAMedioComunicacion();
                oENTResponse = datacatMedioComunicacion.searchcatMedioComunicacion(entMedioComunicacion);
                // 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

        void SelectMedioComunicacion()
        {
            BPMedioComunicacion oBPMedioComunicacion = new BPMedioComunicacion();
            ENTResponse oENTResponse = new ENTResponse();
            ENTMedioComunicacion oENTMedioComunicacion = new ENTMedioComunicacion();

            try
            {

                //Transacción
                oENTResponse = oBPMedioComunicacion.searchcatMedioComunicacion(oENTMedioComunicacion);

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

                // Bind
                this.ddlMedioComunicacion.DataTextField = "Nombre";
                this.ddlMedioComunicacion.DataValueField = "MedioComunicacionId";
                this.ddlMedioComunicacion.DataSource = oENTResponse.dsResponse.Tables[1];
                this.ddlMedioComunicacion.DataBind();

                // Item extra
                this.ddlMedioComunicacion.Items.Insert(0, new ListItem("[Seleccione]", "0"));

            }catch (Exception ex){
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + gcJavascript.ClearText(ex.Message) + "');", true);
            }
        }