Example #1
0
        public static List <FormatAppOrder> getLista(Appuser user)
        {
            string sql = String.Format("SELECT ao.idOrder, ao.createDate, pr.name, au.fullname, ad.address  " +
                                       "FROM APPORDER ao, ADDRESS ad, PRODUCT pr, APPUSER au " +
                                       "WHERE ao.idProduct = pr.idProduct " +
                                       "AND ao.idAddress = ad.idAddress " +
                                       "AND ad.idUser = au.idUser " +
                                       "AND au.idUser = {0};", user.IdUser);

            DataTable dt = Conexion.query(sql);

            List <FormatAppOrder> lista = new List <FormatAppOrder>();

            foreach (DataRow fila in dt.Rows)
            {
                FormatAppOrder a = new FormatAppOrder();
                a.IdOrder    = Convert.ToInt32(fila[0].ToString());
                a.CreateDate = Convert.ToDateTime(fila[1].ToString());
                a.Name       = fila[2].ToString();
                a.Fullname   = fila[3].ToString();
                a.Address    = fila[4].ToString();

                lista.Add(a);
            }

            return(lista);
        }
Example #2
0
        public static void addAppuser(Appuser u)
        {
            string sql = String.Format(
                "insert into appuser" +
                "(fullname, username, password, userType)" +
                "values ('{0}', '{1}', '{2}', '{3}');",
                u.Fullname, u.Username, u.Password, u.UserType.ToString());

            Conexion.nonQuery(sql);
        }
Example #3
0
        public static void updateAddress(Address a, Appuser u, string addr)
        {
            string sql = String.Format(
                "update address " +
                "SET address={0} " +
                "WHERE \"idAddress\"={1} " +
                "AND \"idUser\"={2};",
                addr, a.IdAddress, u.IdUser);

            Conexion.nonQuery(sql);
        }
Example #4
0
        public static List <Address> getLista(Appuser appuser)
        {
            string sql = String.Format("SELECT ad.idAddress, ad.address FROM ADDRESS ad WHERE idUser = {0};",
                                       appuser.IdUser);

            DataTable dt = Conexion.query(sql);

            List <Address> lista = new List <Address>();

            foreach (DataRow fila in dt.Rows)
            {
                Address a = new Address();
                a.IdAddress = Convert.ToInt32(fila[0].ToString());
                a.IdUser    = appuser.IdUser;
                a.Addr      = fila[1].ToString();

                lista.Add(a);
            }

            return(lista);
        }
Example #5
0
        public static List <Appuser> getLista()
        {
            string sql = "select * from appuser";

            DataTable dt = Conexion.query(sql);

            List <Appuser> lista = new List <Appuser>();

            foreach (DataRow fila in dt.Rows)
            {
                Appuser u = new Appuser();
                u.IdUser   = Convert.ToInt32(fila[0].ToString());
                u.Fullname = fila[1].ToString();
                u.Username = fila[2].ToString();
                u.Password = fila[3].ToString();
                u.UserType = Convert.ToBoolean(fila[4].ToString());

                lista.Add(u);
            }

            return(lista);
        }