Exemple #1
0
    protected string ObtenerDatosBeneficiario(int nUsuario)
    {
        StringBuilder sb = new StringBuilder();

        USUARIO oUsuario = USUARIO.Obtener(nUsuario);

        sb.Append(oUsuario.Nombre + "{sep}");
        sb.Append(oUsuario.t314_idusuario.ToString() + "{sep}");
        sb.Append(oUsuario.t313_denominacion + "{sep}");
        //sb.Append(oUsuario.oOficinaLiquidadora.t010_desoficina + "{sep}");
        sb.Append(oUsuario.t422_idmoneda.ToString() + "{sep}");
        sb.Append(oUsuario.nCCIberper.ToString() + "{sepdatos}");
        //sb.Append(oUsuario.oDietaKm.t069_ick.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oDietaKm.t069_icdc.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oDietaKm.t069_icmd.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oDietaKm.t069_icde.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oDietaKm.t069_icda.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oTerritorio.T007_ITERK.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oTerritorio.T007_ITERDC.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oTerritorio.T007_ITERMD.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oTerritorio.T007_ITERDE.ToString("N") + "{sep}");
        //sb.Append(oUsuario.oTerritorio.T007_ITERDA.ToString("N") + "{sep}");
        //sb.Append((oUsuario.t010_idoficina_base.HasValue) ? oUsuario.t010_idoficina_base.ToString() + "{sep}" : "" + "{sep}");
        //sb.Append(oUsuario.oOficinaLiquidadora.t010_idoficina.ToString() + "{sep}");
        //sb.Append((oUsuario.bAutorresponsable) ? "1" + "{sepdatos}" : "0" + "{sepdatos}");

        List <ElementoLista> aMotivos = MOTIVO.ObtenerMotivos(nUsuario, "");

        for (int i = 0; i < aMotivos.Count; i++)
        {
            sb.Append(aMotivos[i].sValor + "//" + aMotivos[i].sDenominacion + "//" + aMotivos[i].sDatoAux1 + "//" + aMotivos[i].sDatoAux2 + "//" + aMotivos[i].sDatoAux3 + "//" + aMotivos[i].sDatoAux4 + "{sep}");
        }
        sb.Append("{sepdatos}");

        //if (Profesional.bPerteneceVariasEmpresas(nUsuario))
        //{
        ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(nUsuario);

        for (int i = 0; i < aEmpresas.Count; i++)
        {
            sb.Append(((string[])aEmpresas[i])[0] + "//"        //t313_idempresa
                      + ((string[])aEmpresas[i])[1] + "//"      //t313_denominacion
                      + ((string[])aEmpresas[i])[2] + "//"      //t007_idterrfis
                      + ((string[])aEmpresas[i])[3] + "//"      //t007_nomterrfis
                      + ((string[])aEmpresas[i])[4] + "//"      //T007_ITERDC
                      + ((string[])aEmpresas[i])[5] + "//"      //T007_ITERMD
                      + ((string[])aEmpresas[i])[6] + "//"      //T007_ITERDA
                      + ((string[])aEmpresas[i])[7] + "//"      //T007_ITERDE
                      + ((string[])aEmpresas[i])[8] + "{sep}"); //T007_ITERK
        }
        //}

        return(sb.ToString());
    }
Exemple #2
0
    public void obtenerEmpresas(int idEmpresaDefecto)
    {
        ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(int.Parse(Session["GVT_USUARIOSUPER"].ToString()));

        ListItem oLI = null;

        //Si no hay empresa por defecto añado opción vacía
        if (idEmpresaDefecto == 0)
        {
            oLI = new ListItem("", "0");
            cboEmpresa.Items.Add(oLI);
        }
        for (int i = 0; i < aEmpresas.Count; i++)
        {
            oLI = new ListItem(((string[])aEmpresas[i])[1], ((string[])aEmpresas[i])[0]);
            cboEmpresa.Items.Add(oLI);
        }
    }
    protected string ObtenerDatosEmpresas(int nUsuario)
    {
        StringBuilder sb = new StringBuilder();

        ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(nUsuario);

        for (int i = 0; i < aEmpresas.Count; i++)
        {
            sb.Append(((string[])aEmpresas[i])[0] + "//"        //t313_idempresa
                      + ((string[])aEmpresas[i])[1] + "//"      //t313_denominacion
                      + ((string[])aEmpresas[i])[2] + "//"      //t007_idterrfis
                      + ((string[])aEmpresas[i])[3] + "//"      //t007_nomterrfis
                      + ((string[])aEmpresas[i])[4] + "//"      //T007_ITERDC
                      + ((string[])aEmpresas[i])[5] + "//"      //T007_ITERMD
                      + ((string[])aEmpresas[i])[6] + "//"      //T007_ITERDA
                      + ((string[])aEmpresas[i])[7] + "//"      //T007_ITERDE
                      + ((string[])aEmpresas[i])[8] + "{sep}"); //T007_ITERK
        }
        return(sb.ToString());
    }
Exemple #4
0
    protected void setEmpresaTerritorio(int nUsuario)
    {
        //1ºComprobar si el profesional tiene más de una empresa.
        //1ºComprobar si el profesional tiene más de una empresa.
        ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(nUsuario);

        txtEmpresa.Text   = "";
        hdnIDEmpresa.Text = "";

        if (aEmpresas.Count > 1)
        {
            txtEmpresa.Style.Add("display", "none");
            cboEmpresa.Style.Add("display", "block");
            ListItem oLI = null;
            for (int i = 0; i < aEmpresas.Count; i++)
            {
                oLI = new ListItem(((string[])aEmpresas[i])[1], ((string[])aEmpresas[i])[0]);
                oLI.Attributes.Add("idterritorio", ((string[])aEmpresas[i])[2]);

                cboEmpresa.Items.Add(oLI);

                if (cboEmpresa.Items.Count == 1 ||
                    (((string[])aEmpresas[i])[0] == "1" && nID == 0)
                    )
                {
                    cboEmpresa.SelectedValue = ((string[])aEmpresas[i])[0];
                    hdnIDEmpresa.Text        = ((string[])aEmpresas[i])[0];
                    hdnIDTerritorio.Text     = ((string[])aEmpresas[i])[2];
                }
            }
        }
        else if (aEmpresas.Count == 1)
        {
            txtEmpresa.Style.Add("display", "block");
            cboEmpresa.Style.Add("display", "none");
            hdnIDEmpresa.Text    = ((string[])aEmpresas[0])[0];
            txtEmpresa.Text      = ((string[])aEmpresas[0])[1];
            hdnIDTerritorio.Text = ((string[])aEmpresas[0])[2];
        }
    }
    //protected void setEmpresaTerritorio(int nUsuario)
    //{
    //    //1ºComprobar si el profesional tiene más de una empresa.
    //    ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(nUsuario);
    //    txtEmpresa.Text = "";
    //    hdnIDEmpresa.Text = "";

    //    if (aEmpresas.Count > 1)
    //    {
    //        txtEmpresa.Style.Add("display", "none");
    //        cboEmpresa.Style.Add("display", "block");

    //        ListItem oLI = null;
    //        for (int i = 0; i < aEmpresas.Count; i++)
    //        {
    //            oLI = new ListItem(((string[])aEmpresas[i])[1], ((string[])aEmpresas[i])[0]);
    //            oLI.Attributes.Add("idterritorio", ((string[])aEmpresas[i])[2]);
    //            oLI.Attributes.Add("nomterritorio", ((string[])aEmpresas[i])[3]);
    //            oLI.Attributes.Add("ITERDC", ((string[])aEmpresas[i])[4]);
    //            oLI.Attributes.Add("ITERMD", ((string[])aEmpresas[i])[5]);
    //            oLI.Attributes.Add("ITERDA", ((string[])aEmpresas[i])[6]);
    //            oLI.Attributes.Add("ITERDE", ((string[])aEmpresas[i])[7]);
    //            oLI.Attributes.Add("ITERK", ((string[])aEmpresas[i])[8]);

    //            cboEmpresa.Items.Add(oLI);

    //            if (cboEmpresa.Items.Count == 1 ||
    //                (((string[])aEmpresas[i])[0] == "1" && nID == 0)
    //                )
    //            {
    //                cboEmpresa.SelectedValue = ((string[])aEmpresas[i])[0];
    //                hdnIDEmpresa.Text = ((string[])aEmpresas[i])[0];
    //                hdnIDTerritorio.Text = ((string[])aEmpresas[i])[2];
    //                lblTerritorio.Text = ((string[])aEmpresas[i])[3];
    //                cldKMEX.InnerText = decimal.Parse(((string[])aEmpresas[i])[8]).ToString("N");
    //                cldDCEX.InnerText = decimal.Parse(((string[])aEmpresas[i])[4]).ToString("N");
    //                cldMDEX.InnerText = decimal.Parse(((string[])aEmpresas[i])[5]).ToString("N");
    //                cldDEEX.InnerText = decimal.Parse(((string[])aEmpresas[i])[7]).ToString("N");
    //                cldDAEX.InnerText = decimal.Parse(((string[])aEmpresas[i])[6]).ToString("N");
    //            }
    //        }
    //    }
    //    else if (aEmpresas.Count == 1)
    //    {
    //        txtEmpresa.Style.Add("display", "block");
    //        cboEmpresa.Style.Add("display", "none");
    //        hdnIDEmpresa.Text = ((string[])aEmpresas[0])[0];
    //        txtEmpresa.Text = ((string[])aEmpresas[0])[1];
    //        hdnIDTerritorio.Text = ((string[])aEmpresas[0])[2];
    //        lblTerritorio.Text = ((string[])aEmpresas[0])[3];
    //        cldKMEX.InnerText = decimal.Parse(((string[])aEmpresas[0])[8]).ToString("N");
    //        cldDCEX.InnerText = decimal.Parse(((string[])aEmpresas[0])[4]).ToString("N");
    //        cldMDEX.InnerText = decimal.Parse(((string[])aEmpresas[0])[5]).ToString("N");
    //        cldDEEX.InnerText = decimal.Parse(((string[])aEmpresas[0])[7]).ToString("N");
    //        cldDAEX.InnerText = decimal.Parse(((string[])aEmpresas[0])[6]).ToString("N");
    //    }
    //}
    protected bool setEmpresaTerritorio(int nUsuario, int idFicepi, string sInteresado, int idEmpresaDefecto, int idEmpresa)
    {
        bool bAvisoEmpresaNoVigente = false;
        //1º Comprobar si el profesional tiene más de una empresa.
        ArrayList aEmpresas = Profesional.ObtenerEmpresasTerritorios(nUsuario);

        //2º Comprobar que si se aparcó con alguna empresa, ésta sigue estando asociada la profesional. O solo tiene una empresa
        if (aEmpresas.Count > 1)
        {
            if (idEmpresa != 0)
            {
                bool bEmpresaVigente = false;
                for (int i = 0; i < aEmpresas.Count; i++)
                {
                    if (idEmpresa.ToString() == ((string[])aEmpresas[i])[0])
                    {
                        bEmpresaVigente = true;
                        break;
                    }
                }
                if (!bEmpresaVigente)
                {
                    //string sDenEmpresa = GASVI.BLL.Profesional.GetNombreEmpresa(idEmpresa);
                    //throw (new Exception("La nota se aparcó con la empresa " + sDenEmpresa + " y " + sInteresado + " ya no pertenece a la misma"));
                    idEmpresaNotaAparcada  = idEmpresa;
                    bAvisoEmpresaNoVigente = true;
                }
            }
        }
        txtEmpresa.Text   = "";
        hdnIDEmpresa.Text = "";
        if (aEmpresas.Count > 1)
        {
            #region Mas de una empresa
            txtEmpresa.Style.Add("display", "none");
            cboEmpresa.Style.Add("display", "block");
            int idEmpresaAux = idEmpresa;
            if (idEmpresaAux == 0)
            {
                idEmpresaAux = idEmpresaDefecto;
            }

            ListItem oLI = null;
            if (idEmpresaDefecto == 0 && idEmpresa == 0)
            {
                oLI = new ListItem("", "0");
                oLI.Attributes.Add("idterritorio", "");
                oLI.Attributes.Add("nomterritorio", "");
                oLI.Attributes.Add("ITERDC", "");
                oLI.Attributes.Add("ITERMD", "");
                oLI.Attributes.Add("ITERDA", "");
                oLI.Attributes.Add("ITERDE", "");
                oLI.Attributes.Add("ITERK", "");
                cboEmpresa.Items.Add(oLI);
            }
            for (int i = 0; i < aEmpresas.Count; i++)
            {
                oLI = new ListItem(((string[])aEmpresas[i])[1], ((string[])aEmpresas[i])[0]);
                oLI.Attributes.Add("idterritorio", ((string[])aEmpresas[i])[2]);
                oLI.Attributes.Add("nomterritorio", ((string[])aEmpresas[i])[3]);
                oLI.Attributes.Add("ITERDC", ((string[])aEmpresas[i])[4]);
                oLI.Attributes.Add("ITERMD", ((string[])aEmpresas[i])[5]);
                oLI.Attributes.Add("ITERDA", ((string[])aEmpresas[i])[6]);
                oLI.Attributes.Add("ITERDE", ((string[])aEmpresas[i])[7]);
                oLI.Attributes.Add("ITERK", ((string[])aEmpresas[i])[8]);
                cboEmpresa.Items.Add(oLI);

                if (idEmpresaAux.ToString() == ((string[])aEmpresas[i])[0])
                {
                    cboEmpresa.SelectedValue = ((string[])aEmpresas[i])[0];
                    hdnIDEmpresa.Text        = ((string[])aEmpresas[i])[0];
                    hdnIDTerritorio.Text     = ((string[])aEmpresas[i])[2];
                    lblTerritorio.Text       = ((string[])aEmpresas[i])[3];
                    cldKMEX.InnerText        = decimal.Parse(((string[])aEmpresas[i])[8]).ToString("N");
                    cldDCEX.InnerText        = decimal.Parse(((string[])aEmpresas[i])[4]).ToString("N");
                    cldMDEX.InnerText        = decimal.Parse(((string[])aEmpresas[i])[5]).ToString("N");
                    cldDEEX.InnerText        = decimal.Parse(((string[])aEmpresas[i])[7]).ToString("N");
                    cldDAEX.InnerText        = decimal.Parse(((string[])aEmpresas[i])[6]).ToString("N");
                }
            }
            #endregion
        }
        else if (aEmpresas.Count == 1)
        {
            #region Solo una empresa
            txtEmpresa.Style.Add("display", "block");
            cboEmpresa.Style.Add("display", "none");
            hdnIDEmpresa.Text    = ((string[])aEmpresas[0])[0];
            txtEmpresa.Text      = ((string[])aEmpresas[0])[1];
            hdnIDTerritorio.Text = ((string[])aEmpresas[0])[2];
            lblTerritorio.Text   = ((string[])aEmpresas[0])[3];
            cldKMEX.InnerText    = decimal.Parse(((string[])aEmpresas[0])[8]).ToString("N");
            cldDCEX.InnerText    = decimal.Parse(((string[])aEmpresas[0])[4]).ToString("N");
            cldMDEX.InnerText    = decimal.Parse(((string[])aEmpresas[0])[5]).ToString("N");
            cldDEEX.InnerText    = decimal.Parse(((string[])aEmpresas[0])[7]).ToString("N");
            cldDAEX.InnerText    = decimal.Parse(((string[])aEmpresas[0])[6]).ToString("N");
            #endregion
        }

        return(bAvisoEmpresaNoVigente);
    }