private void SendGift(Customer customer) { if (customer.Address.City == "Chicago") { SendThankYouLetterInternal(customer.EmailAddress); } }
private async Task NotifyCustomerOfSuccess(Customer customer, int orderId, DateTime orderEta) { var message = string.Format("Dear {0} {1}, Your order {2} has been shipped and expected to arrive at: {3}", customer.FirstName, customer.Surname, orderId, orderEta); await EmailClient.Send(customer.EmailAddress, "Order sent", message); }
private async Task NotifyCustomerOfDelay(Customer customer, Order order) { var message = string.Format("Dear {0} {1}, Your order {2} cannot be delivered - please contact customer support", customer.FirstName, customer.Surname, order.ID); await EmailClient.Send(customer.EmailAddress, "Failed delivering order", message); }
private void SendOverseasPackage(Customer customer) { if (customer.Address.Country == "US") { // Shouldn't get here Debugger.Break(); } // Send package }
private void SendThankYouLetter(Customer customer) { if (customer.EmailAddress.Length > MaxEmailLength) { SendThankYouLetterInternal(customer.EmailAddress); } else { Debug.Write("Email address too long!"); } }
private static double CalculateExpenses(Customer customer) { Debugger.Break(); int retailerGiftPrice = IsElgibileForDiscount(customer) ? GetDiscountPrice() : GetRegularPrice(); int shippingCost; if (int.TryParse(GetShippingCostFromConfig(), out shippingCost)) { retailerGiftPrice += shippingCost; } AddVAT(ref retailerGiftPrice); return retailerGiftPrice + GetExtraFreebiesCost(customer); }
public async Task SendOrder(Customer customer, Order order) { try { var orderEta = CalculateOrderEta(order, customer.Address); await SendAsync(order, customer.Address); await NotifyCustomerOfSuccess(customer, order.ID, orderEta); } catch (IllegalOrderException exc) { await NotifyCustomerOfDelay(customer, order); throw new OrderProcessingException("Failed to deliver order " + order.ID, exc); } }
public int DaysTillBirthday(Customer customer, DateTime today) { try { var birthday = customer.Birthday; DateTime next = new DateTime(today.Year, birthday.Month, birthday.Day); if (next < today) next = next.AddYears(1); return (next - today).Days; } catch (Exception) { return int.MaxValue; } }
private static bool IsElgibileForDiscount(Customer customer) { return customer.Birthday.Month > 6; }
private static double GetExtraFreebiesCost(Customer customer) { return customer.GetYearlyEarnings(100) + 52; }
// <---- Use QuickAction Here. public void SendInvoice(Customer customer) { _queue.Add(new Tuple<string, int>(customer.EmailAddress, customer.PendingInvoiceID)); }
private static int SendGift(Customer customer) { int retailerGiftPrice = IsElgibileForDiscount(SupplierId) ? GetDiscountPrice() : GetRegularPrice(); int shippingCost; if (int.TryParse(GetShippingCostFromConfig(), out shippingCost)) { retailerGiftPrice += shippingCost; } AddVAT(ref retailerGiftPrice); return retailerGiftPrice + GetExtraFreebiesCost(customer); }
private static bool IsEligibleForPrize(Customer customer) { return customer.Gender == Gender.Female; }
private static int GetExtraFreebiesCost(Customer customer) { return 52; }