예제 #1
0
        public void LoadAllDatabase(List <ProductStorages> listProductStorages)
        {
            DatabaseConnection();
            sqlConnection.Open();

            sqlCommand.CommandText = "EXEC dbo.ProcProductStoragesSelect";
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            while (sqlDataReader.Read())
            {
                var productStorage = new ProductStorages();
                for (int i = 0; i < sqlDataReader.FieldCount; i++)
                {
                    var colName  = sqlDataReader.GetName(i);
                    var value    = sqlDataReader.GetValue(i);
                    var property = productStorage.GetType().GetProperty(colName);
                    if (property != null)
                    {
                        property.SetValue(productStorage, value);
                    }
                }
                listProductStorages.Add(productStorage);
            }

            sqlConnection.Close();
        }
예제 #2
0
        public void InsertProductStorages(ProductStorages productStorages)
        {
            //productStorages.ProductstorageId = listProductStorages.Count() + 1;
            //productStorages.ProductDelivery = DateTime.Today.ToString("d");
            //listProductStorages.Add(productStorages);

            ////SQL INSERT
            //database.InsertProductStorages(productStorages);
        }
예제 #3
0
        public void UpdateProductStorages(ProductStorages productStorages)
        {
            //var xProductStorage = listProductStorages.Where(e => e.ProductstorageId == productStorages.ProductstorageId).FirstOrDefault();
            //listProductStorages.Remove(xProductStorage);
            //productStorages.ProductstorageCode = xProductStorage.ProductstorageCode;
            //productStorages.ProductCode = xProductStorage.ProductCode;
            //productStorages.ProductDimension = xProductStorage.ProductDimension;
            //productStorages.ProductDelivery = xProductStorage.ProductDelivery;
            //listProductStorages.Add(productStorages);

            //SQL UPDATE
            //database.UpdateProductStorages(productStorages);
        }
예제 #4
0
        public void UpdateProductStorages(ProductStorages productStorages)
        {
            DatabaseConnection();
            sqlConnection.Open();

            //sqlCommand.CommandText = "EXEC ProcProductStoragesUpdate @id, @codes, @code, @dimension, @quantity, @delivery, @note";
            //sqlCommand.Parameters.AddWithValue("@id", productStorages.ProductstorageId);
            //sqlCommand.Parameters.AddWithValue("@codes", productStorages.ProductstorageCode);
            //sqlCommand.Parameters.AddWithValue("@code", productStorages.ProductCode);
            //sqlCommand.Parameters.AddWithValue("@dimension", productStorages.ProductDimension);
            //sqlCommand.Parameters.AddWithValue("@quantity", productStorages.ProductQuantity);
            //sqlCommand.Parameters.AddWithValue("@delivery", productStorages.ProductDelivery);
            //sqlCommand.Parameters.AddWithValue("@note", productStorages.ProductstorageNote);
            //sqlCommand.ExecuteNonQuery();

            sqlConnection.Close();
        }
예제 #5
0
 public int Put([FromBody] ProductStorages productStorages)
 {
     return(1);
 }