/// <summary> /// Find the sale corresponding with the saleID. /// </summary> /// <param name="saleID">The saleID corresponding with the Sale we want to work on</param> public void GetSale(int saleID) { currentSale = sd.GetSale(saleID); if (currentSale != null) { state = CustomerServiceState.SuccessfulID; } else { this.Error = "Invalid Sale ID."; state = CustomerServiceState.InvalidID; } }
/// <summary> /// Generates a rebate for the current sale. /// </summary> /// <param name="salesID">The salesID for the current sale</param> /// <param name="date">The entered date.</param> public void GenerateRebate(int salesID, DateTime date) { _currentSale = _salesDatabase.GetSale(salesID); DateTime endJuly = new DateTime(2018, 07, 30); if (DateTime.Compare(date, endJuly) < 0) { Error = "Rebate refunds checks are not generated till the end of July!"; State = RebateModelState.RebateEnterError; return; } if (_currentSale.RebateState == RebateState.Generated) { Error = "Rebate has already been generated."; State = RebateModelState.RebateEnterError; return; } _currentSale.RebateState = RebateState.Rebate; State = RebateModelState.RebateGenerated; _currentSale.RebateAmount = _currentSale.Total() * 0.11; }