示例#1
0
        protected void btnProcesar_Click(object sender, EventArgs e)
        {
            BLServidores objSrv = new BLServidores();
            int          TR_Id  = 0;
            int          Obj_Id = 0;

            lblMsj.Text   = "";
            txtCinta.Text = txtCinta.Text.Trim();


            int.TryParse(ddlFiltro.SelectedValue, out TR_Id);
            int.TryParse(ddlObj.SelectedValue, out Obj_Id);

            string Archivo = objSrv.ReporteCintas(TR_Id, Obj_Id, txtCinta.Text, Server.MapPath("../Reportes/" + DatosGenerales.RutaLocalReportesDinamicos));

            if (Archivo.Length > 4 && Archivo.Substring(0, 5) != "Error")
            {
                Archivo = DatosGenerales.RutaReportesDinamicos + Archivo;
            }
            else
            {
                lblMsj.Text = Archivo;
            }

            if (Archivo != "")
            {
                Response.Redirect(Archivo);
            }
            else
            {
                DatosGenerales.EnviaMensaje("No se encontraron resultados para su búsqueda.", "Exportar a Excel", DatosGenerales.TiposMensaje.Informacion);
            }
        }
示例#2
0
        protected void ddlFiltro_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLServidores objSrv = new BLServidores();
            int          TR_Id  = 0;

            if (ddlObj.Items.Count > 0)
            {
                ddlObj.SelectedIndex = -1;
            }

            int.TryParse(ddlFiltro.SelectedValue, out TR_Id);
            ddlObj.DataSource = null;
            ddlObj.DataBind();
            ddlObj.Enabled = false;
            //txtCinta.Enabled = false;
            btnProcesar.Enabled = false;
            //txtCinta.Text = "";

            if (TR_Id > 0)
            {
                ddlObj.DataValueField = "Valor";
                ddlObj.DataTextField  = "Descripcion";
                ddlObj.DataSource     = objSrv.BuscarObjetosRespaldo(TR_Id);
                ddlObj.DataBind();

                if (ddlObj.Items.Count > 0)
                {
                    ddlObj.Enabled = true;
                    //txtCinta.Enabled = true;
                    btnProcesar.Enabled = true;
                }
            }
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            int      Obj_Id = 0;
            DateTime Fecha  = ObtieneFecha(txtFechaRespaldo.Text);

            txtCinta.Text = txtCinta.Text.Trim();
            int.TryParse(ddlServidor.SelectedValue, out Obj_Id);
            lblMsj.Visible = false;

            if (Page.IsValid && Obj_Id > 0 && txtCinta.Text != "" && Fecha.ToString("ddMMyyyy") != "01011900")
            {
                BLServidores objSrv = new BLServidores();

                objSrv.RegistrarCinta(3, Obj_Id, txtCinta.Text, txtObservacionesCinta.Text.Trim(), Fecha);
                lblMsj.Text      = "Cinta registrada.";
                lblMsj.ForeColor = System.Drawing.Color.DarkGreen;
            }
            else
            {
                lblMsj.Text      = "No se registró. Datos incorrectos.";
                lblMsj.ForeColor = System.Drawing.Color.DarkRed;
            }

            lblMsj.Visible = true;
        }
示例#4
0
        protected void btnNuevaCat_Click(object sender, EventArgs e)
        {
            BLCatalogos  objCat = new BLCatalogos();
            BLServidores objSrv = new BLServidores();

            txtNuevaCat.Text = txtNuevaCat.Text.Trim();

            if (txtNuevaCat.Text != "")
            {
                objSrv.AgregarCategoria(hddUsuario.Value, txtNuevaCat.Text);
            }

            txtNuevaCat.Text = "";
            pnlCat.Visible   = false;

            objCat.CategoriasTarea(ref ddlCategoria, hddUsuario.Value);
            ddlCategoria.DataBind();

            //if (ddlUsuario.SelectedValue == hddUsuario.Value)
            ddlCategoria.Items.Add(new ListItem("Crear nueva categoría", "-1"));

            ddlCategoria.Items.Add(new ListItem("Todas", "-2"));
            btnProcesar.Enabled = false;

            for (int w = 0; w <= ddlCategoria.Items.Count; w++)
            {
                if (ddlCategoria.Items[w].Value == "-2")
                {
                    ddlCategoria.SelectedIndex = w;
                    btnProcesar.Enabled        = true;
                    break;
                }
            }

            if (/*ddlUsuario.SelectedValue == hddUsuario.Value && */ ddlCategoria.Items.Count == 2)
            {
                pnlCat.Visible = true;

                for (int w = 0; w <= ddlCategoria.Items.Count; w++)
                {
                    if (ddlCategoria.Items[w].Value == "-1")
                    {
                        ddlCategoria.SelectedIndex = w;
                        break;
                    }
                }
            }
            else
            {
                pnlCat.Visible = false;
            }
        }
示例#5
0
        protected void btnProcesar_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BLSoftware   objGrupoSoftware   = new BLSoftware();
                BLServidores objGrupoServidores = new BLServidores();
                int          AppBD_Id           = 0;
                int          AppSB_Id           = 0;
                DateTime?    AppBD_FechaBaja;

                int.TryParse(ddlBD.SelectedValue, out AppBD_Id);
                int.TryParse(ddlInstanciaBD.SelectedValue, out AppSB_Id);
                txtNombre.Text             = txtNombre.Text.Trim();
                txtCinta.Text              = txtCinta.Text.Trim();
                txtObservacionesCinta.Text = txtObservacionesCinta.Text.Trim();

                AppBD_FechaBaja = DatosGenerales.ConvierteFecha(txtFechaBaja.Text);

                if (txtFechaBaja.Text != "" && AppBD_FechaBaja == null)
                {
                    MsgBoxU.AddMessage("Formato de fecha incorrecto", YaBu.MessageBox.uscMsgBox.enmMessageType.Attention);
                    return;
                }

                if (txtNombre.Text != "" && AppBD_Id > 0 && AppSB_Id > 0)
                {
                    objGrupoSoftware.ActualizarBD(AppBD_Id, AppSB_Id, txtNombre.Text, chkActiva.Checked, chkProductiva.Checked, AppBD_FechaBaja);
                }
                else
                {
                    MsgBoxU.AddMessage("Se debe seleccionar un servidor, una instancia y un nombre", YaBu.MessageBox.uscMsgBox.enmMessageType.Attention);
                }

                if (txtCinta.Text != "" && pnlCinta.Visible == true)
                {
                    objGrupoServidores.RegistrarCinta(DatosGenerales.TiposRespaldoCintas.Base_Datos, AppBD_Id, txtCinta.Text, txtObservacionesCinta.Text, DateTime.Now);
                }

                objGrupoSoftware.HistoricoApp(this.Page.ToString().Substring(4, this.Page.ToString().Substring(4).Length - 5) + ".aspx", Session["UserNameLogin"].ToString(), "U", AppSB_Id);

                DatosGenerales.EnviaMensaje("Proceso finalizado", "Modificación de BD", DatosGenerales.TiposMensaje.Informacion);
            }
        }
        protected void btnProcesar_Click(object sender, EventArgs e)
        {
            BLServidores objSrv = new BLServidores();
            int          TR_Id  = 0;
            int          Obj_Id = 0;

            lblMsj.Visible = false;
            txtCinta.Text  = txtCinta.Text.Trim();
            DateTime Fecha = ObtieneFecha(txtFechaRespaldo.Text);

            if (Page.IsValid && txtCinta.Text != "" && Fecha.ToString("ddMMyyyy") != "01011900")
            {
                int.TryParse(ddlFiltro.SelectedValue, out TR_Id);
                int.TryParse(ddlObj.SelectedValue, out Obj_Id);

                objSrv.RegistrarCinta(TR_Id, Obj_Id, txtCinta.Text, txtObservacionesCinta.Text.Trim(), Fecha);
                DatosGenerales.EnviaMensaje("Proceso finalizado", "Alta de respaldos en cinta", DatosGenerales.TiposMensaje.Informacion);
            }
            else
            {
                lblMsj.Visible = true;
            }
        }
示例#7
0
        protected void btnExportar_Click(object sender, EventArgs e)
        {
            BLServidores objSrv = new BLServidores();

            if (ddlUsuario.SelectedValue != "")
            {
                string Archivo = "";

                if (ddlUsuario.SelectedValue != hddUsuario.Value)
                {
                    Archivo = objSrv.TareasAExcel(ddlUsuario.SelectedValue, null, null, null, null, false, Server.MapPath("../Reportes/" + DatosGenerales.RutaLocalReportesDinamicos));
                }
                else
                {
                    Archivo = objSrv.TareasAExcel(ddlUsuario.SelectedValue, null, null, null, null, null, Server.MapPath("../Reportes/" + DatosGenerales.RutaLocalReportesDinamicos));
                }

                if (Archivo.Length > 4 && Archivo.Substring(0, 5) != "Error")
                {
                    Archivo = DatosGenerales.RutaReportesDinamicos + Archivo;
                }
                else
                {
                    DatosGenerales.EnviaMensaje("Error al generar el archivo: " + Archivo, "Exportar a Excel", DatosGenerales.TiposMensaje.Error);
                }

                if (Archivo != "")
                {
                    Response.Redirect(Archivo);
                }
                else
                {
                    DatosGenerales.EnviaMensaje("El usuario no tiene tareas públicas registradas.", "Exportar a Excel", DatosGenerales.TiposMensaje.Informacion);
                }
            }
        }
示例#8
0
        protected void btnProcesar_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BLServidores objSrv    = new BLServidores();
                int          SrvT_Id   = 0;
                int          Categoria = 0;
                bool         HayError  = false;

                int.TryParse(ddlCategoria.SelectedValue, out Categoria);

                switch (ddlAccion.SelectedValue)
                {
                case "1":
                    if (Categoria <= 0 || !EsFecha(dtpIni.DateTime) || !EsFecha(dtpFin.DateTime) || string.IsNullOrWhiteSpace(txtDescripcion.Text))
                    {
                        DatosGenerales.EnviaMensaje("Datos incorrectos. Revise las fechas y que se encuentre un texto en la descripción.", "Alta de tarea", DatosGenerales.TiposMensaje.Advertencia);
                        HayError = true;
                    }

                    if (!FechasCorrectas(ObtieneFecha(dtpIni.DateTime), ObtieneFecha(dtpFin.DateTime)))
                    {
                        DatosGenerales.EnviaMensaje("Datos incorrectos. Revise que la fecha final no sea mayor que la inicial y que la tarea tenga una duración mínima de 5 minutos.", "Alta de tarea", DatosGenerales.TiposMensaje.Advertencia);
                        HayError = true;
                    }

                    if (!HayError)
                    {
                        int.TryParse(objSrv.RegistrarTarea(Convert.ToInt32(ddlEstado.SelectedValue), Convert.ToInt32(ddlCategoria.SelectedValue), hddUsuario.Value, ObtieneFecha(dtpIni.DateTime), ObtieneFecha(dtpFin.DateTime), txtDescripcion.Text, chkPrivada.Checked), out SrvT_Id);

                        if (SrvT_Id > 0)
                        {
                            if (!chkPrivada.Checked)
                            {
                                for (int w = 0; w < chk_Involucrados.Items.Count; w++)
                                {
                                    if (chk_Involucrados.Items[w].Selected)
                                    {
                                        objSrv.AgregarInvolucradoTarea(SrvT_Id, chk_Involucrados.Items[w].Value);
                                    }
                                }
                            }
                        }
                        else
                        {
                            DatosGenerales.EnviaMensaje("No se obtuvo el Id de la tarea. Es posible que no se haya registrado correctamente.", "Alta de tarea", DatosGenerales.TiposMensaje.Error);
                        }

                        Response.Redirect("Tareas.aspx");
                    }

                    break;

                case "2":
                    if (Categoria <= 0 || !EsFecha(dtpIni.DateTime) || !EsFecha(dtpFin.DateTime) || string.IsNullOrWhiteSpace(txtDescripcion.Text))
                    {
                        DatosGenerales.EnviaMensaje("Datos incorrectos. Revise las fechas y que se encuentre un texto en la descripción.", "Modificar tarea", DatosGenerales.TiposMensaje.Advertencia);
                        HayError = true;
                    }

                    if (!FechasCorrectas(ObtieneFecha(dtpIni.DateTime), ObtieneFecha(dtpFin.DateTime)))
                    {
                        DatosGenerales.EnviaMensaje("Datos incorrectos. Revise que la fecha final no sea mayor que la inicial y que la tarea tenga una duración mínima de 5 minutos.", "Modificar tarea", DatosGenerales.TiposMensaje.Advertencia);
                        HayError = true;
                    }

                    if (!HayError)
                    {
                        int.TryParse(ddlTareas.SelectedValue, out SrvT_Id);

                        if (SrvT_Id > 0)
                        {
                            objSrv.ActualizarTarea(SrvT_Id, Convert.ToInt32(ddlEstado.SelectedValue), Convert.ToInt32(ddlCategoria.SelectedValue), ObtieneFecha(dtpIni.DateTime), ObtieneFecha(dtpFin.DateTime), txtDescripcion.Text, chkPrivada.Checked, true);

                            if (!chkPrivada.Checked)
                            {
                                for (int w = 0; w < chk_Involucrados.Items.Count; w++)
                                {
                                    if (chk_Involucrados.Items[w].Selected)
                                    {
                                        objSrv.AgregarInvolucradoTarea(SrvT_Id, chk_Involucrados.Items[w].Value);
                                    }
                                }
                            }
                        }
                        else
                        {
                            DatosGenerales.EnviaMensaje("No se obtuvo el Id de la tarea. No se podrán modificar los datos.", "Modificar tarea", DatosGenerales.TiposMensaje.Error);
                        }

                        Response.Redirect("Tareas.aspx");
                    }

                    break;
                }
            }
        }
示例#9
0
        protected void CargaDatos(string UserLogin, DateTime Fecha, bool PrimeraCarga = false)
        {
            BLServidores objSrv = new BLServidores();
            BLCatalogos  objCat = new BLCatalogos();

            System.Data.DataTable Res = new System.Data.DataTable();

            //hddUsuario.Value = UserLogin;
            Res           = objSrv.ObtenerTareas(UserLogin, DatosGenerales.FechaInicioSemana(Fecha, DayOfWeek.Monday), DatosGenerales.FechaInicioSemana(Fecha, DayOfWeek.Monday).AddDays(7));
            cal01.Visible = false;

            if (Res.TableName != "Error")
            {
                cal01.Visible        = true;
                cal01.DataSource     = Res;
                cal01.DataStartField = "FechaInicio";
                cal01.DataEndField   = "FechaFin";
                cal01.DataTextField  = "Descripcion";
                cal01.DataValueField = "IdTarea";

                cal01.StartDate = DatosGenerales.FechaInicioSemana(Fecha, DayOfWeek.Monday);
                cal01.Days      = 7;
                cal01.DataBind();

                if (PrimeraCarga)
                {
                    hddUsuario.Value = UserLogin;
                    ddlAccion.Items.Add(new ListItem("Seleccione una opción", "0"));
                    ddlAccion.Items.Add(new ListItem("Crear tarea", "1"));
                    ddlAccion.Items.Add(new ListItem("Editar tarea", "2"));
                    ddlAccion.Items.Add(new ListItem("Visualizar tareas", "3"));

                    objCat.CargaUsuariosSistema(ref ddlUsuario, true);
                    ddlUsuario.DataBind();

                    for (int w = 0; w < ddlUsuario.Items.Count; w++)
                    {
                        if (ddlUsuario.Items[w].Value.Trim() == "")
                        {
                            ddlUsuario.Items[w].Text = " -Seleccionar usuario- ";
                        }

                        if (ddlUsuario.Items[w].Value == UserLogin)
                        {
                            ddlUsuario.SelectedIndex = w;
                            break;
                        }
                    }

                    objCat.CargaUsuariosSistema(ref chk_Involucrados, false);
                    chk_Involucrados.DataBind();

                    for (int w = 0; w < chk_Involucrados.Items.Count; w++)
                    {
                        if (chk_Involucrados.Items[w].Value == UserLogin)
                        {
                            chk_Involucrados.Items.RemoveAt(w);
                            break;
                        }
                    }

                    objCat.ListaEstadosTareas(ref ddlEstado, false);
                    ddlEstado.DataBind();

                    ddlTareas.DataSource     = Res;
                    ddlTareas.DataTextField  = "Descripcion";
                    ddlTareas.DataValueField = "IdTarea";
                }

                if (ddlUsuario.SelectedIndex > 0)
                {
                    objCat.CategoriasTarea(ref ddlCategoria, UserLogin);
                    ddlCategoria.DataBind();
                    ddlCategoria.Items.Add(new ListItem("Crear nueva categoría", "-1"));
                    ddlCategoria.Items.Add(new ListItem("Todas", "-2"));

                    for (int w = 0; w <= ddlCategoria.Items.Count; w++)
                    {
                        if (ddlCategoria.Items[w].Value == "-2")
                        {
                            ddlCategoria.SelectedIndex = w;
                            btnProcesar.Enabled        = true;
                            break;
                        }
                    }

                    if (/*ddlUsuario.SelectedValue == hddUsuario.Value && */ ddlCategoria.Items.Count == 2)
                    {
                        pnlCat.Visible = true;

                        for (int w = 0; w <= ddlCategoria.Items.Count; w++)
                        {
                            if (ddlCategoria.Items[w].Value == "-1")
                            {
                                ddlCategoria.SelectedIndex = w;
                                break;
                            }
                        }
                    }
                    else
                    {
                        pnlCat.Visible = false;
                    }
                }
            }
            else
            {
                DatosGenerales.EnviaMensaje(Res.Rows[0][0].ToString(), "Error al cargar el calendario del usuario " + UserLogin, DatosGenerales.TiposMensaje.Error);
            }
        }
示例#10
0
        protected void ddlTareas_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLServidores objSrv = new BLServidores();

            int SrvT_Id = 0;

            int.TryParse(ddlTareas.SelectedValue, out SrvT_Id);

            if (SrvT_Id > 0)
            {
                System.Data.DataSet ds = objSrv.ObtenerDetalleTarea(SrvT_Id);

                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].TableName != "Error")
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            pnlTarea.Visible = false;
                            pnlDatos.Visible = true;

                            for (int w = 0; w < ddlEstado.Items.Count; w++)
                            {
                                if (ddlEstado.Items[w].Value == ds.Tables[0].Rows[0]["SrvET_Id"].ToString())
                                {
                                    ddlEstado.SelectedIndex = w;
                                    break;
                                }
                            }

                            for (int w = 0; w < ddlCategoria.Items.Count; w++)
                            {
                                if (ddlCategoria.Items[w].Value == ds.Tables[0].Rows[0]["SrvCT_Id"].ToString())
                                {
                                    ddlCategoria.SelectedIndex = w;
                                    break;
                                }
                            }

                            if (EsFecha(ds.Tables[0].Rows[0]["SrvT_Inicio"].ToString()))
                            {
                                dtpIni.DateTime = ds.Tables[0].Rows[0]["SrvT_Inicio"].ToString();
                            }

                            if (EsFecha(ds.Tables[0].Rows[0]["SrvT_Fin"].ToString()))
                            {
                                dtpFin.DateTime = ds.Tables[0].Rows[0]["SrvT_Fin"].ToString();
                            }

                            txtDescripcion.Text = ds.Tables[0].Rows[0]["SrvT_Descripcion"].ToString();

                            if (ds.Tables[0].Rows[0]["SrvT_EsPrivada"].ToString() == "S")
                            {
                                chkPrivada.Checked = true;
                            }
                            else
                            {
                                chkPrivada.Checked = false;
                            }

                            if (!chkPrivada.Checked)
                            {
                                //for (int w = 0; w < chk_Involucrados.Items.Count; w++)
                                //{
                                //    chk_Involucrados.Items[w].Selected = false;
                                //}
                                if (ds.Tables.Count > 1)
                                {
                                    for (int w = 0; w < ds.Tables[1].Rows.Count; w++)
                                    {
                                        for (int w2 = 0; w2 < chk_Involucrados.Items.Count; w2++)
                                        {
                                            if (ds.Tables[1].Rows[w]["UserName"].ToString() == chk_Involucrados.Items[w2].Value)
                                            {
                                                chk_Involucrados.Items[w2].Selected = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                pnlInvolucrados.Visible = false;
                            }
                        }
                        else
                        {
                            DatosGenerales.EnviaMensaje("No se obtuvieron datos para la tarea seleccionada", "Carga de tarea", DatosGenerales.TiposMensaje.Error);
                        }
                    }
                    else
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DatosGenerales.EnviaMensaje("Error en consulta: " + ds.Tables[1].Rows[0][0].ToString(), "Carga de tarea", DatosGenerales.TiposMensaje.Error);
                        }
                        else
                        {
                            DatosGenerales.EnviaMensaje("Error en consulta", "Carga de tarea", DatosGenerales.TiposMensaje.Error);
                        }
                    }
                }
                else
                {
                    DatosGenerales.EnviaMensaje("No se obtuvieron datos para la tarea seleccionada (DataSet vacío)", "Carga de tarea", DatosGenerales.TiposMensaje.Error);
                }
            }
        }