Exemple #1
0
        // Changes new_product ProductId
        public static void AddNewProduct(ProductRecord new_product)
        {
            using (SqlConnection conn = new SqlConnection(_connection_string))
            {
                conn.Open();
                SqlCommand command = new SqlCommand(_add_received_product_query, conn);
                command.Parameters.Add("@NAME", System.Data.SqlDbType.VarChar);
                command.Parameters["@NAME"].Value = new_product.ProductName;
                command.Parameters.Add("@PRICE", System.Data.SqlDbType.Decimal);
                command.Parameters["@PRICE"].Value = new_product.Price;
                command.Parameters.Add("@STATUSDATE", System.Data.SqlDbType.Date);
                command.Parameters["@STATUSDATE"].Value = new_product.Date;

                SqlDataReader dataReader = command.ExecuteReader();
                dataReader.Read();

                new_product.ProductId = (int)dataReader.GetDecimal(0);
            }
        }
Exemple #2
0
 // Changes storage_product ProductId and date
 public static void MoveToSold(ProductRecord storage_product)
 {
     MoveToTable(storage_product, _move_from_storage_to_sold_by_id);
 }
Exemple #3
0
 // Changes received_product ProductId and date
 public static void MoveToStorage(ProductRecord received_product)
 {
     MoveToTable(received_product, _move_from_received_to_storage_by_id);
 }