示例#1
0
        public static void Edit30DayHold(HoldItem oldItem, HoldItem newItem)
        {
            SqlCommand cmd = new SqlCommand("UPDATE " + TableNames._30DAYHOLD +
                                            " SET Name = '" + CheckForSpecialCharacters(newItem.name) + "', " +
                                            "System = '" + CheckForSpecialCharacters(newItem.system) + "', " +
                                            "Price = " + newItem.price + ", " +
                                            "Quantity = " + newItem.quantity + ", " +
                                            "TradeCash = " + newItem.tradeCash + ", " +
                                            "TradeCredit = " + newItem.tradeCredit + ", " +
                                            "UPC = " + newItem.UPC + ", " +
                                            "DATE = '" + newItem.dateIn + "'" +
                                            " WHERE Name = '" + CheckForSpecialCharacters(oldItem.name) +
                                            "' AND System = '" + CheckForSpecialCharacters(oldItem.system) + "' " +
                                            "AND PRICE = '" + oldItem.price + "' " +
                                            "AND TRADECASH = '" + oldItem.tradeCash + "' " +
                                            "AND TRADECREDIT = '" + oldItem.tradeCredit + "' " +
                                            "AND UPC = '" + oldItem.UPC + "' " +
                                            "AND DATE = '" + oldItem.dateIn + "'"
                                            , connect); // Find an exact match for the passed string, increase inventory

            try
            {
                connect.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                MessageBox.Show("ERROR IN Edit30DayHold:\n" + e.Message);
            }
            finally
            {
                connect.Close();
            }
        }
示例#2
0
 /// <summary>
 /// Creates a HoldItem based on data contained in an SqlDataReader
 /// </summary>
 /// <param name="reader">SqlDataReader containing data</param>
 /// <returns>A populated HoldItem</returns>
 public static HoldItem SQLReaderToHoldItem(SqlDataReader reader)
 {
     HoldItem item = null;
     item = new HoldItem(reader[0].ToString(),
             reader[1].ToString(),
             reader[2].ToString(),
             reader[3].ToString(),
             reader[4].ToString(),
             reader[5].ToString(),
             reader[6].ToString(),
             reader[7].ToString());
     return item;
 }
示例#3
0
 public static void DeleteItemFrom30DayHold(HoldItem item)
 {
     SqlCommand cmd = new SqlCommand("DELETE FROM tbl30DayHold WHERE Name = '" + CheckForSpecialCharacters(item.name) +
                                     "' AND System = '" + CheckForSpecialCharacters(item.system) + "' AND Date = '" + item.dateIn + "'",
                                     connect); // Find an exact match for the passed string, delete item.
     try
     {
         connect.Open();
         cmd.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         MessageBox.Show("ERROR IN DeleteItemFrom30DayHold:\n" + e.Message);
     }
     finally
     {
         connect.Close();
     }
 }