protected void Update(object sender, ImageClickEventArgs e) { ModalObserva.Show(); ImageButton btnEditar = ((ImageButton)sender); GridViewRow row = btnEditar.NamingContainer as GridViewRow; string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_RRHH_DESEMPENIO_OBJETIVOS_ID(Convert.ToInt32(pk)); if (dtResultado.Rows.Count > 0) { btnGuardar.Focus(); txtObjetivos.Text = dtResultado.Rows[0]["OBJETIVO"].ToString(); lblCodigo.Text = dtResultado.Rows[0]["IDE_OBJETIVO"].ToString(); txtIndicador.Text = dtResultado.Rows[0]["INDICADOR"].ToString(); txtInicio.Text = dtResultado.Rows[0]["INICIO"].ToString(); txtfin.Text = dtResultado.Rows[0]["TERMINO"].ToString(); txtPeso.Text = dtResultado.Rows[0]["PESO"].ToString(); txtAmpliarFecha.Text = dtResultado.Rows[0]["FECHA_AMPLIACION"].ToString(); string AMPLIACION = dtResultado.Rows[0]["FLG_AMPLIACION"].ToString(); if (txtAmpliarFecha.Text != string.Empty && AMPLIACION == "True") { PanelAmpliacion.Visible = true; } else { PanelAmpliacion.Visible = false; } } }
protected void ListarObjetivos() { BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); string IDE_OBJETIVO = string.Empty; if (ddlObejtivos.SelectedIndex == 0) { IDE_OBJETIVO = string.Empty; } else { IDE_OBJETIVO = ddlObejtivos.SelectedValue.ToString(); } dtResultado = obj.uspSEL_RRHH_DESEMPENIO_OBJETIVOS_PERSONA(lblPersonal.Text, Convert.ToInt32(Session["ANIO"]), IDE_OBJETIVO); if (dtResultado.Rows.Count > 0) { ListView1.DataSource = dtResultado; ListView1.DataBind(); } else { ListView1.DataSource = dtResultado; ListView1.DataBind(); } //ListarGrafico(); }
protected void GuardarObjetivo() { BE_RRHH_DESEMPENIO_OBJETIVOS oBESol = new BE_RRHH_DESEMPENIO_OBJETIVOS(); oBESol.IDE_OBJETIVO = Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text); oBESol.IDE_DESEMPENIO = Convert.ToInt32(Session["IDE_DESEMPENIO"].ToString()); oBESol.OBJETIVO = txtObjetivos.Text.Trim(); oBESol.INDICADOR = txtIndicador.Text.Trim(); oBESol.DNI_PERSONA = Session["DNI"].ToString(); oBESol.PESO = Convert.ToDecimal(txtPeso.Text); oBESol.INICIO = txtInicio.Text; oBESol.TERMINO = txtfin.Text; oBESol.J_COMENTARIOS_JEFE = string.Empty; oBESol.J_USER_JEFE = Session["IDE_USUARIO"].ToString(); oBESol.USER_REGISTRO = Session["IDE_USUARIO"].ToString(); oBESol.ANIO = Convert.ToInt32(Session["ANIO"].ToString()); oBESol.FECHA_AMPLIACION = txtAmpliarFecha.Text; string estado = string.IsNullOrEmpty(rdoAprobar.SelectedValue.ToString()) ? "" : rdoAprobar.SelectedValue.ToString(); oBESol.APROBAR = estado; int dtrpta = 0; dtrpta = new BL_RRHH_DESEMPENIO_OBJETIVOS().uspINS_RRHH_DESEMPENIO_OBJETIVOS(oBESol); if (dtrpta > 0) { lblCodigo.Text = string.Empty; CleanControl(this.Controls); string cleanMessage = "Registro exitoso"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); ListarObjetivos(Session["DNI"].ToString()); } }
protected void Eliminar(object sender, ImageClickEventArgs e) { ImageButton btnEliminar = ((ImageButton)sender); GridViewRow row = btnEliminar.NamingContainer as GridViewRow; string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspDEL_RRHH_DESEMPENIO_OBJETIVOS_ID(Convert.ToInt32(pk)); ListarObjetivos(Session["DNI"].ToString()); CleanControl(this.Controls); }
protected void likeObjetivo(object sender, ImageClickEventArgs e) { ImageButton btnLike = ((ImageButton)sender); int item = Convert.ToInt32(btnLike.CommandArgument); ListViewItem CommentItem = btnLike.NamingContainer as ListViewItem; int IDE_OBJETIVO = (int)ListView1.DataKeys[CommentItem.DisplayIndex].Values["IDE_OBJETIVO"]; BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_RRHH_DESEMPENIO_OBJETIVOS_LIKE(Convert.ToInt32(IDE_OBJETIVO), lblPersonal.Text, Convert.ToInt32(Session["ANIO"]), 3); ListarObjetivos(); TextBox txtPunto = (TextBox)CommentItem.FindControl("txtPunto"); }
protected void ListarObjetivos(string dni) { BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_RRHH_DESEMPENIO_OBJETIVOS_PERSONA(dni, Convert.ToInt32(Session["ANIO"]), ""); if (dtResultado.Rows.Count > 0) { GridView1.DataSource = dtResultado; GridView1.DataBind(); } else { lblPesos.Text = "0"; GridView1.DataSource = dtResultado; GridView1.DataBind(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton LinkButton1 = ((LinkButton)sender); ListViewItem CommentItem = LinkButton1.NamingContainer as ListViewItem; int IDE_OBJETIVO = (int)ListView1.DataKeys[CommentItem.DisplayIndex].Values["IDE_OBJETIVO"]; DropDownList ddlAvance = (DropDownList)CommentItem.FindControl("ddlAvance"); BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspUPD_RRHH_DESEMPENIO_AVANCE(IDE_OBJETIVO, Convert.ToInt32(ddlAvance.SelectedValue)); string cleanMessage = "actualización satisfactoria"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); ListarGrafico(); //ModalObserva.Show(); }
protected void cboObjetivos(string dni) { BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_RRHH_DESEMPENIO_OBJETIVOS_PERSONA(dni, Convert.ToInt32(Session["ANIO"]), ""); if (dtResultado.Rows.Count > 0) { ddlObejtivos.DataSource = dtResultado; ddlObejtivos.DataTextField = "OBJETIVO"; ddlObejtivos.DataValueField = "IDE_OBJETIVO"; ddlObejtivos.DataBind(); ddlObejtivos.Items.Insert(0, new ListItem("--- Todos ---", "")); } else { ddlObejtivos.Items.Insert(0, new ListItem("--- N.R. ---", "")); } }
protected void btnCorreo_Click(object sender, EventArgs e) { string cleanMessage = string.Empty; BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); if (txtComentarios.Text == string.Empty) { cleanMessage = "Ingresar comentarios"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { if (GridView1.Rows.Count == 0) { cleanMessage = "No existen objetivos a notificar"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { if (Convert.ToDecimal(lblPesos.Text) < 100 || Convert.ToDecimal(lblPesos.Text) > 100) { cleanMessage = "El peso total de objetivo(s) debe ser igual a 100%"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { DataTable dtResultado = new DataTable(); dtResultado = obj.SP_EnviarCorreo_objetivoNuevo(Session["DNI"].ToString(), Convert.ToInt32(Session["ANIO"]), txtComentarios.Text.Trim()); if (dtResultado.Rows.Count > 0) { txtComentarios.Text = string.Empty; cleanMessage = "Envio satisfactorio"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } } } }
protected void ListarGrafico() { string IDE_OBJETIVO = string.Empty; if (ddlObejtivos.SelectedIndex == 0) { IDE_OBJETIVO = string.Empty; } else { IDE_OBJETIVO = ddlObejtivos.SelectedValue.ToString(); } BL_RRHH_DESEMPENIO_OBJETIVOS obj = new BL_RRHH_DESEMPENIO_OBJETIVOS(); DataTable dtResultado = new DataTable(); dtResultado.Clear(); dtResultado = obj.uspSEL_RRHH_DESEMPENIO_GRAFICO(lblPersonal.Text, Convert.ToInt32(Session["ANIO"]), IDE_OBJETIVO); DataTable dt = dtResultado; /* * string[] x = new string[dt.Rows.Count]; * int[] y = new int[dt.Rows.Count]; * * for (int i = 0; i < dt.Rows.Count; i++) * { * x[i] = dt.Rows[i]["OBJ"].ToString(); * y[i] = Convert.ToInt32(dt.Rows[i]["AVANCE"]); * } * Chart1.Series["Series1"].Points.DataBindXY(x, y); * * Chart1.Series[0].ChartType = SeriesChartType.Column; * Chart1.Series["Series1"].Label = "#PERCENT"; * Chart1.Series[0].LegendText = "#VALX"; * Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; * Chart1.Legends["Series1"].Enabled = true; * * * string[] x2 = new string[dt.Rows.Count]; * int[] y2 = new int[dt.Rows.Count]; * string[] l2 = new string[dt.Rows.Count]; * for (int i = 0; i < dt.Rows.Count; i++) * { * x2[i] = dt.Rows[i]["obj2"].ToString(); * y2[i] = Convert.ToInt32(dt.Rows[i]["TOTAL_TRANSCURRIDOS"]); * l2[i] = dt.Rows[i]["LEYENDA_TRANSCURRIDOS"].ToString(); * * } * Chart2.Series[0].Points.DataBindXY(x2, y2); * Chart2.Series[0].ToolTip = l2.ToString(); * Chart2.Series[0].IsValueShownAsLabel = true; * Chart2.Series[0].ChartType = SeriesChartType.Column; */ //Chart1.ResetAutoValues(); Chart1.Series[0].Points.Clear(); Chart1.Series["Series1"].Points.Clear(); Chart1.ResetAutoValues(); Chart1.DataSource = dtResultado; Chart1.DataBind(); Chart1.Series[0].IsValueShownAsLabel = true; //Chart1.Series["Series1"].Label = "#PERCENT"; Chart2.DataSource = dtResultado; Chart2.DataBind(); Chart2.Series[0].IsValueShownAsLabel = true; Chart2.Series[1].IsValueShownAsLabel = true; Chart2.Series[0].LegendText = "Días transcurridos"; Chart2.Series[1].LegendText = "Total de días"; }
protected void btnGuardar_Click(object sender, EventArgs e) { string cleanMessage = string.Empty; if (txtObjetivos.Text == string.Empty) { cleanMessage = "Ingresar objetivo"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (txtIndicador.Text == string.Empty) { cleanMessage = "Ingresar indicador"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (txtPeso.Text == string.Empty) { cleanMessage = "Ingresar peso"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (txtInicio.Text == string.Empty) { cleanMessage = "Ingresar fecha de inicio"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (txtfin.Text == string.Empty) { cleanMessage = "Ingresar fecha de termino"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { DateTime inicio = Convert.ToDateTime(txtInicio.Text); DateTime fin = Convert.ToDateTime(txtfin.Text); if (inicio >= fin) { cleanMessage = "La fecha de inicio no puede ser mayor o igual a la fecha de termino"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { int cantidad = 0; foreach (ListItem li in ddlPersonalAcargo.Items) { if (li.Selected) { string usuario = li.Value; BE_RRHH_DESEMPENIO_OBJETIVOS oBESol = new BE_RRHH_DESEMPENIO_OBJETIVOS(); oBESol.IDE_OBJETIVO = 0; oBESol.IDE_DESEMPENIO = Convert.ToInt32(Session["IDE_DESEMPENIO"].ToString()); oBESol.OBJETIVO = txtObjetivos.Text.Trim(); oBESol.INDICADOR = txtIndicador.Text.Trim(); oBESol.DNI_PERSONA = li.Value; oBESol.PESO = Convert.ToDecimal(txtPeso.Text); oBESol.INICIO = txtInicio.Text; oBESol.TERMINO = txtfin.Text; oBESol.J_COMENTARIOS_JEFE = string.Empty; oBESol.J_USER_JEFE = Session["IDE_USUARIO"].ToString(); oBESol.USER_REGISTRO = Session["IDE_USUARIO"].ToString(); oBESol.ANIO = Convert.ToInt32(Session["ANIO"].ToString()); oBESol.FECHA_AMPLIACION = string.Empty; oBESol.APROBAR = string.Empty; int dtrpta = 0; dtrpta = new BL_RRHH_DESEMPENIO_OBJETIVOS().uspINS_RRHH_DESEMPENIO_OBJETIVOS(oBESol); if (dtrpta > 0) { cantidad++; //BL_TBSOLICITUD_PERMISOS oB = new BL_TBSOLICITUD_PERMISOS(); //oB.correo_solicitud(dtrpta); } } } if (cantidad > 0) { CleanControl(this.Controls); cleanMessage = "Registro exitoso, los obejtivos fueron asignados correctamente"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { cleanMessage = "Falta seleccionar personal"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } } }