示例#1
0
 protected void GvCorreos_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try{
         DataTable vDatos = (DataTable)Session["DOCUMENTOS_CORREOS"];
         if (e.CommandName == "BorrarCorreo")
         {
             String vID = e.CommandArgument.ToString();
             if (Session["DOCUMENTOS_CORREOS"] != null)
             {
                 DataRow[] result = vDatos.Select("idEmpleado = '" + vID + "'");
                 foreach (DataRow row in result)
                 {
                     if (row["idEmpleado"].ToString().Contains(vID))
                     {
                         vDatos.Rows.Remove(row);
                     }
                 }
             }
         }
         GvCorreos.DataSource = vDatos;
         GvCorreos.DataBind();
         Session["DOCUMENTOS_CORREOS"] = vDatos;
     }catch (Exception ex) {
         Mensaje(ex.Message, WarningType.Danger);
     }
 }
示例#2
0
        protected void BtnAgregarCorreo_Click(object sender, EventArgs e)
        {
            try{
                if (DDLEmpleados.SelectedValue == "0")
                {
                    throw new Exception("Favor seleccione el empleado.");
                }

                DivMensajeCorreo.Visible = false;
                String    vQuery = "[RSP_Documentacion] 7," + DDLEmpleados.SelectedValue;
                DataTable vDatos = vConexion.obtenerDataTable(vQuery);

                DataTable vNewDatos = new DataTable();
                DataTable vData     = (DataTable)Session["DOCUMENTOS_CORREOS"];

                vNewDatos.Columns.Add("idEmpleado");
                vNewDatos.Columns.Add("nombre");
                vNewDatos.Columns.Add("emailEmpresa");
                vNewDatos.Columns.Add("emailPersonal");

                if (vData == null)
                {
                    vData = vNewDatos.Clone();
                }

                Boolean vFlag = true;
                if (vData.Rows.Count > 0)
                {
                    for (int i = 0; i < vData.Rows.Count; i++)
                    {
                        if (vData.Rows[i]["idEmpleado"].ToString() == DDLEmpleados.SelectedValue)
                        {
                            vFlag = false;
                            break;
                        }
                    }
                    if (vFlag)
                    {
                        vData.Rows.Add(DDLEmpleados.SelectedValue, DDLEmpleados.SelectedItem, vDatos.Rows[0]["emailEmpresa"].ToString(), vDatos.Rows[0]["emailPersonal"].ToString());
                    }
                }
                else
                {
                    vData.Rows.Add(DDLEmpleados.SelectedValue, DDLEmpleados.SelectedItem, vDatos.Rows[0]["emailEmpresa"].ToString(), vDatos.Rows[0]["emailPersonal"].ToString());
                }

                if (vData.Rows.Count > 0 && vFlag)
                {
                    Session["DOCUMENTOS_CORREOS"] = vData;
                    GvCorreos.DataSource          = vData;
                    GvCorreos.DataBind();
                }
            }catch (Exception ex) {
                DivMensajeCorreo.Visible = true;
                LbMensajeCorreo.Text     = ex.Message;
            }
        }
示例#3
0
 protected void GvCorreos_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try{
         GvCorreos.PageIndex  = e.NewPageIndex;
         GvCorreos.DataSource = (DataTable)Session["DOCUMENTOS_CORREOS"];
         GvCorreos.DataBind();
     }catch (Exception ex) {
         Mensaje(ex.Message, WarningType.Danger);
     }
 }
示例#4
0
        protected void LBIntegrantesArea_Click(object sender, EventArgs e)
        {
            try{
                DataTable vDatos = new DataTable();
                DataTable vData  = new DataTable();
                for (int i = 0; i < LBxAreas.Items.Count; i++)
                {
                    if (LBxAreas.Items[i].Selected)
                    {
                        String vQuery = "[RSP_Documentacion] 17," + LBxAreas.Items[i].Value;

                        if (vDatos.Rows.Count < 1)
                        {
                            vDatos = vConexion.obtenerDataTable(vQuery);
                        }
                        else
                        {
                            vData = vConexion.obtenerDataTable(vQuery);
                            if (vData.Rows.Count > 0)
                            {
                                for (int j = 0; j < vData.Rows.Count; j++)
                                {
                                    vDatos.Rows.Add(vData.Rows[j]["idEmpleado"].ToString(),
                                                    vData.Rows[j]["nombre"].ToString(),
                                                    vData.Rows[j]["emailEmpresa"].ToString(),
                                                    vData.Rows[j]["emailPersonal"].ToString(),
                                                    vData.Rows[j]["nombreArea"].ToString()
                                                    );
                                }
                            }
                        }
                    }
                }

                if (vDatos.Rows.Count > 0)
                {
                    GvCorreos.DataSource = vDatos;
                    GvCorreos.DataBind();
                    Session["DOCUMENTOS_CORREOS"] = vDatos;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalCorreos();", true);
                }
            }catch (Exception ex) {
                Mensaje(ex.Message, WarningType.Danger);
            }
        }
示例#5
0
        protected void GvTipos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try{
                limpiarModal();
                String vId = e.CommandArgument.ToString();
                DivPropietario.Visible        = vId == "1" ? false : true;
                DivExternos.Visible           = vId == "6" ? true : false;
                Session["DOCUMENTOS_TIPO_ID"] = vId;
                if (e.CommandName == "NuevoDoc")
                {
                    DivEmpleados.Visible = DDLCategoria.SelectedValue == "2" ? true : false;
                    DivGrupos.Visible    = DDLCategoria.SelectedValue == "3" ? true : false;
                    DivAreas.Visible     = DDLCategoria.SelectedValue == "4" ? true : false;

                    String    vQuery = "[RSP_Documentacion] 27";
                    DataTable vDatos = vConexion.obtenerDataTable(vQuery);
                    for (int i = 0; i < vDatos.Rows.Count; i++)
                    {
                        if (vDatos.Rows[i]["idTipoDoc"].ToString() == vId)
                        {
                            TxCodigo.Text = vDatos.Rows[i]["codigo"].ToString();
                        }
                    }

                    Session["DOCUMENTOS_CORREOS"] = null;
                    GvCorreos.DataSource          = null;
                    GvCorreos.DataBind();

                    if (vId == "1")
                    {
                        LitTitulo.Text = "Boletines";
                    }
                    else if (vId == "2")
                    {
                        LitTitulo.Text = "Formatos";
                    }
                    else if (vId == "3")
                    {
                        LitTitulo.Text = "Manuales";
                    }
                    else if (vId == "4")
                    {
                        LitTitulo.Text = "Politicas";
                    }
                    else if (vId == "5")
                    {
                        LitTitulo.Text = "Procesos";
                    }
                    else if (vId == "6")
                    {
                        LitTitulo.Text = "Externos";
                    }


                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                }
                else if (e.CommandName == "EntrarDoc")
                {
                    Response.Redirect("tipoDocumentos.aspx");
                }
            }catch (Exception Ex) {
                Mensaje(Ex.Message, WarningType.Danger);
            }
        }