Пример #1
0
        private void CargarDatosSoftware()
        {
            BLSoftware oblSoftware = new BLSoftware();

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

            txtNombreLicenciaU.Text = software.Descripcion;
            txtCantidadU.Text       = software.NumeroLicencias.ToString();
            txtVersionU.Text        = software.Version;
        }
Пример #2
0
        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();
                }
            }
        }
Пример #3
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();
            }
        }