Esempio n. 1
0
        public List <ZEBAN_C_BE> ZEBAN_C_GET(IDataReader reader)
        {
            List <ZEBAN_C_BE> zeban = new List <ZEBAN_C_BE>();

            try
            {
                while (reader.Read())
                {
                    ZEBAN_C_BE z = new ZEBAN_C_BE();

                    z.ID         = Int32.Parse(reader["ID"].ToString());
                    z.BANFN      = Int32.Parse(reader["BANFN"].ToString());
                    z.FK_USUARIO = reader["FK_USUARIO"].ToString();
                    z.FECHA      = DateTime.Parse(reader["FECHA"].ToString());
                    z.TEXTO      = reader["TEXTO"].ToString();

                    zeban.Add(z);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
            }
            return(zeban);
        }
Esempio n. 2
0
        public string cancelar(string banfn, string user, string url, string comm)
        {
            string[] ur = url.Split('/');
            string   u  = "";

            for (int i = 0; i < ur.Length - 1; i++)
            {
                u += ur[i] + "/";
            }
            List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn);

            if (requ.Count > 0)
            {
                //int status = Int32.Parse(requ[0].STATUS);
                int status = 0;
                status = rol(USUARIO_BLL.GET(requ[0].FK_USUARIO)[0]);
                //if (status > 0)
                //{
                //    status--;
                //}
                //requ[0].STATUS = status + "";
                requ[0].STATUS = "-2";
                requ[0].APROBO = "";
                int i = ZEBAN_P_BLL.UPDATE(requ[0]);
                if (i > 0)
                {
                    ZEBAN_H_BE his = new ZEBAN_H_BE();
                    his.BANFN    = banfn;
                    his.FECHA    = DateTime.Now;
                    his.NIPLOGIN = user;
                    ZEBAN_H_BLL.INSERT(his);

                    ZEBAN_C_BE com = new ZEBAN_C_BE();
                    com.BANFN      = Int32.Parse(banfn);
                    com.FK_USUARIO = user;
                    com.TEXTO      = "CANCELADO POR: \n" + comm;
                    ZEBAN_C_BLL.INSERT(com);


                    //enviarR(user, Int32.Parse(banfn), u, comm);
                    return("Se ha cancelado la requisición");
                }
            }
            return("Hubo un error al cancelar la requisición");
        }
Esempio n. 3
0
        public string addComent(string banfn, string user, string url, string comm)
        {
            string[] ur = url.Split('/');
            string   u  = "";

            for (int i = 0; i < ur.Length - 1; i++)
            {
                u += ur[i] + "/";
            }

            ZEBAN_C_BE com = new ZEBAN_C_BE();

            com.BANFN      = Int32.Parse(banfn);
            com.FK_USUARIO = user;
            com.TEXTO      = comm;
            ZEBAN_C_BLL.INSERT(com);

            return(u);
        }
        public static string crear2(string url, string valores, string comentario, string r, string us)// Crea requisición
        {
            string tipo = "";
            string id   = "";



            ZEBAN_P_BE header = new ZEBAN_P_BE();

            header.FK_USUARIO   = us;
            header.STATUS       = "0";//getStatus(user) + "";
            header.F_APROBACION = DateTime.Now;
            header.REFERENCIA   = r;

            List <ZEBAN_BE>   items = new List <ZEBAN_BE>();
            List <ZEBAN_I_BE> imps  = new List <ZEBAN_I_BE>();
            List <ZEBAN_S_BE> serv  = new List <ZEBAN_S_BE>();


            string[] tabla        = valores.Split('|');
            string   valores_temp = "";
            int      cont         = 0;

            for (int i = 0; i < tabla.Length - 1; i += 9)
            {
                if (cont > 0)
                {
                    cont = (i / 9) + 1;//27.01.2017 i/8
                }
                else
                {
                    cont = i + 1;
                }
                valores_temp = tabla[i + 2] + "|"
                               + tabla[i + 3] + "|" + tabla[i + 4] + "|" + tabla[i + 5] + "|" + tabla[i + 6] + "|" + tabla[i + 7] + "|" + tabla[i + 8] + "|";
                tipo = tabla[i];
                id   = tabla[i + 1];

                if (tipo == "s")
                {
                    //res = creaServicios(valores, id, comentario);
                    List <Object> list = new List <object>();
                    list = creaServicios(valores_temp, id, cont);

                    ZEBAN_BE   item_s = new ZEBAN_BE();
                    ZEBAN_I_BE imp_s  = new ZEBAN_I_BE();
                    ZEBAN_S_BE serv_s = new ZEBAN_S_BE();

                    item_s = (ZEBAN_BE)list[0];
                    items.Add(item_s);
                    imp_s = (ZEBAN_I_BE)list[1];
                    imps.Add(imp_s);
                    serv_s = (ZEBAN_S_BE)list[2];
                    serv.Add(serv_s);
                }
                else if (tipo == "a")
                {
                    //res = creaActivos(valores, id, comentario);
                    List <Object> list = new List <object>();
                    list = creaActivos(valores_temp, id, cont);

                    ZEBAN_BE   item_i = new ZEBAN_BE();
                    ZEBAN_I_BE imp_i  = new ZEBAN_I_BE();
                    ZEBAN_S_BE serv_i = new ZEBAN_S_BE();

                    item_i = (ZEBAN_BE)list[0];
                    items.Add(item_i);
                    imp_i = (ZEBAN_I_BE)list[1];
                    imps.Add(imp_i);
                    serv_i = (ZEBAN_S_BE)list[2];
                    serv.Add(serv_i);
                }
                else if (tipo == "m")
                {
                    ZEBAN_BE item = new ZEBAN_BE();
                    item = creaMateriales(valores_temp, id, cont);
                    items.Add(item);
                }
                else
                {
                    //res = creaServicios(valores, id, comentario);
                    List <Object> list = new List <object>();
                    list = creaImputa(valores_temp, id, cont);

                    ZEBAN_BE   item_s = new ZEBAN_BE();
                    ZEBAN_I_BE imp_s  = new ZEBAN_I_BE();
                    ZEBAN_S_BE serv_s = new ZEBAN_S_BE();

                    item_s = (ZEBAN_BE)list[0];
                    items.Add(item_s);
                    imp_s = (ZEBAN_I_BE)list[1];
                    imps.Add(imp_s);
                }
            }


            int conf = ZEBAN_P_BLL.INSERT(header); //Insertar registro en SQL
            List <ZEBAN_P_BE> zeban_p = ZEBAN_P_BLL.GET();
            int b     = zeban_p[(zeban_p.Count - 1)].BANFN;
            int banfn = b;

            for (int i = 0; i < items.Count; i++)
            {
                items[i].BANFN = b;
            }
            for (int i = 0; i < imps.Count; i++)
            {
                imps[i].BANFN = b;
            }
            for (int i = 0; i < serv.Count; i++)
            {
                serv[i].BANFN = b;
            }

            conf += ZEBAN_BLL.INSERT(items);
            if (imps.Count > 0)
            {
                conf += ZEBAN_I_BLL.INSERT(imps);
            }
            if (serv.Count > 0)
            {
                conf += ZEBAN_S_BLL.INSERT(serv);
            }
            if (!comentario.Equals(""))
            {
                ZEBAN_C_BE com = new ZEBAN_C_BE();
                com.BANFN      = banfn;
                com.FK_USUARIO = us;
                com.TEXTO      = comentario;

                conf += ZEBAN_C_BLL.INSERT(com);
            }

            //USUARIO_BE u = USUARIO_BLL.GET(us)[0];
            //enviar(us, banfn, url);
            USUARIO_BE usuarioBe = USUARIO_BLL.GET(us)[0];

            using (List <USUARIO_BE> .Enumerator enumerator = USUARIO_BLL.GET(USUARIO_BLL.GET(us)[0].AREA).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    USUARIO_BE current = enumerator.Current;
                    if (current.GEREN | current.DIREC)
                    {
                        header.BANFN  = (b);
                        header.STATUS = ("2");
                        conf         += ZEBAN_P_BLL.UPDATE(header);
                        enviarA(usuarioBe.NipLogin, b, url);
                    }
                    else
                    {
                        enviar(us, b, url);
                    }
                }
            }

            return("B");
        }
 public abstract int ZEBAN_C_DELETE(ZEBAN_C_BE comentario);
 public abstract int ZEBAN_C_INSERT(ZEBAN_C_BE comentario);
Esempio n. 7
0
 public static int DELETE(ZEBAN_C_BE comentario)
 {
     return(AbstractDataAccesLayerHelper.GetDataAccessLayer().ZEBAN_C_DELETE(comentario));
 }
Esempio n. 8
0
 public static int INSERT(ZEBAN_C_BE comentario)
 {
     return(AbstractDataAccesLayerHelper.GetDataAccessLayer().ZEBAN_C_INSERT(comentario));
 }
Esempio n. 9
0
        public string rechazar(string banfn, string user, string url, string comm)
        {
            string[] ur = url.Split('/');
            string   u  = "";

            for (int i = 0; i < ur.Length - 1; i++)
            {
                u += ur[i] + "/";
            }
            List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn);

            if (requ.Count > 0)
            {
                int status = 0;
                status = rol(USUARIO_BLL.GET(user)[0]);
                if (status == 4 & !requ[0].STATUS.Trim().Equals("0") & !requ[0].STATUS.Trim().Equals("1"))
                {
                    requ[0].STATUS = "2";
                    int             i   = ZEBAN_P_BLL.UPDATE(requ[0]);
                    List <ZEBAN_BE> pos = ZEBAN_BLL.GET(Int16.Parse(banfn));
                    foreach (ZEBAN_BE p in pos)
                    {
                        List <ZEBAN_I_BE> imp = ZEBAN_I_BLL.GET(p.BANFN, p.BNFPO);
                        foreach (ZEBAN_I_BE im in imp)
                        {
                            im.COSTCENTER = "";
                            im.GL_ACCOUNT = "";
                        }
                        ZEBAN_I_BLL.UPDATE(imp);
                    }

                    ZEBAN_H_BE his = new ZEBAN_H_BE();
                    his.BANFN    = banfn;
                    his.FECHA    = DateTime.Now;
                    his.NIPLOGIN = user;
                    ZEBAN_H_BLL.INSERT(his);

                    ZEBAN_C_BE com = new ZEBAN_C_BE();
                    com.BANFN      = Int32.Parse(banfn);
                    com.FK_USUARIO = user;
                    com.TEXTO      = comm;
                    ZEBAN_C_BLL.INSERT(com);

                    //ENVIAR CORREO A CONTABILIDAD.
                    enviarConta(Int32.Parse(banfn), u, comm);
                    return("Se ha rechazado la requisición");
                }
                else
                {
                    requ[0].STATUS    = "-1";
                    requ[0].COMPRADOR = "";
                    int i = ZEBAN_P_BLL.UPDATE(requ[0]);
                    if (i > 0)
                    {
                        ZEBAN_H_BE his = new ZEBAN_H_BE();
                        his.BANFN    = banfn;
                        his.FECHA    = DateTime.Now;
                        his.NIPLOGIN = user;
                        ZEBAN_H_BLL.INSERT(his);

                        ZEBAN_C_BE com = new ZEBAN_C_BE();
                        com.BANFN      = Int32.Parse(banfn);
                        com.FK_USUARIO = user;
                        com.TEXTO      = comm;
                        ZEBAN_C_BLL.INSERT(com);


                        enviarR(user, Int32.Parse(banfn), u, comm);
                        return("Se ha rechazado la requisición");
                    }
                }
            }
            return("Hubo un error al rechazar la requisición");
        }