///<remarks> /// <name>DAFuncionario.DeleteFuncionario</name> /// <create>06-Abril-2014</create> /// <author>Ruben.Cobos</author> ///</remarks> ///<summary>Elimina un Funcionario liberando la asociación del usuario. El usuario no se elimina</summary> ///<param name="oENTFuncionario">Entidad de Funcionario con los parámetros necesarios para crear el registro</param> ///<param name="sConnection">Cadena de conexión a la base de datos</param> ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param> ///<returns>Una entidad de respuesta</returns> public ENTResponse DeleteFuncionario(ENTFuncionario oENTFuncionario, String sConnection, Int32 iAlternateDBTimeout) { SqlConnection sqlCnn = new SqlConnection(sConnection); SqlCommand sqlCom; SqlParameter sqlPar; SqlDataAdapter sqlDA; ENTResponse oENTResponse = new ENTResponse(); // Configuración de objetos sqlCom = new SqlCommand("uspcatFuncionario_Del", sqlCnn); sqlCom.CommandType = CommandType.StoredProcedure; // Timeout alternativo en caso de ser solicitado if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; } // Parametros sqlPar = new SqlParameter("FuncionarioId", SqlDbType.Int); sqlPar.Value = oENTFuncionario.FuncionarioId; sqlCom.Parameters.Add(sqlPar); // Inicializaciones oENTResponse.dsResponse = new DataSet(); sqlDA = new SqlDataAdapter(sqlCom); // Transacción try { sqlCnn.Open(); sqlDA.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(); } // Resultado return oENTResponse; }
///<remarks> /// <name>BPFuncionario.DeleteFuncionario</name> /// <create>06-Abril-2014</create> /// <author>Ruben.Cobos</author> ///</remarks> ///<summary>Elimina un Funcionario liberando la asociación del usuario. El usuario no se elimina</summary> ///<param name="oENTFuncionario">Entidad de Funcionario con los parámetros necesarios para actualizar su información</param> ///<returns>Una entidad de respuesta</returns> public ENTResponse DeleteFuncionario(ENTFuncionario oENTFuncionario) { DAFuncionario oDAFuncionario = new DAFuncionario(); ENTResponse oENTResponse = new ENTResponse(); try{ // Transacción en base de datos oENTResponse = oDAFuncionario.DeleteFuncionario(oENTFuncionario, this.sConnectionApplication, 0); // 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; }
void SelectDoctor() { BPFuncionario oBPFuncionario = new BPFuncionario(); ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); try { // Formulario oENTFuncionario.FuncionarioId = 0; oENTFuncionario.idUsuario = 0; oENTFuncionario.idArea = 0; oENTFuncionario.idRol = 14; // Atención a Víctimas - Doctor oENTFuncionario.TituloId = 0; oENTFuncionario.PuestoId = 0; oENTFuncionario.Nombre = ""; // Transacción oENTResponse = oBPFuncionario.SelectFuncionario(oENTFuncionario); // Errores if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Warnings if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); } // Llenado de control this.ddlDoctor.DataTextField = "sFullName"; this.ddlDoctor.DataValueField = "FuncionarioId"; this.ddlDoctor.DataSource = oENTResponse.dsResponse.Tables[1]; this.ddlDoctor.DataBind(); // Opción todos this.ddlDoctor.Items.Insert(0, new ListItem("[Seleccione]", "0")); }catch (Exception ex){ throw (ex); } }
void SelectFuncionario() { ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario oBPFuncionario = new BPFuncionario(); try { // Formulario oENTFuncionario.FuncionarioId = 0; oENTFuncionario.idUsuario = 0; oENTFuncionario.idArea = 0; oENTFuncionario.idRol = 11; // Seguimiento - Defensor oENTFuncionario.TituloId = 0; oENTFuncionario.PuestoId = 0; oENTFuncionario.Nombre = ""; // Transacción oENTResponse = oBPFuncionario.SelectFuncionario(oENTFuncionario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + gcJavascript.ClearText(oENTResponse.sMessage) + "');", true); } // Llenado de combo this.ddlFuncionario.DataTextField = "sFullName"; this.ddlFuncionario.DataValueField = "FuncionarioId"; this.ddlFuncionario.DataSource = oENTResponse.dsResponse.Tables[1]; this.ddlFuncionario.DataBind(); // Agregar Item de selección this.ddlFuncionario.Items.Insert(0, new ListItem("[Seleccione]", "0")); }catch (Exception ex){ throw (ex); } }
void SelectFuncionario() { ENTFuncionario oENTFuncionario = new ENTFuncionario(); BPFuncionario BPFuncionario = new BPFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario.SelectFuncionarioBusqueda(); ddlFuncionario.DataValueField = "FuncionarioId"; ddlFuncionario.DataTextField = "Nombre"; ddlFuncionario.DataSource = BPFuncionario.FuncionarioEntity.ResultData.Tables[1]; ddlFuncionario.DataBind(); ddlFuncionario.Items.Insert(0, new ListItem("[Todos]", "0")); }
///<remarks> /// <name>DAFuncionario.SelectFuncionarioVistaduria</name> /// <create>30/mar/2014</create> /// <author>Jose.Gomez</author> ///</remarks> ///<summary>Obtiene el listado de los funcionarios del área de visitadurias</summary> public DataSet SelectFuncionarioVistaduria(ENTFuncionario oENTFuncionario, string sConnectionString) { SqlConnection Connection = new SqlConnection(sConnectionString); SqlCommand Command; SqlDataAdapter DataAdapter; DataSet ds = new DataSet(); try { Command = new SqlCommand("spExpedienteFuncionarioVisitaduria_sel", Connection); Command.CommandType = CommandType.StoredProcedure; DataAdapter = new SqlDataAdapter(Command); Connection.Open(); DataAdapter.Fill(ds); Connection.Close(); return ds; } catch (SqlException ex) { _ErrorId = ex.Number; _ErrorDescription = ex.Message; if (Connection.State == ConnectionState.Open) { Connection.Close(); } return ds; } }
private void UpdateFuncionario(Int32 idFuncionario) { ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario oBPFuncionario = new BPFuncionario(); try { // Formulario oENTFuncionario.FuncionarioId = idFuncionario; oENTFuncionario.idUsuario = this.wucBusquedaUsuario.UsuarioID; oENTFuncionario.TituloId = Int16.Parse(this.ddlActionTitulo.SelectedValue); oENTFuncionario.PuestoId = Int16.Parse(this.ddlActionPuesto.SelectedValue); oENTFuncionario.FechaIngreso = this.wucCalendar.BeginDate; // Transacción oENTResponse = oBPFuncionario.UpdateFuncionario(oENTFuncionario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Transacción exitosa ClearActionPanel(); // Actualizar grid SelectFuncionario(); // Mensaje de usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Información actualizada con éxito!'); focusControl('" + this.ddlArea.ClientID + "');", true); }catch (Exception ex){ throw (ex); } }
private void SelectFuncionario_ForEdit(Int32 idFuncionario) { ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario oBPFuncionario = new BPFuncionario(); try { // Formulario oENTFuncionario.FuncionarioId = idFuncionario; oENTFuncionario.idUsuario = 0; oENTFuncionario.idArea = 0; oENTFuncionario.TituloId = 0; oENTFuncionario.PuestoId = 0; oENTFuncionario.Nombre = ""; // Transacción oENTResponse = oBPFuncionario.SelectFuncionario(oENTFuncionario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD this.lblActionMessage.Text = oENTResponse.sMessage; // Llenado de formulario this.ddlActionPuesto.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["PuestoId"].ToString(); this.ddlActionTitulo.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["TituloId"].ToString(); this.wucBusquedaUsuario.UsuarioID = Int32.Parse(oENTResponse.dsResponse.Tables[1].Rows[0]["idUsuario"].ToString()); this.wucBusquedaUsuario.Area = oENTResponse.dsResponse.Tables[1].Rows[0]["sArea"].ToString(); this.wucCalendar.SetDate = oENTResponse.dsResponse.Tables[1].Rows[0]["dtFechaIngreso"].ToString(); }catch (Exception ex){ throw (ex); } }
private void SelectFuncionario() { ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario oBPFuncionario = new BPFuncionario(); String sMessage = ""; try { // Formulario oENTFuncionario.FuncionarioId = 0; oENTFuncionario.idUsuario = 0; oENTFuncionario.idArea = Int32.Parse(this.ddlArea.SelectedItem.Value); oENTFuncionario.TituloId = 0; oENTFuncionario.PuestoId = 0; oENTFuncionario.Nombre = this.txtNombre.Text; // Transacción oENTResponse = oBPFuncionario.SelectFuncionario(oENTFuncionario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD if (oENTResponse.sMessage != "") { sMessage = "alert('" + oENTResponse.sMessage + "');"; } // Llenado de controles this.gvFuncionario.DataSource = oENTResponse.dsResponse.Tables[1]; this.gvFuncionario.DataBind(); // Mensaje al usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), sMessage, true); }catch (Exception ex){ throw (ex); } }
private void DeleteFuncionario(Int32 idFuncionario) { ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); BPFuncionario oBPFuncionario = new BPFuncionario(); try { // Formulario oENTFuncionario.FuncionarioId = idFuncionario; // Transacción oENTResponse = oBPFuncionario.DeleteFuncionario(oENTFuncionario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Transacción exitosa ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Funcionario eliminado con éxito!');", true); // Actualizar datos SelectFuncionario(); }catch (Exception ex){ throw (ex); } }
public BPFuncionario() { _FuncionarioEntity = new ENTFuncionario(); }
void SelectFuncionario() { BPFuncionario oBPFuncionario = new BPFuncionario(); ENTFuncionario oENTFuncionario = new ENTFuncionario(); ENTResponse oENTResponse = new ENTResponse(); try { // Formulario oENTFuncionario.FuncionarioId = 0; oENTFuncionario.idUsuario = 0; oENTFuncionario.idRol = 8; // Visitaduría - Visitador oENTFuncionario.TituloId = 0; oENTFuncionario.PuestoId = 0; oENTFuncionario.Nombre = ""; // Si el área es coordinaci;on penitenciaria, se muestras los funcionarios de la tercer visitaduría oENTFuncionario.idArea = (this.hddAreaId.Value == "10" ? 6 : Int32.Parse(this.hddAreaId.Value)); // Transacción oENTResponse = oBPFuncionario.SelectFuncionario(oENTFuncionario); // Errores if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Warnings if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); } // Llenado de control this.ddlFuncionario.DataTextField = "sFullName"; this.ddlFuncionario.DataValueField = "FuncionarioId"; this.ddlFuncionario.DataSource = oENTResponse.dsResponse.Tables[1]; this.ddlFuncionario.DataBind(); // Opción todos this.ddlFuncionario.Items.Insert(0, new ListItem("[Seleccione]", "0")); }catch (Exception ex){ throw (ex); } }