Exemplo n.º 1
0
        /// <summary>
        /// Method to create new selling price
        /// </summary>
        /// <param name="productDelivery">club member model</param>
        /// <returns>true or false</returns>
        public bool AddProductDelivery(ProductDeliveryDataModel productDelivery)
        {
            using (OleDbCommand oleDbCommand = new OleDbCommand())
            {
                // Set the command object properties
                oleDbCommand.Connection  = new OleDbConnection(this.ConnectionString);
                oleDbCommand.CommandType = CommandType.Text;
                oleDbCommand.CommandText = ProductDeliveryScripts.sqlInsertProductDelivery;

                // Add the input parameters to the parameter collection
                oleDbCommand.Parameters.AddWithValue("@DateOfPurchase", productDelivery.DateOfPurchase == null ? (object)DBNull.Value :
                                                     productDelivery.DateOfPurchase.Value.ToOADate());
                oleDbCommand.Parameters.AddWithValue("@LandOfOrigin", productDelivery.LandOfOrigin ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@CurrentLocation", productDelivery.CurrentLocation ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@DateOfSale", productDelivery.DateOfSale == null ? (object)DBNull.Value :
                                                     productDelivery.DateOfSale.Value.ToOADate());
                oleDbCommand.Parameters.AddWithValue("@LandOfDestination", productDelivery.LandOfDestination ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@ProductStatus", productDelivery.ProductStatus ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@Seller", productDelivery.Seller ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@Buyer", productDelivery.Buyer ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@ProductWebsite", productDelivery.ProductWebsite ?? (object)DBNull.Value);
                oleDbCommand.Parameters.AddWithValue("@ProductAttachment", productDelivery.ProductAttachment ?? (object)DBNull.Value);

                // Open the connection, execute the query and close the connection
                oleDbCommand.Connection.Open();
                var rowsAffected = oleDbCommand.ExecuteNonQuery();
                oleDbCommand.Connection.Close();

                return(rowsAffected > 0);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the data models
 /// </summary>
 private void UpdateDataModels()
 {
     _paymentDataModel         = _salesManagementService.PaymentDataModel;
     _productDataModel         = _salesManagementService.ProductDataModel;
     _productDeliveryDataModel = _salesManagementService.ProductDeliveryDataModel;
     _purchasePriceDataModel   = _salesManagementService.PurchasePriceDataModel;
     _sellingPriceDataModel    = _salesManagementService.SellingPriceDataModel;
     _paymentUnitsTable        = _salesManagementService.PaymentUnitsTable;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Converts a Data row from the database table to selling price model
        /// </summary>
        /// <param name="productDeliveryRow"></param>
        /// <returns></returns>
        public ProductDeliveryDataModel ConvertToDataModel(DataRow productDeliveryRow)
        {
            var result = new ProductDeliveryDataModel();

            result.ProductDeliveryID = productDeliveryRow.Field <int>("ProductDeliveryID");
            result.DateOfPurchase    = productDeliveryRow.Field <DateTime?>("DateOfPurchase");
            result.LandOfOrigin      = productDeliveryRow.Field <string>("LandOfOrigin");
            result.CurrentLocation   = productDeliveryRow.Field <string>("CurrentLocation");
            result.DateOfSale        = productDeliveryRow.Field <DateTime?>("DateOfSale");
            result.LandOfDestination = productDeliveryRow.Field <string>("LandOfDestination");
            result.ProductStatus     = productDeliveryRow.Field <bool?>("ProductStatus");
            result.Seller            = productDeliveryRow.Field <string>("Seller");
            result.Buyer             = productDeliveryRow.Field <string>("Buyer");
            result.ProductWebsite    = productDeliveryRow.Field <string>("ProductWebsite");
            result.ProductAttachment = productDeliveryRow.Field <string>("ProductAttachment");

            return(result);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Method to update selling price details
 /// </summary>
 /// <param name="productDelivery">Selling Price</param>
 /// <returns></returns>
 public bool UpdateProductDelivery(ProductDeliveryDataModel productDelivery)
 {
     return(productDeliveryAccess.UpdateProductDelivery(productDelivery));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Method to create new selling price
 /// </summary>
 /// <param name="productDelivery">club member model</param>
 /// <returns>true or false</returns>
 public bool AddProductDelivery(ProductDeliveryDataModel productDelivery)
 {
     return(productDeliveryAccess.AddProductDelivery(productDelivery));
 }