Esempio n. 1
0
        /// <summary>
        /// The get containers.
        /// </summary>
        /// <param name="ship">
        /// The ship.
        /// </param>
        /// <param name="port">
        /// The port.
        /// </param>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        public List<Container> GetContainers(string ship, string port)
        {
            var containerlist = new List<Container>();

            using (var db = new Database())
            {
                Container containers = null;
                db.OpenConnection();
                db.CreateCommand(
                    "Select Container.*,Company.Name AS name,Ship.type AS shiptype from Container,Ship,Port,Company WHERE Ship.Type LIKE @ship AND Port.Name LIKE @port AND Company.ID = Container.Company_ID AND Ship.ID = Container.Ship_ID");
                db.AddParameter("@ship", ship);
                db.AddParameter("@port", port);

                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    containers = new Container();
                    containers.id = (int)dr["id"];
                    containers.type = (string)dr["type"];
                    containers.weight = (int)dr["weight"];
                    containers.onship = (string)dr["shiptype"];
                    containers.companyname = (string)dr["name"];
                    containerlist.Add(containers);
                }
            }

            return containerlist;
        }
Esempio n. 2
0
        public List<Item> ItemsGridview(string name)
        {
            var griditems = new List<Item>();
            Item item = null;
            using (var db = new Database())
            {
                db.OpenConnection();
                db.CreateCommand(
                    "SELECT Item.*, Quality.Name AS Quality FROM Item, Quality WHERE Item.Quality_ID=Quality.Quality_ID AND Item.Name LIKE @name");
                db.AddParameter("@name", "%" + name + "%");
                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    item = new Item();
                    item.Name = (string)dr["name"];
                    item.Level = (int)dr["level"];
                    item.ReqLevel = (int)dr["Reqlevel"];
                    item.Quality = (string)dr["Quality"];
                    griditems.Add(item);
                }
            }

            return griditems;
        }
Esempio n. 3
0
        public List<Guide> GuideGridview(string name)
        {
            var gridguide = new List<Guide>();
            Guide guide = null;
            using (var db = new Database())
            {
                db.OpenConnection();
                db.CreateCommand(
                    "SELECT Guide.Name, Author.Name AS Author FROM Guide, Author WHERE Guide.Author_ID=Author.Author_ID And Guide.Name LIKE @name");
                db.AddParameter("@name", "%" + name + "%");
                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    guide = new Guide();
                    guide.Name = (string)dr["name"];
                    guide.Author = (string)dr["author"];
                    gridguide.Add(guide);
                }
            }

            return gridguide;
        }
Esempio n. 4
0
        public List<Classes> ClassesGridview(string name)
        {
            var gridclasses = new List<Classes>();
            Classes classes = null;
            using (var db = new Database())
            {
                db.OpenConnection();
                db.CreateCommand(
                    "SELECT Class.*, Spec.Name AS Spec FROM Class, Spec WHERE Class.Class_ID=Spec.Class_ID AND Class.Name LIKE @name");
                db.AddParameter("@name", "%" + name + "%");
                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    classes = new Classes();
                    classes.Name = (string)dr["name"];
                    classes.Specs = (string)dr["spec"];
                    gridclasses.Add(classes);
                }
            }

            return gridclasses;
        }
Esempio n. 5
0
        public Item GetItemByName(string name)
        {
            Item item = null;
            using (Database db = new Database())
            {
                db.OpenConnection();

                //db.CreateCommand("SELECT * FROM Item WHERE Name = @name");
                //db.AddParameter("@name", name);
                db.CreateCommand("SELECT * FROM Item WHERE Name LIKE @name");
                db.AddParameter("@name", "%" + name + "%"); // Part of the string
                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    item = new Item();
                    item.Name = dr["name"].ToString();
                    item.Level = dr["level"].ToString();

                }
            }

            return item;
        }