Esempio n. 1
0
        private void LLenaUsuario()
        {
            BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software();

            ddlUsuarioAsignado.DataSource = blAsignacionSoftware.UsuariosConAsignacionSoftware();
            ddlUsuarioAsignado.DataBind();
        }
        protected void btnAgregarDetalle_Click(object sender, EventArgs e)
        {
            LimpiaPanelDetalle();
            txtNombreUsuarioD.Text  = "Disponible";
            hdnCve_Asignacion.Value = "0";
            int cveSoftware = Convert.ToInt32(hdnCve_Software.Value);

            BLAsignacion_Software oblAsiganacionSoftware = new BLAsignacion_Software();

            lblKeyDetalle.Enabled            = false;
            txtKeyD.Enabled                  = false;
            rfvKeyD.Enabled                  = false;
            vceKeyD.Enabled                  = false;
            TableDetalle.Controls[3].Visible = false;
            TableDetalle.Controls[1].Visible = true;

            if (oblAsiganacionSoftware.ObtieneAsignacionSoftware(cveSoftware).Count == 0)
            {
                InventarioHSC.Model.Software sofware = new Model.Software();
                BLSoftware bolSoftware = new BLSoftware();
                sofware = bolSoftware.Software(cveSoftware);
                dplNUmeroLicencia.SelectedValue = sofware.NumeroLicencias.ToString();

                hdnGenerrarControles.Value = "1";
                GeneraControles(sofware.NumeroLicencias);
            }
            else
            {
                dplNUmeroLicencia.SelectedValue = "0";
            }

            lblTituloPanelDetalle.Text = ".: Agregar Licencia :.";
            mpeDetalleAsignacion.Show();
        }
Esempio n. 3
0
        private void llenarArea_Solicita()
        {
            BLAsignacion_Software asignacion = new BLAsignacion_Software();

            dplAreaSolicita.DataSource = asignacion.ObtenAreaAsignada();
            dplAreaSolicita.DataBind();
        }
        private void CargaPanelDetalleaGREGAR()
        {
            int cve_Asignacion = Convert.ToInt32(gvwDetalle.DataKeys[0].Value);
            Asignacion_Software asiSoftware = new Asignacion_Software();

            asiSoftware.Cve_Asignacion = cve_Asignacion;
            BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software(asiSoftware);

            asiSoftware = blAsignacionSoftware.ObtenAsignacionSoftware();

            txtAreaSolicitaD.Text        = asiSoftware.Area_Solicita;
            txtCentroCostosD.Text        = asiSoftware.Centro_Costo;
            txtDolaresD.Text             = asiSoftware.Dolares.ToString();
            txtFechaCompraD.Text         = asiSoftware.Fecha_Compra.ToString();
            txtFechaVencimientoD.Text    = asiSoftware.Fecha_Vencimiento.ToString();
            txtIncluido_ResponsivaD.Text = asiSoftware.Incluido_Responsiva;
            txtLenguajeD.Text            = asiSoftware.Lenguaje;
            txtLoteCodeD.Text            = asiSoftware.Lote_Code;
            txtMaterialD.Text            = asiSoftware.Material;
            txtNoFacturaD.Text           = asiSoftware.Numero_Factura.ToString();
            txtNoRequisicionCompraD.Text = asiSoftware.Numero_Requisicion_Compra.ToString();
            txtNoTarjetaD.Text           = asiSoftware.Numero_Taejeta;
            txtObservacionD.Text         = asiSoftware.Observaciones;
            txtPesosD.Text      = asiSoftware.Pesos.ToString();
            txtProveedorD.Text  = asiSoftware.Proveedor;
            txtResponsivaD.Text = asiSoftware.Responsiva;
            txtSucursalD.Text   = asiSoftware.Sucursal;
        }
        protected void gvwDetalle_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            BLAsignacion_Software oblAsiganacionSoftware = new BLAsignacion_Software();

            gvwDetalle.DataSource = oblAsiganacionSoftware.ObtieneAsignacionSoftware(Convert.ToInt32(hdnCve_Software.Value));
            gvwDetalle.PageIndex  = e.NewPageIndex;
            gvwDetalle.DataBind();
        }
Esempio n. 6
0
        protected void ddlUsuarioAsignado_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!ddlUsuarioAsignado.SelectedItem.Value.Equals("Seleccionar") && !ddlUsuarioAsignado.SelectedItem.Value.Trim().Equals("--- Seleccionar ---"))
            {
                hdnNuevoUsuario.Value = "0";
                BLAsignacion_Software asinacionSoftware = new BLAsignacion_Software();
                pnlNuevoUsuario.Visible    = false;
                pnlUsuarioAsignado.Visible = true;

                List <DetalleAsignacionSoftware> detalleAsignacion =
                    asinacionSoftware.DetalleAsignacionSoftware(ddlUsuarioAsignado.SelectedItem.Value);

                gvwSoftwareAsignado.DataSource = detalleAsignacion;
                gvwSoftwareAsignado.DataBind();

                string NombreUsuario = string.Empty;

                NombreUsuario = ddlUsuarioAsignado.SelectedItem.Value;

                BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software();

                gvLiberacionSoftware.DataSource = blAsignacionSoftware.DetalleAsignacionSoftware(NombreUsuario);
                gvLiberacionSoftware.DataBind();

                if (detalleAsignacion.Count > 0)
                {
                    pnlAsignacionSoftware.Visible = true;
                    pnlLiberacion.Visible         = true;
                }
                else
                {
                    pnlAsignacionSoftware.Visible = false;
                    pnlLiberacion.Visible         = false;
                }

                if (detalleAsignacion.Count > 0 && detalleAsignacion[0].Area_Solicita != "")
                {
                    dplAreaSolicita.SelectedValue = detalleAsignacion[0].Area_Solicita;
                }
                else
                {
                    dplAreaSolicita.SelectedIndex = 0;
                }
            }
            else
            {
                cvUsuarioAsignado.Enabled     = true;
                vcUsuarioAsiganado.Enabled    = true;
                pnlAsignacionSoftware.Visible = false;
                pnlLiberacion.Visible         = false;
                gvwSoftwareAsignado.DataBind();
                gvLiberacionSoftware.DataBind();
            }
        }
        protected void btnExcelDetalleE_Click(object sender, EventArgs e)
        {
            if (gvwDetalle.PageCount > 1)
            {
                BLAsignacion_Software oblAsiganacionSoftware = new BLAsignacion_Software();
                gvwDetalle.AllowPaging = false;
                gvwDetalle.DataSource  = oblAsiganacionSoftware.ObtieneAsignacionSoftware(Convert.ToInt32(this.hdnCve_Software.Value));
                gvwDetalle.DataBind();
            }

            string rutaArchivo = this.gvwDetalle.ToExcel(Server.MapPath("~/Forms/Docs/Export/"), "Resultado_de_Asignacion_Software");

            Response.Redirect("~/Handlers/HandlerDescargaExcel.ashx?rutaArchivo=" + rutaArchivo + "&nombreArchivo=Resultado_de_Asignacion_Software.xlsx");
        }
        protected void gvwSoftware_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (!e.CommandName.Equals("Page"))
            {
                int index        = Convert.ToInt32(e.CommandArgument);
                int cve_Software = Convert.ToInt32(gvwSoftware.DataKeys[index].Value);
                hdnCve_Software.Value = cve_Software.ToString();

                if (e.CommandName.Equals("InfoGen"))
                {
                    BLSoftware            oblSoftware            = new BLSoftware();
                    BLAsignacion_Software oblAsiganacionSoftware = new BLAsignacion_Software();

                    List <TotalesSoftware> totalesSoftware =
                        oblSoftware.ObtieneTotalesSoftware(cve_Software);

                    grvTotalTipo.DataSource = totalesSoftware;
                    grvTotalTipo.DataBind();

                    gvwDetalle.DataSource = oblAsiganacionSoftware.ObtieneAsignacionSoftware(cve_Software);
                    gvwDetalle.DataBind();

                    InventarioHSC.Model.Software software = oblSoftware.Software(Convert.ToInt32(hdnCve_Software.Value));

                    string xmlData = oblSoftware.xmlDataTotales(totalesSoftware, software.Descripcion);

                    HabilitarBotonAgregarDetalle(true);

                    StringBuilder Clientscript = new StringBuilder();
                    Clientscript.Append("<script>");
                    Clientscript.Append("updateChartTotalesSoftware(\"" + xmlData + "\");");
                    Clientscript.Append("</script>");

                    if (!ClientScript.IsStartupScriptRegistered("udpChart"))
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "udpChart", Clientscript.ToString(), false);
                    }
                }
                else if (e.CommandName.Equals("Editar"))
                {
                    hdnCve_Software.Value = cve_Software.ToString();
                    lblInfo.Text          = ".: Actualizar :.";
                    CargarDatosSoftware();
                    txtCantidadU.Enabled = false;
                    mpeDatosSoftware.Show();
                }
            }
        }
Esempio n. 9
0
        protected void gvLiberacionSoftware_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            string NombreUsuario = string.Empty;

            if (hdnNuevoUsuario.Value.Equals("1"))
            {
                NombreUsuario = txtUsuarioNuevo.Text;
            }
            else
            {
                NombreUsuario = ddlUsuarioAsignado.SelectedItem.Value;
            }

            BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software();

            SelectionManager.KeepSelection((GridView)sender);

            gvLiberacionSoftware.DataSource = blAsignacionSoftware.DetalleAsignacionSoftware(NombreUsuario);
            gvLiberacionSoftware.PageIndex  = e.NewPageIndex;
            gvLiberacionSoftware.DataBind();
        }
Esempio n. 10
0
        protected void btnLiberarSoftware_Click(object sender, EventArgs e)
        {
            try
            {
                string Mensaje = string.Empty;

                foreach (GridViewRow gr in gvLiberacionSoftware.Rows)
                {
                    CheckBox chkSeleccionado = (CheckBox)gr.Cells[0].FindControl("chkSelecciona");

                    if (chkSeleccionado.Checked)
                    {
                        string s_idImte = gvLiberacionSoftware.DataKeys[gr.RowIndex].Values["Cve_Asignacion"].ToString();

                        Asignacion_Software asignacionSoftware = new Asignacion_Software();
                        asignacionSoftware.Cve_Asignacion = Convert.ToInt32(s_idImte);

                        BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software(asignacionSoftware);
                        asignacionSoftware = blAsignacionSoftware.ObtenAsignacionSoftware();
                        asignacionSoftware.Nombre_Usuario = "Disponible";
                        asignacionSoftware.Area_Solicita  = null;

                        blAsignacionSoftware = new BLAsignacion_Software(asignacionSoftware);
                        Mensaje = blAsignacionSoftware.ActualiaAsignacionSoftware();
                    }
                }

                List <int> idSelected = HttpContext.Current.Session["idSelectedSess"] as List <int>;

                if (idSelected != null)
                {
                    foreach (int item in idSelected)
                    {
                        Asignacion_Software asignacionSoftware = new Asignacion_Software();
                        asignacionSoftware.Cve_Asignacion = item;

                        BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software(asignacionSoftware);
                        asignacionSoftware = blAsignacionSoftware.ObtenAsignacionSoftware();
                        asignacionSoftware.Nombre_Usuario = "Disponible";
                        asignacionSoftware.Area_Solicita  = null;

                        blAsignacionSoftware = new BLAsignacion_Software(asignacionSoftware);
                        blAsignacionSoftware.ActualiaAsignacionSoftware();
                    }
                }

                HttpContext.Current.Session["idSelectedSess"] = null;

                if (Mensaje.Equals("La Asignacion de software fue actualizado correctamente"))
                {
                    CambiaEstadoNotificacion("Info", true, "La liberación de software se realizó correctamente");
                    CambiaEstadoNotificacion("Warning", false, string.Empty);

                    if (hdnNuevoUsuario.Value.Equals("1"))
                    {
                        string AreaSolicita = dplAreaSolicita.SelectedItem.Text;
                        LLenaUsuario();
                        llenarArea_Solicita();

                        ddlUsuarioAsignado.SelectedValue = txtUsuarioNuevo.Text;
                        dplAreaSolicita.SelectedValue    = AreaSolicita;
                        pnlNuevoUsuario.Visible          = false;
                        pnlUsuarioAsignado.Visible       = true;
                    }
                    else
                    {
                        ddlUsuarioAsignado_SelectedIndexChanged(sender, e);
                    }

                    LabelInfo.Focus();
                }
            }
            catch (Exception ex)
            {
                CambiaEstadoNotificacion("Info", false, string.Empty);
                CambiaEstadoNotificacion("Warning", true, "Error: " + ex.Message);
                LabelError.Focus();
                HttpContext.Current.Session["idSelectedSess"] = null;
            }
        }
Esempio n. 11
0
        protected void btnGuardaDetalle_Click(object sender, EventArgs e)
        {
            DateTime?value        = null;
            int?     valueInt     = null;
            decimal? valueDecimal = null;

            try
            {
                if (hdnCve_Asignacion.Value.Equals("0"))
                {
                    if (!this.dplNUmeroLicencia.SelectedItem.Text.Equals("0"))
                    {
                        Asignacion_Software asiSoftware            = new Asignacion_Software();
                        int numeroDeLicencias                      = Convert.ToInt32(dplNUmeroLicencia.SelectedItem.Text);
                        BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software(asiSoftware);

                        for (int i = 0; i < numeroDeLicencias; i++)
                        {
                            asiSoftware.Cve_Software      = Convert.ToInt32(hdnCve_Software.Value);
                            asiSoftware.Area_Solicita     = txtAreaSolicitaD.Text.Trim().Equals("") ? null : txtAreaSolicitaD.Text;
                            asiSoftware.Centro_Costo      = txtCentroCostosD.Text.Trim().Equals("") ? null : txtCentroCostosD.Text;
                            asiSoftware.Dolares           = txtDolaresD.Text.Trim().Equals("") ? valueDecimal : Convert.ToDecimal(txtDolaresD.Text);
                            asiSoftware.Fecha_Compra      = txtFechaCompraD.Text.Trim().Equals("") ? value : Convert.ToDateTime(txtFechaCompraD.Text);
                            asiSoftware.Fecha_Vencimiento = txtFechaVencimientoD.Text.Trim().Equals("") ? value : Convert.ToDateTime(txtFechaVencimientoD.Text);
                            asiSoftware.Responsiva        = txtIncluido_ResponsivaD.Text.Trim().Equals("") ? null : txtIncluido_ResponsivaD.Text;

                            int initContador = 4;

                            TextBox textKey = (TextBox)TableDetalle.FindControl("txtKeyR" + initContador);

                            if (textKey != null)
                            {
                                asiSoftware.Key = textKey.Text;
                            }

                            asiSoftware.Lenguaje                  = txtLenguajeD.Text.Equals("") ? null : txtLenguajeD.Text;
                            asiSoftware.Lote_Code                 = txtLoteCodeD.Text.Equals("") ? null : txtLoteCodeD.Text;
                            asiSoftware.Material                  = txtMaterialD.Text.Equals("") ? null : txtMaterialD.Text;
                            asiSoftware.Numero_Factura            = txtNoFacturaD.Text.Trim().Equals("") ? valueInt : Convert.ToInt32(txtNoFacturaD.Text);
                            asiSoftware.Nombre_Usuario            = txtNombreUsuarioD.Text;
                            asiSoftware.Numero_Requisicion_Compra = txtNoRequisicionCompraD.Text.Trim().Equals("") ? valueInt : Convert.ToInt32(txtNoRequisicionCompraD.Text);
                            asiSoftware.Numero_Taejeta            = txtNoTarjetaD.Text.Equals("") ? null : txtNoTarjetaD.Text;
                            asiSoftware.Observaciones             = txtObservacionD.Text.Equals("") ? null : txtObservacionD.Text;
                            asiSoftware.Pesos      = txtPesosD.Text.Trim().Equals("") ? valueDecimal : Convert.ToDecimal(txtPesosD.Text);
                            asiSoftware.Proveedor  = txtProveedorD.Text.Equals("") ? null : txtProveedorD.Text;
                            asiSoftware.Responsiva = txtResponsivaD.Text.Equals("") ? null : txtResponsivaD.Text;
                            asiSoftware.Sucursal   = txtSucursalD.Text.Equals("") ? null : txtSucursalD.Text;

                            blAsignacionSoftware.insertaAsignacionSoftwareNuevo();

                            initContador++;
                        }

                        gvwDetalle.DataSource = blAsignacionSoftware.ObtieneAsignacionSoftware(asiSoftware.Cve_Software);
                        gvwDetalle.DataBind();

                        BLSoftware            oblSoftware            = new BLSoftware();
                        BLAsignacion_Software oblAsiganacionSoftware = new BLAsignacion_Software();

                        List <TotalesSoftware> totalesSoftware =
                            oblSoftware.ObtieneTotalesSoftware(asiSoftware.Cve_Software);

                        grvTotalTipo.DataSource = totalesSoftware;
                        grvTotalTipo.DataBind();

                        InventarioHSC.Model.Software software = oblSoftware.Software(Convert.ToInt32(hdnCve_Software.Value));

                        string xmlData = oblSoftware.xmlDataTotales(totalesSoftware, software.Descripcion);

                        HabilitarBotonAgregarDetalle(true);

                        StringBuilder Clientscript = new StringBuilder();
                        Clientscript.Append("<script>");
                        Clientscript.Append("updateChartTotalesSoftware(\"" + xmlData + "\");");
                        Clientscript.Append("</script>");

                        if (!ClientScript.IsStartupScriptRegistered("udpChart"))
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "udpChart", Clientscript.ToString(), false);
                        }

                        mpeDetalleAsignacion.Hide();
                    }
                    else
                    {
                        LabelInfo.Focus();
                        Warning.Visible   = false;
                        LabelWarning.Text = "";
                        LabelInfo.Text    = "Seleccione el numero de licencias";
                        Info.Visible      = true;
                    }
                }
                else
                {
                    Asignacion_Software asiSoftware = new Asignacion_Software();

                    asiSoftware.Cve_Software        = Convert.ToInt32(hdnCve_Software.Value);
                    asiSoftware.Cve_Asignacion      = Convert.ToInt32(hdnCve_Asignacion.Value);
                    asiSoftware.Area_Solicita       = txtAreaSolicitaD.Text.Trim().Equals("") ? null : txtAreaSolicitaD.Text;
                    asiSoftware.Centro_Costo        = txtCentroCostosD.Text.Trim().Equals("") ? null : txtCentroCostosD.Text;
                    asiSoftware.Dolares             = txtDolaresD.Text.Trim().Equals("") ? valueDecimal : Convert.ToDecimal(txtDolaresD.Text);
                    asiSoftware.Fecha_Compra        = txtFechaCompraD.Text.Trim().Equals("") ? value : Convert.ToDateTime(txtFechaCompraD.Text);
                    asiSoftware.Fecha_Vencimiento   = txtFechaVencimientoD.Text.Trim().Equals("") ? value : Convert.ToDateTime(txtFechaVencimientoD.Text);
                    asiSoftware.Incluido_Responsiva = txtIncluido_ResponsivaD.Text.Trim().Equals("") ? null : txtIncluido_ResponsivaD.Text;
                    asiSoftware.Key                       = txtKeyD.Text;
                    asiSoftware.Lenguaje                  = txtLenguajeD.Text.Trim().Equals("") ? null : txtLenguajeD.Text;
                    asiSoftware.Lote_Code                 = txtLoteCodeD.Text.Equals("") ? null : txtLoteCodeD.Text;
                    asiSoftware.Material                  = txtMaterialD.Text.Equals("") ? null : txtMaterialD.Text;
                    asiSoftware.Numero_Factura            = txtNoFacturaD.Text.Trim().Equals("") ? valueInt : Convert.ToInt32(txtNoFacturaD.Text);
                    asiSoftware.Nombre_Usuario            = txtNombreUsuarioD.Text;
                    asiSoftware.Numero_Requisicion_Compra = txtNoRequisicionCompraD.Text.Trim().Equals("") ? valueInt : Convert.ToInt32(txtNoRequisicionCompraD.Text);
                    asiSoftware.Numero_Taejeta            = txtNoTarjetaD.Text.Equals("") ? null : txtNoTarjetaD.Text;
                    asiSoftware.Observaciones             = txtObservacionD.Text.Equals("") ? null : txtObservacionD.Text;
                    asiSoftware.Pesos                     = txtPesosD.Text.Trim().Equals("") ? valueDecimal : Convert.ToDecimal(txtPesosD.Text);
                    asiSoftware.Proveedor                 = txtProveedorD.Text.Trim().Equals("") ? null : txtProveedorD.Text;
                    asiSoftware.Responsiva                = txtResponsivaD.Text.Equals("") ? null : txtResponsivaD.Text;
                    asiSoftware.Sucursal                  = txtSucursalD.Text.Trim().Equals("") ? null : txtSucursalD.Text;

                    BLAsignacion_Software blAsignacionSoftware = new BLAsignacion_Software(asiSoftware);
                    string mensaje = blAsignacionSoftware.ActualiaAsignacionSoftware();

                    gvwDetalle.DataSource = blAsignacionSoftware.ObtieneAsignacionSoftware(Convert.ToInt32(hdnCve_Software.Value));
                    gvwDetalle.DataBind();

                    EnviaMensaje(mensaje);
                    mpeDetalleAsignacion.Hide();
                }

                hdnGenerrarControles.Value = "0";
            }
            catch (Exception ex)
            {
                LabelWarning.Focus();
                Warning.Visible            = true;
                LabelWarning.Text          = "Ocurrio un Error en el Proceso: " + ex.Message;
                LabelInfo.Text             = "";
                Info.Visible               = false;
                hdnGenerrarControles.Value = "0";
                mpeDetalleAsignacion.Hide();
            }
        }