예제 #1
0
        public List <ArendaItem> getRooms()
        {
            List <ArendaItem> rooms = new List <ArendaItem>();

            ExecQuery("SELECT * FROM ROOMS", (r) =>
            {
                ArendaItem U = new ArendaItem();
                U.id         = r["ID"].ToString();
                U.roomtype   = r["ROOMTYPE"].ToString();
                U.address    = r["ADDRESS"].ToString();
                U.city       = r["CITY"].ToString();
                U.price      = Int32.Parse(r["PRICE"].ToString());
                U.s          = Int32.Parse(r["PRICE"].ToString());
                U.elite      = r["ELITE"].ToString().Equals("1");
                if (r["UUID"].ToString().Equals(""))
                {
                    U.guid = Guid.NewGuid();
                }
                else
                {
                    U.guid = Guid.Parse(r["UUID"].ToString());
                }
                rooms.Add(U);
            });

            return(rooms);
        }
예제 #2
0
        public ArendaService()
        {
            XDocument doc = XDocument.Load(DATAFILE);

            //Console.WriteLine("created");

            store = new List <ArendaItem>();

            foreach (var data in doc.Element("arenda").Element("rooms").Elements("room"))
            {
                ArendaItem item = new ArendaItem();
                item.id       = data.Element("id").Value;
                item.roomtype = data.Element("roomtype").Value;
                item.city     = data.Element("city").Value;
                item.address  = data.Element("address").Value;
                item.price    = Int32.Parse(data.Element("price").Value);
                item.s        = Int32.Parse(data.Element("square").Value);
                item.elite    = data.Element("elite").Value.Equals("true");
                store.Add(item);
            }


            /*
             * ArendaItem item = new ArendaItem();
             * item.address = "1111";
             * item.elite = true;
             * item.id = "1";
             * store.Add(item);
             * item = new ArendaItem();
             * item.address = "222";
             * item.elite = true;
             * item.id = "2";
             * store.Add(item);
             * item = new ArendaItem();
             * item.address = "333";
             * item.elite = true;
             * item.id = "3";
             * store.Add(item);
             */
        }
예제 #3
0
 public bool AddItem(ArendaItem item)
 {
     Console.WriteLine("New item: {0} {1} {2}", item.address, item.id, item.elite);
     return(true);
 }