Пример #1
0
    private string Grabar(string sRecursos, string sProys)
    {
        string  sResul = "", sItem;
        int     idPSN, idUser;
        bool    bDeriva, bNotif = false;
        decimal costecon = 0, costerep = 0;

        try
        {
            if (sRecursos == "" || sProys == "")
            {//Tenemos lista vacía. No hacemos nada
            }
            else
            {//Con la cadenas generamos listas y las recorremos para grabar cada elemento
                string[] aRecursos = Regex.Split(sRecursos, @"##");
                for (int i = 0; i < aRecursos.Length; i++)
                {
                    idUser = int.Parse(aRecursos[i]);

                    string[] aItems = Regex.Split(sProys, @"##");
                    for (int j = 0; j < aItems.Length; j++)
                    {
                        sItem = aItems[j];
                        string[] aIt = Regex.Split(sItem, @",");
                        idPSN = int.Parse(aIt[0]);
                        if (aIt[3] == "T")
                        {
                            bDeriva = true;
                        }
                        else
                        {
                            bDeriva = false;
                        }
                        costecon = 0;
                        costerep = 0;
                        SqlDataReader dr = USUARIOPROYECTOSUBNODO.GetCoste(idPSN, idUser);
                        if (dr.Read())
                        {
                            costecon = decimal.Parse(dr["coste_con"].ToString());
                            costerep = decimal.Parse(dr["coste_rep"].ToString());
                        }
                        dr.Close();
                        dr.Dispose();
                        //ID item, id nodo, anomes del ultimo cierre economico, id proyectosubnodo
                        sResul += PonerRecurso(idUser, int.Parse(aIt[1]), int.Parse(aIt[2]), idPSN, bDeriva, costecon, costerep, bNotif);
                    }
                }//for
            }
            if (sResul != "")
            {
                sResul = "Error@#@" + sResul;
            }
            else
            {
                sResul = "OK@#@";
            }
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar", ex);
        }
        return(sResul);
    }
Пример #2
0
    private string Grabar(string sPSN, string sRecursos, string t305_avisorecursopst)
    {
        string  sResul = "", sItem;
        int     idPSN = int.Parse(sPSN), idUser;
        bool    bDeriva, bNotif;
        decimal costecon = 0, costerep = 0;

        try
        {
            if (sPSN == "" || sRecursos == "")
            {//Tenemos lista vacía. No hacemos nada
            }
            else
            {//Con la cadena generamos una lista y la recorremos para grabar cada elemento
                string[] aRecursos = Regex.Split(sRecursos, @"##");
                for (int i = 0; i < aRecursos.Length; i++)
                {
                    sItem = aRecursos[i];
                    string[] aIt = Regex.Split(sItem, @",");

                    idUser = int.Parse(aIt[0]);
                    if (aIt[3] == "T")
                    {
                        bDeriva = true;
                    }
                    else
                    {
                        bDeriva = false;
                    }

                    if (t305_avisorecursopst == "S")
                    {
                        bNotif = true;
                    }
                    else
                    {
                        bNotif = false;
                    }

                    costecon = 0;
                    costerep = 0;

                    SqlDataReader dr = USUARIOPROYECTOSUBNODO.GetCoste(idPSN, idUser);
                    if (dr.Read())
                    {
                        costecon = decimal.Parse(dr["coste_con"].ToString());
                        costerep = decimal.Parse(dr["coste_rep"].ToString());
                    }
                    dr.Close();
                    dr.Dispose();
                    sResul += PonerRecurso(idUser, int.Parse(aIt[2]), idPSN, bDeriva, costecon, costerep, bNotif);
                }//for
            }
            if (sResul != "")
            {
                sResul = "Error@#@" + sResul;
            }
            else
            {
                sResul = "OK@#@";
            }
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar", ex);
        }
        return(sResul);
    }