示例#1
0
        public void addItemToVendor(int vendorID, int itemID)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("INSERT INTO \"Vendor_Items\"(\"VedndorID\",\"ItemID\") VALUES(' " +
                              itemID + "'," + vendorID + "')");
        }
示例#2
0
        public void addVendor(Vendor theVendor)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("INSERT INTO \"Vendor\"(\"VendorName\", \"VendorAdress\") VALUES('"
                              + theVendor.VendorName + "','" + theVendor.VendorAddress + "')");
        }
示例#3
0
        public void addUser(User theUser, int loginId)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("INSERT INTO \"User\"(\"ID\", \"FirstName\", \"LastName\", \"Email\", \"PhoneNumber\", \"DateOfBirth\", \"IsAdmin\", \"Gender\", \"Address\") VALUES('"
                              + loginId + "','" + theUser.FirstName + "','" + theUser.LastName + "','" + theUser.Email + "','" + theUser.PhoneNumber + "','" + theUser.DateOfBirth.Date + "','"
                              + theUser.IsAdmin + "','" + theUser.Gender + "','" + theUser.Address + "')");
        }
示例#4
0
        public void changeLogin(Login theLogin)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("UPDATE \"Login\" SET " +
                              "\"UserName\" = '" + theLogin.UserName + "'," +
                              "\"Password\"  = '" + theLogin.Password + "'" +
                              " WHERE \"ID\" = '" + theLogin.ID + "'");
        }
示例#5
0
        public void deleteUser(User user)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("DELETE FROM \"User\"" +
                              " WHERE \"ID\" = '" + user.ID + "'");

            modder.modifyRows("DELETE FROM \"Login\"" +
                              " WHERE \"ID\" = '" + user.ID + "'");
        }
示例#6
0
        public void deleteItem(Item item)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("DELETE FROM \"Vendor_Items\"" +
                              " WHERE \"ItemID\" = '" + item.ItemID + "'");

            modder.modifyRows("DELETE FROM \"Item\"" +
                              " WHERE \"ItemID\" = '" + item.ItemID + "'");
        }
示例#7
0
        public void saveItemList(List <ItemList> itemLists)
        {
            DBModifier modder = new DBModifier();

            foreach (ItemList i in itemLists)
            {
                modder.modifyRows("INSERT INTO \"ItemList\" (\"OrderID\", \"ItemID\", \"Quantity\") VALUES ('" +
                                  i.OrderID + "','" + i.ItemID + "','" + i.Quantity + "')");
            }
        }
示例#8
0
        public void changeItem(Item theItem)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("UPDATE \"Item\" SET " +
                              "\"StockQuantity\" = " + theItem.StockQuantity + "," +
                              "\"ItemName\"  = '" + theItem.ItemName + "'," +
                              "\"CostPrice\" = " + theItem.CostPrice + "," +
                              "\"RetailPrice\" = " + theItem.RetailPrice + "" +
                              " WHERE \"ItemID\" = '" + theItem.ItemID + "'");
        }
示例#9
0
        public int saveLoginInfo(string username, string password)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("INSERT INTO \"Login\" (\"UserName\", \"Password\") VALUES ('" + username + "','" + password + "')");

            DBSelector selector = new DBSelector();

            Login newLogin = selector.getRow <Login>("SELECT * FROM \"Login\" WHERE " +
                                                     "\"UserName\" = '" + username + "' AND \"Password\" = '" + password + "'");

            return(newLogin.ID);
        }
示例#10
0
        public static GuestModifier GetMod(Topping topping)
        {
            DBModifier databaseMod = new DBModifier();

            if (DataBaseDictionaries.PizzaToppingsDictionary.ContainsKey(topping.DbItemId))
            {
                databaseMod = DataBaseDictionaries.PizzaToppingsDictionary[topping.DbItemId];
            }
            else
            {
                Console.WriteLine("***Debug JOANNE***Topping DB ID not found: " + topping.DbItemId);
            }

            GuestModifier newGuestMod = new GuestModifier(databaseMod);

            newGuestMod.State = "Plus";
            switch (topping.ToppingModifier)
            {
            case (ToppingModifierType.ExtraTopping):
                newGuestMod.Multiplier = topping.Count;
                break;

            case (ToppingModifierType.NoTopping):
                newGuestMod.State = "No";
                break;

            case (ToppingModifierType.LightTopping):
                newGuestMod.State = "Lite";
                break;

            case (ToppingModifierType.ToppingOnSide):
                newGuestMod.State = "Side";
                break;
            }

            newGuestMod.Half = "Whole";
            if (topping.ToppingWholeHalf == ToppingWholeHalf.HalfA)
            {
                newGuestMod.Half = "Half_A";
            }
            else if (topping.ToppingWholeHalf == ToppingWholeHalf.HalfB)
            {
                newGuestMod.Half = "Half_B";
            }

            newGuestMod.isDefault = false;
            newGuestMod.Priority  = databaseMod.Priority;

            return(newGuestMod);
        }
示例#11
0
        public void changeUser(User theUser)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("UPDATE \"User\" SET " +
                              "\"FirstName\" = '" + theUser.FirstName + "'," +
                              "\"LastName\"  = '" + theUser.LastName + "'," +
                              "\"Email\" = '" + theUser.Email + "'," +
                              "\"PhoneNumber\" = '" + theUser.PhoneNumber + "'," +
                              "\"DateOfBirth\" = '" + theUser.DateOfBirth.Date + "'," +
                              "\"IsAdmin\" = '" + theUser.IsAdmin + "'," +
                              "\"Gender\" = '" + theUser.Gender + "'," +
                              "\"Address\" = '" + theUser.Address + "'" +
                              " WHERE \"ID\" = '" + theUser.ID + "'");
        }
示例#12
0
        public void addItem(Item theItem, Vendor theVendor)
        {
            DBModifier modder   = new DBModifier();
            DBSelector selector = new DBSelector();

            //put the item in the DB
            modder.modifyRows("INSERT INTO \"Item\"(\"RetailPrice\",\"StockQuantity\",\"ItemName\",\"CostPrice\",\"Category\") VALUES(" +
                              theItem.RetailPrice + "," + theItem.StockQuantity + ",'" + theItem.ItemName + "'," + theItem.CostPrice + ",'" +
                              theItem.Category + "')");

            Item newitem = selector.getRow <Item>("SELECT * FROM \"Item\" WHERE \"RetailPrice\" = " + theItem.RetailPrice +
                                                  " AND \"StockQuantity\" = " + theItem.StockQuantity +
                                                  " AND \"ItemName\" = '" + theItem.ItemName +
                                                  "' AND \"CostPrice\" = " + theItem.CostPrice +
                                                  " AND \"Category\" = '" + theItem.Category + "'");

            //add it to the vedor
            modder.modifyRows("INSERT INTO \"Vendor_Items\"(\"VendorID\",\"ItemID\") VALUES( " +
                              theVendor.VendorID + "," + newitem.ItemID + ")");
        }
示例#13
0
        public void setPassword(int loginID, string password)
        {
            DBModifier modder = new DBModifier();

            modder.modifyRows("UPDATE \"Login\" SET \"Password\" = " + password + " WHERE \"ID\" = '" + loginID + "'");
        }