Esempio n. 1
0
        private void enviarA(string u, int b, string url)
        {
            Mail email = new Mail();
            int  r     = 2;

            List <USUARIO_BE> compras = USUARIO_BLL.GET(r); //Usuarios de Compras

            string[] dest3  = new string[compras.Count + 1];
            string[] names3 = new string[compras.Count + 1];

            for (int i = 0; i < compras.Count; i++)
            {
                dest3[i]  = compras[i].eMail;
                names3[i] = compras[i].NipLogin;
            }

            dest3[compras.Count]  = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].eMail;
            names3[compras.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].NipLogin;
            string asunto  = "Se ha autorizado una requisición";
            string mensaje = u.ToUpper() + " autorizó la requisición: " + b + "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br>";
            //}
            email.send(dest3, asunto, mensaje, b, url);
        }
Esempio n. 2
0
        private void enviarF(string u, int b, string url, string SAP_N)
        {
            Mail email = new Mail();

            List <USUARIO_BE> gerencia = USUARIO_BLL.GET(USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].AREA); //Usuarios gerencia de area

            string[] dest3  = new string[gerencia.Count + 1];
            string[] names3 = new string[gerencia.Count + 1];

            for (int i = 0; i < gerencia.Count; i++)
            {
                dest3[i]  = gerencia[i].eMail;
                names3[i] = gerencia[i].NipLogin;
            }

            dest3[gerencia.Count]  = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].eMail;
            names3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].NipLogin;
            string asunto  = "Se ha aprobado una requisición";
            string mensaje = u.ToUpper() + " aprobó la requisición: " + b + "<br><br>" +
                             "Solicitud de compra en SAP: " + SAP_N +
                             "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br>";
            //}
            email.send(dest3, asunto, mensaje, b, url);
        }
Esempio n. 3
0
        private void enviarGerente(int b, string url, int r)
        {
            Mail email = new Mail();
            //int r = 0;
            //r = 4;

            List <USUARIO_BE> compras = USUARIO_BLL.GET(r); //Usuarios de contabilidad

            string[] dest3  = new string[compras.Count];
            string[] names3 = new string[compras.Count];

            for (int i = 0; i < compras.Count; i++)
            {
                dest3[i]  = compras[i].eMail;
                names3[i] = compras[i].NipLogin;
            }

            string asunto  = "Requisición en espera de aprobación";
            string mensaje = "La requisición: " + b + " está en espera de aprobación<br><br>";
            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br>";
            //}

            string new_url = "";

            string[] urls = url.Split('/');
            for (int i = 0; i < urls.Length - 1; i++)
            {
                new_url += urls[i] + "/";
            }

            email.send(dest3, asunto, mensaje, b, new_url);
        }
        static private void enviar(string u, int b, string url)
        {
            Mail email = new Mail();
            //int r = 1;

            List <USUARIO_BE> gerencia = USUARIO_BLL.GET(USUARIO_BLL.GET(u)[0].AREA); //Usuarios gerencia de area

            string[] dest3  = new string[gerencia.Count];
            string[] names3 = new string[gerencia.Count];

            for (int i = 0; i < gerencia.Count; i++)
            {
                dest3[i]  = gerencia[i].eMail;
                names3[i] = gerencia[i].NipLogin;
            }

            string asunto  = "Se ha creado una requisición";
            string mensaje = u.ToUpper() + " creó la requisición: " + b + "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br>";
            //}

            string[] uurl      = url.Split('/');
            string   url_final = "";

            for (int k = 0; k < uurl.Length - 1; k++)
            {
                url_final += uurl[k] + "/";
            }
            email.send(dest3, asunto, mensaje, b, url_final);
        }
Esempio n. 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string user = user_name.Value;
            string pass = user_pass.Value;

            try
            {
                if (!user.Equals(null) && !pass.Equals(null))
                {
                    USUARIO_BE u = USUARIO_BLL.GET(user);
                    //u.ID = "admin";
                    //u.PASS = "******";
                    accionesUsuario aU = new accionesUsuario();
                    if (aU.existeUsuario(u, user, pass))
                    {
                        FormsAuthentication.RedirectFromLoginPage(user, true);
                    }
                    else
                    {
                        lblError.Text = idioma.user_error;
                    }
                }
            }
            catch
            {
                lblError.Text = "";
            }
        }
        private static void enviarA(string u, int b, string url)
        {
            Mail mail = new Mail();
            List <USUARIO_BE> usuarioBeList = USUARIO_BLL.GET(2);

            string[] dest     = new string[usuarioBeList.Count + 1];
            string[] strArray = new string[usuarioBeList.Count + 1];
            for (int index = 0; index < usuarioBeList.Count; ++index)
            {
                dest[index]     = usuarioBeList[index].eMail;
                strArray[index] = usuarioBeList[index].NipLogin;
            }
            dest[usuarioBeList.Count]     = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(string.Concat((object)b))[0].FK_USUARIO)[0].eMail;
            strArray[usuarioBeList.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(string.Concat((object)b))[0].FK_USUARIO)[0].NipLogin;
            string asunto  = "Se ha creado una requisición";
            string mensaje = u.ToUpper() + " creó la requisición: " + (object)b + "<br><br>";

            string[] strArray2 = url.Split('/');
            string   url1      = "";

            for (int index = 0; index < strArray2.Length - 1; ++index)
            {
                url1 = url1 + strArray2[index] + "/";
            }


            mail.send(dest, asunto, mensaje, b, url1);
        }
        private static int getStatus(string usuario)
        {
            List <USUARIO_BE> users = USUARIO_BLL.GET(usuario);
            USUARIO_BE        u     = new USUARIO_BE();

            int s = 0;

            if (users.Count > 0)
            {
                u = users[0];
            }

            //if (u.DIREC)
            //{
            //    s = "4";
            //}
            //else if (u.GEREN)
            //{
            //    s = "3";
            //}
            //else if (u.CONTA)
            //{
            //    s = "2";
            //}
            //else if (u.USUA)
            //{
            //    s = "1";
            //}
            //else
            //{
            //    s = "0"; //Básico
            //}
            if (u.DIREC)//Dirección
            {
                s = 5;
            }
            else if (u.GEREN)//Gerencia Gral.
            {
                s = 4;
            }
            else if (u.CONTA)//Contabilidad
            {
                s = 3;
            }
            else if (u.USUA)//Compras
            {
                s = 2;
            }
            else if (USUARIO_BLL.GET("", u.NipLogin).Count > 0)//Gerente de área
            {
                s = 1;
            }
            else
            {
                s = 0; //Básico
            }

            return(s);
        }
Esempio n. 8
0
        private void enviar(string u, int b, string url)
        {
            ////Mail email = new Mail();
            ////int r = rol(USUARIO_BLL.GET(u)[0]) + 1;
            ////if (r < 6)
            ////{
            ////    string[] dest = getDestinatarios(r, u);
            ////    USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0];
            ////    dest[dest.Length - 1] = usu.eMail;
            ////    string asunto = "Se ha aprobado una requisición: " + b;
            ////    string mensaje = u + " aprobó la requisición: " + b + "<br><br>";
            ////    email.send(dest, asunto, mensaje, b, url);
            ////}
            ////else
            ////{
            ////    string[] dest2 = new string[2];
            ////    string[] names2 = new string[2];
            ////    if (USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO).Count > 0)
            ////    {
            ////        USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0];
            ////        dest2[0] = usu.eMail;
            ////        names2[0] = usu.NipLogin;
            ////    }
            ////    dest2[1] = USUARIO_BLL.GET(u)[0].eMail;
            ////    names2[1] = USUARIO_BLL.GET(u)[0].NipLogin;
            ////    string asuntos = "Se ha aprobado una requisición: " + b;
            ////    string mensajes = u + " aprobó la requisición: " + b + "<br><br>";
            ////    for (int i = 0; i < names2.Length; i++)
            ////    {
            ////        mensajes += names2[i] + "<br><br>";
            ////    }
            ////    email.send(dest2, asuntos, mensajes, b, url);
            ////}
            Mail email = new Mail();
            //int r = 1;

            List <USUARIO_BE> gerencia = USUARIO_BLL.GET(USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].AREA); //Usuarios gerencia de area

            string[] dest3  = new string[gerencia.Count + 1];
            string[] names3 = new string[gerencia.Count + 1];

            for (int i = 0; i < gerencia.Count; i++)
            {
                dest3[i]  = gerencia[i].eMail;
                names3[i] = gerencia[i].NipLogin;
            }

            dest3[gerencia.Count]  = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].eMail;
            names3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].NipLogin;
            string asunto  = "Se ha aprobado una requisición";
            string mensaje = u.ToUpper() + " aprobó la requisición: " + b + "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br>";
            //}
            email.send(dest3, asunto, mensaje, b, url);
        }
Esempio n. 9
0
        public string getUsuario(string u)
        {
            USUARIO_BE user = USUARIO_BLL.GET(u);

            string menu = "";

            menu += "<a href='#!name' style='padding: 0;'><span class='white-text name' style='margin: 0;'>" + user.NOMBRE + "</span></a>";
            menu += "<a href='#!email' style='padding: 0;'><span class='white-text email' style='padding: 0;'>" + user.EMAIL + "</span></a>";
            menu += "<a href='#!role' style='padding: 0;'><span class='white-text email' style='padding: 0;'>" + user.NOMBRE_ROL + "</span></a>";

            return(menu);
        }
 public IActionResult LoginUsuario(USUARIO usuario)
 {
     try
     {
         usuario_bll = new USUARIO_BLL();
         return(new ObjectResult(usuario_bll.Login(usuario)));
     }
     catch (Exception e)
     {
         var exception = e.GetBaseException();
         return(BadRequest(exception));
     }
 }
Esempio n. 11
0
        private void enviarConta(int b, string url, string comm)
        {
            Mail email = new Mail();
            int  r     = 3;

            List <USUARIO_BE> conta = USUARIO_BLL.GET(r); //Usuarios de contabilidad

            r = 0;
            for (int i = 0; i < conta.Count; i++)
            {
                if (rol(conta[i]) == 3)
                {
                    r++;
                }
            }
            string[] dest3  = new string[r];
            string[] names3 = new string[r];
            r = 0;

            for (int i = 0; i < conta.Count; i++)
            {
                if (rol(conta[i]) == 3)
                {
                    dest3[r]  = conta[i].eMail;
                    names3[r] = conta[i].NipLogin;
                    r++;
                }
            }
            string asunto  = "Se ha rechazado una requisición";
            string mensaje = ConfigurationManager.AppSettings["contabilidad"].ToUpper() + " rechazó la requisición: " + b + "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br><br>";
            //}
            mensaje += comentarios(comm);

            string new_url = "";

            string[] urls = url.Split('/');
            for (int i = 0; i < urls.Length - 1; i++)
            {
                new_url += urls[i] + "/";
            }

            email.send(dest3, asunto, mensaje, b, new_url);
        }
        protected void btnInicio_Click(object sender, EventArgs e)
        {
            String csname1 = "PopupScript";
            Type   cstype  = this.GetType();

            ClientScriptManager cs = Page.ClientScript;

            if (USUARIO_BLL.GET(txtUser.Text.Trim()).Count > 0)
            {
                USUARIO_BE userS = USUARIO_BLL.GET(txtUser.Text.ToUpper())[0];
                string     pass  = txtPass.Text;
                if (pass.Equals(userS.UserKey))
                {
                    HttpCookie cookie = new HttpCookie("UserName", txtUser.Text.ToUpper());
                    Session["UserName"] = txtUser.Text.ToUpper();

                    cookie.Expires = DateTime.Now.AddMinutes(600);
                    Response.Cookies.Add(cookie);

                    string user = Request.Cookies.Get("UserName").Value;


                    FormsAuthentication.RedirectFromLoginPage(txtUser.Text.ToUpper(), false);

                    //string urlDestino = "Historial.aspx";
                    //Response.Redirect(urlDestino, false);
                }
                else
                {
                    if (!cs.IsStartupScriptRegistered(cstype, csname1))
                    {
                        String cstext1 = "alert('Usuario y/o contraseña incorrecta.');";
                        cs.RegisterStartupScript(cstype, csname1, cstext1, true);
                    }
                }
            }
            else
            {
                if (!cs.IsStartupScriptRegistered(cstype, csname1))
                {
                    String cstext1 = "alert('Usuario y/o contraseña incorrecta.');";
                    cs.RegisterStartupScript(cstype, csname1, cstext1, true);
                }
            }
        }
Esempio n. 13
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. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string idPprod = Request.QueryString["ID_USUARIO"];

        if (!IsPostBack)
        {
            if (idPprod != null)
            {
                USUARIO_DTO objPermisos = USUARIO_BLL.MostrarID(Convert.ToInt32(idPprod));
                if (objPermisos != null)
                {
                    txtCodUser.Text = "" + objPermisos.ID_PERSONA_USUARIO;
                    txtNom.Text     = "" + objPermisos.NOMBRE_USUARIO;
                    txtPass.Text    = "" + objPermisos.CONTRASENA_USUARIO;
                }
            }
        }
    }
Esempio n. 15
0
        private void enviarR(string u, int b, string url, string com)
        {
            Mail email = new Mail();
            int  r     = rol(USUARIO_BLL.GET(u)[0]) + 1;

            List <ZEBAN_H_BE> hist = ZEBAN_H_BLL.GET(b);

            string[] dest3  = new string[1];
            string[] names3 = new string[1];
            ////for (int i = 0; i < hist.Count; i++)
            ////{
            ////    dest3[i] = USUARIO_BLL.GET(hist[i].NIPLOGIN)[0].eMail;
            ////    names3[i] = USUARIO_BLL.GET(hist[i].NIPLOGIN)[0].NipLogin;
            ////}

            ////dest3[hist.Count] = USUARIO_BLL.GET(u)[0].eMail;
            ////names3[hist.Count] = USUARIO_BLL.GET(u)[0].NipLogin;


            dest3[0]  = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].eMail;
            names3[0] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].NipLogin;
            string asunto  = "Se ha rechazado una requisición";
            string mensaje = u.ToUpper() + " rechazó la requisición: " + b + "<br><br>";

            //for (int i = 0; i < names3.Length; i++)
            //{
            //    mensaje += names3[i] + "<br><br>";
            //}
            mensaje += comentarios(com);
            email.send(dest3, asunto, mensaje, b, url);
            //}
            //else
            //{
            //    //string[] dest2 = new string[2];
            //    //USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0];
            //    //dest2[0] = usu.eMail;
            //    //dest2[1] = USUARIO_BLL.GET(u)[0].eMail;
            //    //string asuntos = "Se ha aprobado una requisición";
            //    //string mensajes = u + " aprobó la requisición: " + b + "<br><br>";
            //    //email.send(dest2, asuntos, mensajes, b, url);
            //}
        }
Esempio n. 16
0
        private int rol(USUARIO_BE u)
        {
            int r = 0;

            string[] contabilidad = ConfigurationManager.AppSettings["contabilidad"].Split(';');

            if (u.DIREC)
            {
                r = 6;
            }
            else if (u.GEREN)
            {
                r = 5;
            }
            else if (u.CONTA)
            {
                if (contabilidad.Contains(u.NipLogin.Trim()))
                {
                    r = 4;
                }
                else
                {
                    r = 3;
                }
            }
            else if (u.USUA)
            {
                r = 2;
            }
            else if (USUARIO_BLL.GET("", u.NipLogin).Count > 0)
            {
                r = 1;
            }
            else
            {
                r = 0;
            }
            return(r);
        }
        //static string user;
        protected void Page_Load(object sender, EventArgs e)
        {
            bool post = IsPostBack;

            try
            {
                //Button4.Attributes.Add("onclick", "return false;");
                //user = Request.Cookies.Get("UserName").Value; //Consulta cookie con nombre de usuario
                string user = Session["UserName"].ToString();
                lblUsuario.Text = "<br><strong>Usuario</strong> > " + user.ToUpper() + "<br>";
                List <USUARIO_BE> usuario = USUARIO_BLL.GET(user);
                if (usuario.Count < 1)
                {
                    string urlDestino = ConfigurationManager.AppSettings["loginPage"]; //Página configurable de login
                    Response.Redirect(urlDestino, false);
                }
            }
            catch
            {
                string urlDestino = ConfigurationManager.AppSettings["loginPage"]; //Página configurable de login
                Response.Redirect(urlDestino, false);
            }
        }
Esempio n. 18
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Usuario
        int    idUser = Convert.ToInt32(txtCodUser.Text);
        string nom    = txtNom.Text;

        byte[] pass       = System.Text.Encoding.ASCII.GetBytes(Encriptar.Encrip(txtPass.Text));
        int    idtipouser = int.Parse(tipo_user.SelectedItem.Value);
        int    idpersona  = int.Parse(persona.SelectedItem.Value);
        //Usuario Rol BD
        int idrolbd = int.Parse(rol_bd.SelectedItem.Value);
        //Usuario Rol servidor
        int idrolserver = int.Parse(rol_server.SelectedItem.Value);

        try
        {
            USUARIO_BLL.Insertar(idUser, nom, pass, idtipouser, idpersona);
            UR_BD_BLL.Insertar(idUser, idrolbd);
            URS_BLL.Insertar(idUser, idrolserver);
            Response.Redirect("~webformsADM/USUARIO/IndexUsuarios.aspx");
        }
        catch (Exception ex) { }
    }
Esempio n. 19
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");
        }
        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");
        }
Esempio n. 21
0
        private string[] getDestinatarios(int r, string u)
        {
            if (r > 0)
            {
                List <USUARIO_BE> temp22 = USUARIO_BLL.GET();
                int cont = 0;
                for (int i = 0; i < temp22.Count; i++)
                {
                    if (r.Equals(2))
                    {
                        if (temp22[i].CONTA)
                        {
                            cont++;
                        }
                    }
                    else if (r.Equals(3))
                    {
                        if (temp22[i].GEREN)
                        {
                            cont++;
                        }
                    }
                    else if (r.Equals(4))
                    {
                        if (temp22[i].DIREC)
                        {
                            cont++;
                        }
                    }
                }

                string[] dest = new string[cont + 1];
                cont = 0;
                for (int i = 0; i < temp22.Count; i++)
                {
                    if (r.Equals(2))
                    {
                        if (temp22[i].CONTA)
                        {
                            dest[cont] = temp22[i].eMail;
                            cont++;
                        }
                    }
                    else if (r.Equals(3))
                    {
                        if (temp22[i].GEREN)
                        {
                            dest[cont] = temp22[i].eMail;
                            cont++;
                        }
                    }
                    else if (r.Equals(4))
                    {
                        if (temp22[i].DIREC)
                        {
                            dest[cont] = temp22[i].eMail;
                            cont++;
                        }
                    }
                }
                //dest[cont] = USUARIO_BLL.GET(u)[0].eMail; //Agregar usuario que crea la requisición.

                return(dest);
            }
            else
            {
                return(new string[1]);
            }
        }
Esempio n. 22
0
        public string autorizar(string banfn, string user, string url)
        {
            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(user)[0]);

                //if (status > 0)
                //{
                //    status--;
                //}
                //requ[0].STATUS = status + "";
                requ[0].STATUS = (Int16.Parse(requ[0].STATUS) + 1) + "";
                if (requ[0].STATUS.Equals("1"))
                {
                    requ[0].STATUS = "2";
                }
                if (status == 4)
                {
                    if (!requ[0].COMPRADOR.Equals("-") & !requ[0].COMPRADOR.Equals(""))
                    {
                        requ[0].STATUS = "4";
                    }
                }
                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);


                    if (requ[0].STATUS.Equals("2"))
                    {
                        enviarA(user, Int32.Parse(banfn), u);
                    }
                    else if (requ[0].STATUS.Equals("4"))
                    {
                        enviarGerente(Int16.Parse(banfn), url, 4);
                    }
                    else if (requ[0].STATUS.Equals("5"))
                    {
                        enviarGerente(Int16.Parse(banfn), url, 5);
                    }
                    return("Se ha autorizado la requisición");
                }
            }
            return("Hubo un error al autorizar la requisición");
        }
Esempio n. 23
0
        public string getMenu(string u, string pg, int n, List <PAGINA_BE> pp, List <CARPETA_BE> cc)
        {
            string nivel = "";

            //--------------------------------PRODUCTIVO----------------------------------//
            //n = n - 2;//IIS
            n = n - 1;//Visual
            //--------------------------------PRODUCTIVO----------------------------------//

            while (n > 1)
            {
                nivel += "../";
                n--;
            }

            USUARIO_BE user = USUARIO_BLL.GET(u);
            //List<PAGINA_BE> pp = PAGINA_BLL.GET(u);
            //List<CARPETA_BE> cc = CARPETA_BLL.GET(u);
            string menu = "";

            pp = pp.OrderBy(o => o.PAG_ID).ToList();
            cc = cc.Distinct().ToList();

            menu += "<li class='no-padding'>";
            menu += "<ul class='collapsible collapsible-accordion'>";

            foreach (CARPETA_BE c in cc)
            {
                if (c.URL.Equals(""))
                {
                    foreach (PAGINA_BE p in pp)
                    {
                        if (c.ID.Equals(p.CAR_ID))
                        {
                            if (pg.Equals(p.URL.ToLower()))
                            {
                                menu += "<li class='bold'><a href='#'><i class='material-icons'>" + p.ICONO + "</i>" + p.TITULO + "</a></li>";
                            }
                            else
                            {
                                menu += "<li class='bold'><a href='" + nivel + p.URL + "'><i class='material-icons'>" + p.ICONO + "</i>" + p.TITULO + "</a></li>";
                            }
                        }
                    }
                }
                else
                {
                    menu += " <li class='bold'><a class='collapsible-header waves-effect waves-teal'><i class='material-icons'>" + c.ICONO + "</i>" + c.TITULO + "</a>";
                    menu += "<div class='collapsible-body'>";
                    menu += "<ul>";
                    foreach (PAGINA_BE p in pp)
                    {
                        if (c.ID.Equals(p.CAR_ID))
                        {
                            if (pg.Equals(c.URL.ToLower() + p.URL.ToLower()))
                            {
                                menu += "<li><a href='#'>" + p.TITULO + "</a></li> ";
                            }
                            else
                            {
                                menu += "<li><a href='" + nivel + c.URL + p.URL + "'>" + p.TITULO + "</a></li> ";
                            }
                        }
                    }
                    menu += "</ul>";
                    menu += "</div>";
                    menu += "</li>";
                }
            }

            //menu += "<li class='bold'><a class='collapsible-header waves-effect waves-teal'><i class='material-icons'>sync</i>Sincronización</a>";
            //menu += "<div class='collapsible-body'>";
            //menu += "<ul>";
            //menu += "<li><a href='autocomplete.html'>Autocomplete</a></li> ";
            //menu += "<li><a href='checkboxes.html'>Checkboxes</a></li>";
            //menu += "</ul>";
            //menu += "</div>";
            //menu += "</li>";

            //menu += "<li class='bold'><a class='collapsible-header waves-effect waves-teal'><i class='material-icons'>book</i>Catálogos</a>";
            //menu += "<div class='collapsible-body'>";
            //menu += "<ul>";
            //menu += "<li><a href='autocomplete.html'>Autocomplete</a></li> ";
            //menu += "<li><a href='checkboxes.html'>Checkboxes</a></li>";
            //menu += "</ul>";
            //menu += "</div>";
            //menu += "</li>";

            menu += "</ul>";
            menu += "</li>";
            return(menu);
        }
Esempio n. 24
0
        public string aprobar(string banfn, string user, string url)
        {
            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);
            string            referencia = "";//27.01.2017

            if (requ.Count > 0)
            {
                referencia     = requ[0].REFERENCIA;//27.01.2017
                requ[0].STATUS = rol(USUARIO_BLL.GET(user)[0]) + "";
                if (requ[0].STATUS.Equals("5") | requ[0].STATUS.Equals("6"))
                {
                    Conexion          con   = new Conexion();
                    List <ZEBAN_BE>   Items = ZEBAN_BLL.GET(Int32.Parse(banfn));
                    List <ZEBAN_I_BE> imps  = new List <ZEBAN_I_BE>();
                    List <ZEBAN_S_BE> servs = new List <ZEBAN_S_BE>();
                    foreach (ZEBAN_BE z in Items)
                    {
                        List <ZEBAN_I_BE> ii = ZEBAN_I_BLL.GET(z.BANFN, z.BNFPO.Trim());
                        List <ZEBAN_S_BE> ss = ZEBAN_S_BLL.GET(z.BANFN, z.BNFPO.Trim());
                        foreach (ZEBAN_I_BE i in ii)
                        {
                            imps.Add(i);
                            if (z.TIPO.Trim() != "F")
                            {
                                ZEBAN_S_BE t = new ZEBAN_S_BE();
                                t.ASSET_NUM  = i.ASSET_NUM.Trim();
                                t.COSTCENTER = i.COSTCENTER.Trim();
                                t.BANFN      = i.BANFN;
                                t.BNFPO      = i.BNFPO.Trim();
                                t.GL_ACCOUNT = i.GL_ACCOUNT.Trim();
                                t.SERIAL     = i.SERIAL;
                                //t.
                                servs.Add(t);
                            }
                        }
                        if (z.TIPO.Trim() == "F")
                        {
                            foreach (ZEBAN_S_BE s in ss)
                            {
                                s.SERVICIO = completa(s.SERVICIO.Trim(), 18);
                                servs.Add(s);
                            }
                        }
                    }
                    string[] ret = con.bapi_pr_create2(Items, imps, servs, user, u, referencia); //Crea requisición//27.01.2017
                    string   status;                                                             // = "E";
                    if (!ret[0].Equals(""))
                    {
                        status            = "B";
                        requ[0].APROBO    = user;
                        requ[0].SAP_BANFN = ret[0];
                        requ[0].STATUS    = "6";
                        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);

                            List <ZEBAN_D_BE> docs = ZEBAN_D_BLL.GET(Int32.Parse(banfn));
                            for (int y = 0; y < docs.Count; y++)
                            {
                                byte[] bytes = docs[y].INFO;
                                string name  = docs[y].NOMBRE + "." + docs[y].EXT;

                                ret[i] = con.rfcFuncionAdjuntar(ret[0], "BUS2105", name, bytes);
                            }



                            enviarF(user, Int32.Parse(banfn), u, ret[0]);
                            //return "Se ha aprobado la requisición";
                        }
                        ret[1] = "Se ha creado la requisición " + ret[0] + " en SAP";
                    }
                    else
                    {
                        status = "Hubieron errores al crear la requisición:";
                    }

                    return("\n" + ret[1]);
                }
                else
                {
                    requ[0].APROBO = user;
                    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);
                        enviar(user, Int32.Parse(banfn), u);
                        return("Se ha aprobado la requisición");
                    }
                }
            }
            return("Hubo un error al aprobar la requisición");
        }