private void FechaLeyenda(int anio, int mes) { DataTable dtResultado = new DataTable(); DataTable dtNombres = new DataTable(); BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); //dtResultado = GetFechas(anio, mes); //if (dtResultado.Rows.Count == 0) //{ // dlCustomers.Visible = false; // dlCustomers.DataSource = dtResultado; // dlCustomers.DataBind(); //} //else //{ // dlCustomers.Visible = true; // dlCustomers.DataSource = dtResultado; // dlCustomers.DataBind(); //} dtResultado = obj.SP_TBSOLICITUD_VER_PERMISOS_MES(anio, mes, "", ddlLeyenda.SelectedValue.ToString(), lblCentro.Text); if (dtResultado.Rows.Count == 0) { GridPermisos.Visible = false; GridPermisos.DataSource = dtResultado; GridPermisos.DataBind(); } else { GridPermisos.Visible = true; GridPermisos.DataSource = dtResultado; GridPermisos.DataBind(); } }
protected void btnGuardar_Click(object sender, EventArgs e) { BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dt = new DataTable(); if (lblrpta.Text == "R") { if (txtSustento.Text != string.Empty) { dt = obj.SP_TBSOLICITUD_PERMISOS_PROCESAR_DATOS(Convert.ToInt32(lblCodigo.Text), lblrpta.Text, txtSustento.Text.Trim(), Session["IDE_USUARIO"].ToString()); string cleanMessage = "Registro procesado"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); limpiar(); Listar(); } else { string cleanMessage = "ingresar sustento de rechazo"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } else if (lblrpta.Text == "A") { dt = obj.SP_TBSOLICITUD_PERMISOS_PROCESAR_DATOS(Convert.ToInt32(lblCodigo.Text), lblrpta.Text, txtSustento.Text.Trim(), Session["IDE_USUARIO"].ToString()); string cleanMessage = "Registro procesado"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); limpiar(); Listar(); } }
protected void btnExportar_Click(object sender, ImageClickEventArgs e) { string estado = string.Empty; if (ddlEstados.SelectedIndex == 0) { estado = string.Empty; } else { estado = ddlEstados.SelectedValue.ToString(); } BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.SP_TBSOLICITUD_PERMISOS_TODOS(ddlanio.SelectedValue.ToString(), estado, BL_Session.CENTRO_COSTO); if (dtResultado.Rows.Count > 0) { GridView2.Visible = true; GridView2.DataSource = dtResultado; GridView2.DataBind(); GridViewExportUtil.Export("MDP_" + DateTime.Now + ".xls", GridView2); return; } else { GridView2.Visible = false; GridView2.DataSource = dtResultado; GridView2.DataBind(); } }
protected void Listar() { string estado = string.Empty; if (ddlEstados.SelectedIndex == 0) { estado = string.Empty; } else { estado = ddlEstados.SelectedValue.ToString(); } BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.SP_TBSOLICITUD_PERMISOS_TODOS(ddlanio.SelectedValue.ToString(), estado, BL_Session.CENTRO_COSTO); if (dtResultado.Rows.Count > 0) { GridView1.Visible = true; GridView1.DataSource = dtResultado; GridView1.DataBind(); } else { GridView1.Visible = false; GridView1.DataSource = dtResultado; GridView1.DataBind(); } }
protected void Procesar(object sender, ImageClickEventArgs e) { ImageButton btnProcesar = ((ImageButton)sender); GridViewRow row = btnProcesar.NamingContainer as GridViewRow; string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); RadioButtonList rb = (RadioButtonList)row.FindControl("rdoOpcion"); //string z= pk + " - " + rb.SelectedValue; BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dt = new DataTable(); lblrpta.Text = rb.SelectedValue; if (rb.SelectedValue == "R") { ModalRegistro.Show(); lblCodigo.Text = pk.ToString(); lblmsg.Text = "Observación de rechazo"; } else if (rb.SelectedValue == "A") { //dt = obj.SP_TBSOLICITUD_PERMISOS_PROCESAR_DATOS(Convert.ToInt32(pk), rb.SelectedValue, "", Session["IDE_USUARIO"].ToString()); //string cleanMessage = "Registro procesado"; //ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); //Listar(); lblmsg.Text = "Comentarios de aprobación"; ModalRegistro.Show(); lblCodigo.Text = pk.ToString(); } }
protected void btnEnviar_Click(object sender, ImageClickEventArgs e) { string correos = string.Empty; int cantidad = GridView1.Rows.Count; if (cantidad > 0) { foreach (GridViewRow Fila in GridView1.Rows) { Label lblCorreo = ((Label)Fila.FindControl("lblCorreo")); correos += lblCorreo.Text + ","; } } BL_TBSOLICITUD_PERMISOS oB = new BL_TBSOLICITUD_PERMISOS(); IDE_PERMISO = Request.QueryString["Requ_Numero"]; DataTable dtResultado = new DataTable(); dtResultado = oB.SP_EnviarCorreo_PermisoRHH(Convert.ToInt32(IDE_PERMISO), correos); if (dtResultado.Rows.Count > 0) { string cleanMessage = dtResultado.Rows[0]["MSG"].ToString(); ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } }
protected void Guardar(string file) { string cleanMessage = string.Empty; BE_TBSOLICITUD_PERMISOS oBESol = new BE_TBSOLICITUD_PERMISOS(); oBESol.Ide_permiso = Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text); oBESol.Ide_usuario = Session["IDE_USUARIO"].ToString(); oBESol.Ide_motivo = Convert.ToInt32(ddlmotivo.SelectedValue); oBESol.Inicio = txtInicio.Text.Trim(); oBESol.Fin = txtfin.Text.Trim(); oBESol.Comentario = txtcomentarios.Text.Trim(); oBESol.FILE = file; oBESol.URL = FolderMDP; oBESol.NOMBRE_DIA = dayOfWeek(Convert.ToDateTime(txtInicio.Text.Trim())); int dtrpta = 0; dtrpta = new BL_TBSOLICITUD_PERMISOS().MANT_TBSOLICITUD_PERMISOS_INSERT_DATOS(oBESol); if (dtrpta > 0) { BL_TBSOLICITUD_PERMISOS oB = new BL_TBSOLICITUD_PERMISOS(); oB.correo_solicitud(dtrpta, Session["IDE_USUARIO"].ToString()); cleanMessage = "Registro exitoso. Tu solicitud está siendo revisada, te informaremos sobre su situación lo más antes posible, gracias"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); lblCodigo.Text = string.Empty; txtcomentarios.Text = string.Empty; txtfin.Text = string.Empty; txtInicio.Text = string.Empty; ListarPermisos(); } }
protected void eliminarpermiso(object sender, ImageClickEventArgs e) { ImageButton btnEditar = ((ImageButton)sender); GridViewRow row = btnEditar.NamingContainer as GridViewRow; string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.MANT_TBSOLICITUD_PERMISOS_DELETE_DATOS(Convert.ToInt32(pk)); ListarPermisos(); }
protected void ListarPermisos() { BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.MANT_TBSOLICITUD_PERMISOS_SELECT_DATOS(Session["IDE_USUARIO"].ToString(), ddlanio.SelectedValue); if (dtResultado.Rows.Count > 0) { GridView1.Visible = true; GridView1.DataSource = dtResultado; GridView1.DataBind(); } else { GridView1.Visible = false; GridView1.DataSource = dtResultado; GridView1.DataBind(); } }
protected void ver_editar(object sender, ImageClickEventArgs e) { ImageButton btnEditar = ((ImageButton)sender); GridViewRow row = btnEditar.NamingContainer as GridViewRow; string pk = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.SP_TBSOLICITUD_PERMISOS_SELECT_DATOS_ID(Convert.ToInt32(pk)); if (dtResultado.Rows.Count > 0) { lblCodigo.Text = dtResultado.Rows[0]["IDE_PERMISO"].ToString(); ddlmotivo.SelectedValue = dtResultado.Rows[0]["IDE_MOTIVO"].ToString(); txtcomentarios.Text = dtResultado.Rows[0]["COMENTARIOS"].ToString(); txtfin.Text = dtResultado.Rows[0]["FIN"].ToString(); txtInicio.Text = dtResultado.Rows[0]["INICIO"].ToString(); } }
protected void CalendarDRender(object sender, DayRenderEventArgs e) { try { // If the month is CurrentMonth //if (!e.Day.IsOtherMonth) if (e.Day.Date.ToShortDateString() != null) { foreach (DataRow dr in dtMes.Rows) { if ((dr["FECHA"].ToString() != DBNull.Value.ToString())) { DateTime dtEvent = (DateTime)dr["FECHA"]; if (dtEvent.Equals(e.Day.Date)) { //e.Cell.BackColor = GetColor(); System.Web.UI.WebControls.Image image; image = new System.Web.UI.WebControls.Image(); image.ImageUrl = "~/imagenes/pinAzul.png"; BL_TBSOLICITUD_PERMISOS obj = new BL_TBSOLICITUD_PERMISOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.SP_TBSOLICITUD_PERMISOS_MES_TOOLTIP(dr["DIA"].ToString(), lblCentro.Text); image.ToolTip = dtResultado.Rows[0]["MENSAJE"].ToString(); e.Cell.Controls.Add(image); e.Cell.ToolTip = dtResultado.Rows[0]["MENSAJE"].ToString(); //e.Cell.BackColor = GetColor(); //e.Cell.ForeColor = Color.White; //DateTime miFecha = e.Day.Date; //int day = miFecha.Day; //dtUsuarios = GetUser(day); //foreach (DataRow drf in dtUsuarios.Rows) //{ // string nom = "<br />" + drf["NOMBRE_COMPLETO"].ToString(); // e.Cell.Controls.Add(new LiteralControl(nom)); // //e.Cell.ToolTip = "dia festivoOOOO"; // //e.Cell.Controls.Add(new LiteralControl("<br />Holiday")); // //e.Cell.Controls[0].Visible = false; // //e.Cell.Enabled = false; // //e.Cell.CssClass = "disabledDate"; //} } } } } //If the month is not CurrentMonth then hide the Dates else { e.Cell.Text = ""; } } catch (Exception ex) { } }
protected void btnEnviar_Click(object sender, EventArgs e) { string cleanMessage = string.Empty; if (txtInicio.Text.Trim() == string.Empty) { cleanMessage = "Ingresar fecha de inicio"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (txtfin.Text.Trim() == string.Empty) { cleanMessage = "Ingresar fecha de termino"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { if (Convert.ToDateTime(txtInicio.Text) > Convert.ToDateTime(txtfin.Text)) { cleanMessage = "La fecha de inicio no puede ser mayor 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; lblCodigo.Text = string.Empty; BE_TBSOLICITUD_PERMISOS oBESol = new BE_TBSOLICITUD_PERMISOS(); oBESol.Ide_permiso = Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text); oBESol.Ide_usuario = usuario; oBESol.Ide_motivo = Convert.ToInt32(ddlmotivo.SelectedValue); oBESol.Inicio = txtInicio.Text.Trim(); oBESol.Fin = txtfin.Text.Trim(); oBESol.Comentario = txtcomentarios.Text.Trim(); oBESol.FILE = ""; oBESol.URL = ""; oBESol.NOMBRE_DIA = dayOfWeek(Convert.ToDateTime(txtInicio.Text.Trim())); int dtrpta = 0; dtrpta = new BL_TBSOLICITUD_PERMISOS().MANT_TBSOLICITUD_PERMISOS_INSERT_DATOS(oBESol); if (dtrpta > 0) { cantidad++; //BL_TBSOLICITUD_PERMISOS oB = new BL_TBSOLICITUD_PERMISOS(); //oB.correo_solicitud(dtrpta); } //lblpersonal.Text = } } if (cantidad > 0) { cleanMessage = "Registro exitoso"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); txtcomentarios.Text = string.Empty; txtfin.Text = string.Empty; txtInicio.Text = string.Empty; } else { cleanMessage = "Falta seleccionar personal"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } } }