public SelectUsuario ( |
||
oENTUsuario | Entidad de usuario con los filtros necesarios para la consulta | |
Résultat |
void SelectUsuario() { ENTUsuario oENTUsuario = new ENTUsuario(); ENTResponse oENTResponse = new ENTResponse(); BPUsuario oBPUsuario = new BPUsuario(); try { // Formulario oENTUsuario.idRol = 0; oENTUsuario.idArea = 0; oENTUsuario.sEmail = ""; oENTUsuario.sNombre = ""; oENTUsuario.tiActivo = 1; // Transacción oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario); // Errores y Warnings if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); } // Llenado de control this.ddlUsuario.DataTextField = "sFullName"; this.ddlUsuario.DataValueField = "idUsuario"; this.ddlUsuario.DataSource = oENTResponse.dsResponse.Tables[3]; this.ddlUsuario.DataBind(); // Opción todos this.ddlUsuario.Items.Insert(0, new ListItem("[Seleccione]", "0")); }catch (Exception ex){ throw (ex); } }
void InsertClimaLaboralUsuario_Local() { ENTUsuario oENTUsuario = new ENTUsuario(); ENTResponse oENTResponse = new ENTResponse(); BPUsuario oBPUsuario = new BPUsuario(); DataTable tblUsuario = null; DataRow rowUsuario = null; try { // Validaciones if (this.ddlUsuario.SelectedValue == "0") { throw new Exception("Es necesario seleccionar un Usuario"); } // Obtener el DataTable del grid tblUsuario = gcParse.GridViewToDataTable(this.gvUsuario, false); // Validación de que no se haya agregado el Usuario if (tblUsuario.Select("idUsuario='" + this.ddlUsuario.SelectedItem.Value + "'").Length > 0){ ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Ya ha seleccionado éste Usuario'); function pageLoad(){ focusControl('" + this.ddlUsuario.ClientID + "'); }", true); return; } // Formulario oENTUsuario.idRol = 0; oENTUsuario.idArea = 0; oENTUsuario.idUsuario = Int32.Parse(this.ddlUsuario.SelectedItem.Value); oENTUsuario.sEmail = ""; oENTUsuario.sNombre = ""; oENTUsuario.tiActivo = 1; // Transacción oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario); // Errores y Warnings if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Nuevo Item rowUsuario = tblUsuario.NewRow(); rowUsuario["idUsuario"] = oENTResponse.dsResponse.Tables[1].Rows[0]["idUsuario"]; rowUsuario["sFullName"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sFullName"]; rowUsuario["sArea"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sArea"]; rowUsuario["SexoNombre"] = oENTResponse.dsResponse.Tables[1].Rows[0]["SexoNombre"]; rowUsuario["sEmail"] = oENTResponse.dsResponse.Tables[1].Rows[0]["sEmail"]; tblUsuario.Rows.Add(rowUsuario); // Refrescar el Grid this.gvUsuario.DataSource = tblUsuario; this.gvUsuario.DataBind(); // Foco ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "focusControl('" + this.ddlUsuario.ClientID + "');", true); }catch (Exception ex){ throw (ex); } }
private void SelectUsuario() { ENTSession oENTSession; ENTUsuario oENTUsuario = new ENTUsuario(); ENTResponse oENTResponse = new ENTResponse(); BPUsuario oBPUsuario = new BPUsuario(); DataTable tblUsuario; String sMessage = ""; try { // Formulario oENTUsuario.idRol = Int32.Parse(this.ddlRol.SelectedItem.Value); oENTUsuario.idArea = Int32.Parse(this.ddlArea.SelectedItem.Value); oENTUsuario.sEmail = this.txtEmail.Text; oENTUsuario.sNombre = this.txtNombre.Text; oENTUsuario.tiActivo = Int16.Parse(this.ddlStatus.SelectedItem.Value); // Transacción oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD if (oENTResponse.sMessage != "") { sMessage = "alert('" + gcJavascript.ClearText(oENTResponse.sMessage) + "');"; } // Seguridad oENTSession = (ENTSession)this.Session["oENTSession"]; tblUsuario = (oENTSession.idRol != 1 ? deleteDataTableRow(oENTResponse.dsResponse.Tables[1], "idRol", "1") : oENTResponse.dsResponse.Tables[1]); // Llenado de controles this.gvUsuario.DataSource = tblUsuario; this.gvUsuario.DataBind(); // Mensaje al usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), sMessage, true); } catch (Exception ex) { throw (ex); } }
private void SelectUsuario_ForEdit(Int32 idUsuario) { ENTUsuario oENTUsuario = new ENTUsuario(); ENTResponse oENTResponse = new ENTResponse(); BPUsuario oBPUsuario = new BPUsuario(); try { // Formulario oENTUsuario.idArea = 0; oENTUsuario.idRol = 0; oENTUsuario.idUsuario = idUsuario; oENTUsuario.sEmail = ""; oENTUsuario.sNombre = ""; oENTUsuario.tiActivo = 2; // Transacción oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD this.lblActionMessage.Text = oENTResponse.sMessage; // Llenado de formulario this.ddlActionArea.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["idArea"].ToString(); this.ddlSexo.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["SexoId"].ToString(); this.ddlActionRol.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["idRol"].ToString(); this.txtActionEmail.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sEmail"].ToString(); this.txtActionNombre.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sNombre"].ToString(); this.txtActionApellidoPaterno.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sApellidoPaterno"].ToString(); this.txtActionApellidoMaterno.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sApellidoMaterno"].ToString(); this.txtActionDescripcion.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sDescripcion"].ToString(); this.ddlActionStatus.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["tiActivo"].ToString(); }catch (Exception ex){ throw (ex); } }
void SelectUsuario(ENTUsuario oENTUsuario) { ENTResponse oENTResponse = new ENTResponse(); BPUsuario oBPUsuario = new BPUsuario(); try { // Transacción oENTResponse = oBPUsuario.SelectUsuario(oENTUsuario); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Transacción exitosa ExportExcel(oENTResponse.dsResponse.Tables[2], "Usuario"); } catch (Exception ex) { throw (ex); } }