Beispiel #1
0
        public void CreateEquipment()
        {
            Equip.Add(new Equipment(1, 2, DateTime.Now));
            Equipment equips = Equip.GetById(1);

            Assert.AreEqual(equips._id, 1);
        }
        public void GetAll()
        {
            MySqlCommand cmd = new MySqlCommand("SELECT Id, Service, CatId FROM Equipment");
            DataTable    dt  = db.GetData(cmd);

            if (dt != null)
            {
                foreach (DataRow rw in dt.Rows)
                {
                    Dictionary <string, string> dic = GetValuesForEquipment(Convert.ToInt32(rw["id"]));

                    DateTime?date;
                    if (rw["service"] == DBNull.Value)
                    {
                        date = null;
                    }
                    else
                    {
                        date = Convert.ToDateTime(rw["service"]);
                    }

                    rep.Add(new Equipment(
                                Convert.ToInt32(rw["id"]),
                                Convert.ToInt32(rw["catId"]),
                                date,
                                dic
                                ));
                }
            }
        }
Beispiel #3
0
        public void AddEquipment(Equipment obj)
        {
            Equipment newEq = eqData.Add(obj);

            eqRep.Add(newEq);
        }