SIAQ.BusinessProcess.Object.BPMedioComunicacion.updatecatMedioComunicacion C# (CSharp) Méthode

updatecatMedioComunicacion() public méthode

Metodo que actualiza catMedioComunicacion del sistema
BPcatMedioComunicacionupdatecatMedioComunicacion 27/ene/2014 Generador
public updatecatMedioComunicacion ( ENTMedioComunicacion entMedioComunicacion ) : ENTResponse
entMedioComunicacion SIAQ.Entity.Object.ENTMedioComunicacion
Résultat SIAQ.Entity.Object.ENTResponse
        public ENTResponse updatecatMedioComunicacion(ENTMedioComunicacion entMedioComunicacion)
        {
            ENTResponse oENTResponse = new ENTResponse();
            try
            {
                // Consulta a base de datos
                DAMedioComunicacion datacatMedioComunicacion = new DAMedioComunicacion();
                oENTResponse = datacatMedioComunicacion.updatecatMedioComunicacion(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

        private void updateMedioComunicacion(Int32 MedioComunicacionId)
        {
            BPMedioComunicacion oBPMedioComunicacion = new BPMedioComunicacion();
            ENTMedioComunicacion oENTMedioComunicacion = new ENTMedioComunicacion();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTMedioComunicacion.MedioComunicacionId = MedioComunicacionId;
                oENTMedioComunicacion.Nombre = this.txtActionNombre.Text.Trim();
                oENTMedioComunicacion.Descripcion = this.txtActionDescripcion.Text.Trim();

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

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

                // Transacción exitosa
                ClearActionPanel();

                // Actualizar grid
                selectMedioComunicacion();

                // Mensaje de usuario
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Información actualizada con éxito!'); focusControl('" + this.txtNombre.ClientID + "');", true);

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