///<remarks> /// <name>BPMotivo.searchcatMotivo</name> /// <create>27/ene/2014 </create> /// <author>Generador</author> ///</remarks> ///<summary>Metodo para obtener las Motivo del sistema</summary> public ENTResponse searchcatMotivo(ENTMotivo oENTMotivo) { ENTResponse oENTResponse = new ENTResponse(); try { // Consulta a base de datos DAMotivo oDAMotivo = new DAMotivo(); oENTResponse = oDAMotivo.searchcatMotivo(oENTMotivo, sConnectionApplication); // 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; }
///<remarks> /// <name>DAMotivo.insertcatMedioComunicacion</name> /// <create>05/Junio/2014</create> /// <author>Danie.Chavez</author> ///</remarks> ///<summary>Metodo para insertar DAMotivo del sistema</summary> public ENTResponse insertMotivo(ENTMotivo oENTMotivo) { ENTResponse oENTResponse = new ENTResponse(); DataSet ds = new DataSet(); // Transacción try { ds = dbs.ExecuteDataSet("uspcatMotivo_Ins", oENTMotivo.Descripcion, oENTMotivo.Nombre); oENTResponse.dsResponse = ds; } catch (SqlException sqlEx) { oENTResponse.ExceptionRaised(sqlEx.Message); } catch (Exception ex) { oENTResponse.ExceptionRaised(ex.Message); } finally { } // Resultado return oENTResponse; }
///<remarks> /// <name>DAMotivo.deleteMotivo</name> /// <create>27/ene/2014</create> /// <author>Generador</author> ///</remarks> ///<summary>Metodo para eliminar de deleteMotivo del sistema</summary> public ENTResponse deletecatMedioComunicacion(ENTMotivo oENTMotivo) { ENTResponse oENTResponse = new ENTResponse(); DataSet ds = new DataSet(); // Transacción try { ds = dbs.ExecuteDataSet("catMedioComunicacionDel"); oENTResponse.dsResponse = ds; } catch (SqlException sqlEx) { oENTResponse.ExceptionRaised(sqlEx.Message); } catch (Exception ex) { oENTResponse.ExceptionRaised(ex.Message); } finally { } // Resultado return oENTResponse; }
///<remarks> /// <name>DAMotivo.insertMotivo</name> /// <create>05/Junio/2014</create> /// <author>Danie.Chavez</author> ///</remarks> ///<summary>Metodo para obtener las DAMotivo del sistema</summary> public DataSet SelectMotivo(ENTMotivo ENTMotivo, string ConnectionString) { DataSet ResultData = new DataSet(); SqlConnection Connection = new SqlConnection(ConnectionString); SqlCommand Command; SqlParameter Parameter; SqlDataAdapter DataAdapter; try { Command = new SqlCommand("uspcatMotivo_Sel", Connection); Command.CommandType = CommandType.StoredProcedure; Parameter = new SqlParameter("MotivoId", SqlDbType.Int); Parameter.Value = ENTMotivo.MotivoId; Command.Parameters.Add(Parameter); Parameter = new SqlParameter("Nombre", SqlDbType.VarChar); Parameter.Value = ENTMotivo.Nombre; Command.Parameters.Add(Parameter); DataAdapter = new SqlDataAdapter(Command); ResultData = new DataSet(); Connection.Open(); DataAdapter.Fill(ResultData); Connection.Close(); return ResultData; } catch (SqlException Exception) { _ErrorId = Exception.Number; _ErrorDescription = Exception.Message; if (Connection.State == ConnectionState.Open) Connection.Close(); return ResultData; } }
///<remarks> /// <name>DAMotivo.searchcatMotivo</name> /// <create>05/Junio/2014</create> /// <author>Danie.Chavez</author> ///</remarks> ///<summary>Metodo para obtener las DAMotivo del sistema</summary> public ENTResponse searchcatMotivo(ENTMotivo ENTMotivo, string ConnectionString) { SqlConnection sqlCnn = new SqlConnection(ConnectionString); SqlCommand sqlCom; SqlParameter sqlPar; SqlDataAdapter sqlAdapter; ENTResponse oENTResponse = new ENTResponse(); try { sqlCom = new SqlCommand("uspcatMotivo_Sel", sqlCnn); sqlCom.CommandType = CommandType.StoredProcedure; sqlPar = new SqlParameter("MotivoId", SqlDbType.Int); sqlPar.Value = ENTMotivo.MotivoId; sqlCom.Parameters.Add(sqlPar); sqlPar = new SqlParameter("Nombre", SqlDbType.VarChar); sqlPar.Value = ENTMotivo.Nombre; sqlCom.Parameters.Add(sqlPar); sqlAdapter = new SqlDataAdapter(sqlCom); oENTResponse.dsResponse = new DataSet(); sqlCnn.Open(); sqlAdapter.Fill(oENTResponse.dsResponse); sqlCnn.Close(); } catch (SqlException sqlEX) { oENTResponse.ExceptionRaised(sqlEX.Message); } catch (Exception ex) { oENTResponse.ExceptionRaised(ex.Message); } finally { if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); } sqlCnn.Dispose(); } return oENTResponse; }
public BPMotivo() { _MotivoEntity = new ENTMotivo(); }
private void updateMotivo(Int32 MotivoId) { BPMotivo oBPMotivo = new BPMotivo(); ENTMotivo oENTMotivo = new ENTMotivo(); ENTResponse oENTResponse = new ENTResponse(); try { // Formulario oENTMotivo.MotivoId = MotivoId; oENTMotivo.Nombre = this.txtActionNombre.Text.Trim(); oENTMotivo.Descripcion = this.txtActionDescripcion.Text.Trim(); // Transacción oENTResponse = oBPMotivo.updateMotivo(oENTMotivo); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Transacción exitosa ClearActionPanel(); // Actualizar grid selectMotivo(); // 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); } }
private void selectMotivo_ForEdit(Int32 MotivoId) { BPMotivo oBPMotivo = new BPMotivo(); ENTMotivo oENTMotivo = new ENTMotivo(); ENTResponse oENTResponse = new ENTResponse(); try { // Formulario oENTMotivo.MotivoId = MotivoId; oENTMotivo.Nombre = this.txtActionNombre.Text.Trim(); // Transacción oENTResponse = oBPMotivo.searchcatMotivo(oENTMotivo); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } this.lblActionMessage.Text = oENTResponse.sMessage; // Llenado de controles this.txtActionNombre.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["Nombre"].ToString(); this.txtActionDescripcion.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["Descripcion"].ToString(); } catch (Exception ex) { throw (ex); } }
private void selectMotivo() { BPMotivo oBPMotivo = new BPMotivo(); ENTMotivo oENTMotivo = new ENTMotivo(); ENTResponse oENTResponse = new ENTResponse(); String sMessage = ""; try { // Formulario oENTMotivo.Nombre = this.txtNombre.Text.Trim(); // Transacción oENTResponse = oBPMotivo.searchcatMotivo(oENTMotivo); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { sMessage = "alert('" + oENTResponse.sMessage + "');"; } // Llenado de controles this.gvMotivo.DataSource = oENTResponse.dsResponse.Tables[1]; this.gvMotivo.DataBind(); // Mensaje al usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), sMessage, true); } catch (Exception ex) { throw (ex); } }