/// <summary> /// Method to update selling price details /// </summary> /// <param name="sellingPrice">Selling Price</param> /// <returns></returns> public bool UpdateSellingPrice(SellingPriceDataModel sellingPrice) { using (OleDbCommand oleDbCommand = new OleDbCommand()) { // Set the command object properties oleDbCommand.Connection = new OleDbConnection(this.ConnectionString); oleDbCommand.CommandType = CommandType.Text; oleDbCommand.CommandText = SellingPriceScripts.sqlUpdateSellingPrice; // Add the input parameters to the parameter collection oleDbCommand.Parameters.AddWithValue("@Price", sellingPrice.Price ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@Transport", sellingPrice.Transport ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@Other1", sellingPrice.Other1 ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@Other2", sellingPrice.Other2 ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@TotalSelling", sellingPrice.TotalSelling ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@SellingPriceID", sellingPrice.SellingPriceID); // Open the connection, execute the query and close the connection oleDbCommand.Connection.Open(); var rowsAffected = oleDbCommand.ExecuteNonQuery(); oleDbCommand.Connection.Close(); return(rowsAffected > 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; }
/// <summary> /// Converts a Data row from the database table to selling price model /// </summary> /// <param name="sellingPriceRow"></param> /// <returns></returns> public SellingPriceDataModel ConvertToDataModel(DataRow sellingPriceRow) { var result = new SellingPriceDataModel(); result.SellingPriceID = sellingPriceRow.Field <int>("SellingPriceID"); result.Price = sellingPriceRow.Field <decimal?>("Price"); result.Transport = sellingPriceRow.Field <decimal?>("Transport"); result.Other1 = sellingPriceRow.Field <decimal?>("Other1"); result.Other2 = sellingPriceRow.Field <decimal?>("Other2"); result.TotalSelling = sellingPriceRow.Field <decimal?>("TotalSelling"); return(result); }
/// <summary> /// Method to update selling price details /// </summary> /// <param name="sellingPrice">Selling Price</param> /// <returns></returns> public bool UpdateSellingPrice(SellingPriceDataModel sellingPrice) { return(sellingPriceAccess.UpdateSellingPrice(sellingPrice)); }
/// <summary> /// Method to create new selling price /// </summary> /// <param name="product">club member model</param> /// <returns>true or false</returns> public bool AddSellingPrice(SellingPriceDataModel sellingPrice) { return(sellingPriceAccess.AddSellingPrice(sellingPrice)); }