public void ValidateCustomer(ICustomer customer, String message)
 {
     if (customer == null)
     {
         throw new ArgumentException(message);
     }
 }
 public AddAppointmentDialog(ICustomer icustomer, CreateCustomerDialog createCustomerDialog, List<IAppointment> appointments)
 {
     this.iCustomer = icustomer;
     this.ccd = createCustomerDialog;
     this.appointments = appointments;
     InitializeComponent();
 }
        /// <summary>
        /// Creates a Braintree <see cref="Customer"/> from a Merchello <see cref="ICustomer"/>
        /// </summary>
        /// <param name="customer">
        /// The customer.
        /// </param>
        /// <param name="paymentMethodNonce">
        /// The "nonce-from-the-client"
        /// </param>
        /// <param name="billingAddress">
        /// The billing address
        /// </param>
        /// <param name="shippingAddress">
        /// The shipping Address.
        /// </param>
        /// <returns>
        /// The <see cref="Attempt{Customer}"/>.
        /// </returns>
        public Attempt<Customer> Create(ICustomer customer, string paymentMethodNonce = "", IAddress billingAddress = null, IAddress shippingAddress = null)
        {
            if (Exists(customer)) return Attempt.Succeed(GetBraintreeCustomer(customer));

            var request = RequestFactory.CreateCustomerRequest(customer, paymentMethodNonce, billingAddress);

            Creating.RaiseEvent(new Core.Events.NewEventArgs<CustomerRequest>(request), this);

            // attempt the API call
            var attempt = TryGetApiResult(() => BraintreeGateway.Customer.Create(request));

            if (!attempt.Success) return Attempt<Customer>.Fail(attempt.Exception);

            var result = attempt.Result;

            if (result.IsSuccess())
            {
                Created.RaiseEvent(new Core.Events.NewEventArgs<Customer>(result.Target), this);

                return Attempt.Succeed((Customer)RuntimeCache.GetCacheItem(MakeCustomerCacheKey(customer), () => result.Target));
            }

            var error = new BraintreeApiException(result.Errors);
            LogHelper.Error<BraintreeCustomerApiService>("Braintree API Customer Create return a failure", error);

            return Attempt<Customer>.Fail(error);
        }
 public Commerce(IBillingProcessor billingProcessor, ICustomer customer, INotifier notifier, ILogger logger)
 {
     _BillingProcessor = billingProcessor;
     _Customer = customer;
     _Notifier = notifier;
     _Logger = logger;
 }
Exemple #5
0
 public Deposit(ICustomer customer, float amount, DateTime endDate)
 {
     Amount = amount;
     EndDate = endDate;
     Customer = customer;
     History = new List<IOperationHistory>();
 }
Exemple #6
0
 public Account(ICustomer owner, decimal balance, decimal interestRate)
 {
     this.Owner = owner;
     this.Balance = balance;
     this.InterestRate = interestRate;
     this.openDate = DateTime.Now;
 }
Exemple #7
0
 ///TODO: We need to talk about the contstructor.  An empty address does not make a lot of sense.
 internal CustomerAddress(ICustomer customer, string label)
 {
     Mandate.ParameterNotNull(customer, "customer");
     Mandate.ParameterNotNull(label, "label");
     _customerKey = customer.Key;
     _label = label;
 }
       protected BankAccount(ICustomer customer,decimal balance,decimal monthlyInterestRate)
       {
           this.Customer = customer;
           this.Balance = balance;
           this.MonthlyInterestRate = monthlyInterestRate;

       }
 private void FullyRegister(ISet behaviour, ICustomer customer)
 {
     Debug.WriteLine("Perform full customer registration");
     behaviour.Perform()
         .Given(customer.Register);
         //.And(customer...)
 }
        protected TradeAction(ICustomer customer, ISeller seller)
        {
            ThrowNewArgumentNullException(customer, seller);

            _customer = customer;
            _seller = seller;
        }
 public Commerce2(IBillingProcessorFactory billingProcessorFactory, ICustomer customer, INotifier notifier, ILogger logger)
 {
     _BillingProcessorFactory = billingProcessorFactory;
     _Customer = customer;
     _Notifier = notifier;
     _Logger = logger;
 }
		public IEnumerable<IFinancingEligibilityRule> GetRules(ICustomer customer)
		{
			yield return new IsOldEnoughRule(customer.Age);
			yield return new LivesInFinancingStateRule(customer.BillingStateAbbreviation);
			yield return new HasNoDelinquenciesOnFileRule(customerId: customer.CustomerId, financingRepository: _financingRepository);
			yield return new HasTopTierCreditScoreRule(ssn: customer.SSN, dateOfBirth: customer.DateOfBirth, financingRepository: _financingRepository);
		}
 public static bool Update(ICustomer customer)
 {
     List<ICustomer> customers = LoadAllCustomers();
     ICustomer customerToBeUpdated = null;
     for (int i = 0; i < customers.Count; i++)
     {
         ICustomer customerLoaded = customers[i];
         if (customer.Id == customerLoaded.Id)
         {
             customerToBeUpdated = customerLoaded;
             break;
         }
     }
     if (customerToBeUpdated != null)
     {
         customers.Remove(customerToBeUpdated);
         customers.Add(customer);
         SaveAllCustomers(customers);
         return true;
     }
     else
     {
         return false;
     }
 }
Exemple #14
0
        public int Compare(ICustomer x, ICustomer y)
        {
            if (x.ArrivalTime != y.ArrivalTime) return x.ArrivalTime.CompareTo(y.ArrivalTime);
            if (x.CartCount != y.CartCount) return x.CartCount.CompareTo(y.CartCount);

            return x.CustomerType.CompareTo(y.CustomerType);
        }
Exemple #15
0
 internal Customer(CustomerType type, string note, string name, IDataAccessFacade dataAccessFacade)
 {
     validateName(name);
     this.dataAccessFacade = dataAccessFacade;
     _customerEntity = dataAccessFacade.CreateCustomer(type, note, name);
     initializeParty(_customerEntity);
 }
 public Account(int id, ICustomer customer, decimal balance, decimal interestRate, DateTime creatDate)
     : this(id, customer, creatDate)
 {
     this.Balance = balance;
     this.InterestRate = interestRate;
     this.CreatedOn = DateTime.Now;
 }
 public IBooking CreateBooking(ISupplier supplier, ICustomer customer, string sale, int bookingNumber,
     DateTime StartDate, DateTime EndDate)
 {
     //Calls Bookingcollection class for create
     return bookingCollection.Create((Supplier)supplier, (Customer)customer, sale, bookingNumber, StartDate,
         EndDate);
 }
        public void AddPaymentRule(ISupplier supplier, ICustomer customer, BookingType bookingType, decimal percentage,
            int daysOffset, BaseDate baseDate, PaymentType paymentType)
        {
            Supplier supp = (Supplier)supplier;
            Customer cust = (Customer)customer;

            supp.AddPaymentRule(cust, bookingType, percentage, daysOffset, baseDate, paymentType);
        }
Exemple #19
0
        protected Account(double interestRate, decimal balance, ICustomer customer, DateTime dateCreated)
        {
            this.InterestRate = interestRate;
            this.Balance = balance;
            this.CreatonDate = dateCreated;

            this.customer = customer;
        }
 public List<IAppointment> AddAllCustomerAppointmentsToList(ICustomer icustomer, List<IAppointment> iappointmentsList)
 {
     for (int i = 0; i < icustomer.Appointments.Count; i++)
     {
         iappointmentsList.Add(icustomer.Appointments[i]);
     }
     return iappointmentsList;
 }
 public CreateCustomerDialog(MainWindow mainWindow, CustomerFacade cfInput, AppointmentFacade afInput)
 {
     InitializeComponent();
     this.mainWindow = mainWindow;
     cf = cfInput;
     icustomer = cf.CreateCustomer();
     af = afInput;
 }
        public IBooking CreateBooking(ISupplier supplier, ICustomer customer, string sale, int bookingNumber, 
            DateTime startDate, DateTime endDate)
        {
            BookingEntity booking = new BookingEntity(supplier, customer, sale, bookingNumber, startDate, endDate);
            bookings.Add(booking);

            return booking;
        }
Exemple #23
0
 IOrder GetOrder(Random rand, ICustomer customer, int counter, ITypeInfo ordersTypeInfo) {
     var order = (IOrder)ReflectionHelper.CreateObject(ordersTypeInfo.Type, new object[] { _objectSpace.Session });
     order.Customer = customer;
     order.OrderDate = DateTime.Now.AddDays((-rand.Next(365 * 3)));
     order.Reference = String.Format("ORD{0}", counter + 1000);
     order.Total = 0F;
     return order;
 }
        public CustomerInDetails(ICustomer customer)
        {
            InitializeComponent();

            txt_CustomerName.Text = customer.GetFullName;
            txtArrivalTime.Text = customer.ArrivalTime.ToString();
            txtQueueTime.Text = customer.WaitTime.ToString();
            txtServiceTime.Text = customer.ServiceTime.ToString();
        }
        public MajorTradeAction(ICustomer customer, ISeller seller, List<ITradeAction> actions) : base(customer, seller)
        {
            if (actions == null)
            {
                throw new NullReferenceException(nameof(actions));
            }

            _actions = actions;
        }
Exemple #26
0
        private IVendingMachine vm; //Автомат

        #endregion Fields

        #region Constructors

        //Демонстарция эмуляции отношения покупателя и торгового автомата
        public Demo(uint custMoney, uint vendingMoney)
        {
            c = new Customer(custMoney);
            vm = new VendingMachine(vendingMoney);
            c.setVendingMachine(vm);//Покупатель сразу подходит к автомату
            foodPrice = vm.getPrice();//Для демо
            setProtocol();//Установка протокола
            step = 0;
        }
Exemple #27
0
 public ProPayRequest(string requestUrl, string loginId, string transactionKey, ICustomer customer, CreditCardInfo card, decimal amount, bool testTransaction)
 {
     _amount = amount;
     _customer = customer;
     _card = card;
     _apiLogin = loginId;
     _apiTransactionKey = transactionKey;
     _testTransaction = testTransaction;
     _requestUrl = requestUrl;
 }
 public Guid AddCustomer(ICustomer customer)
 {
     var command = new AddCustomerCommand(customer);
     var result = _processor.ProcessCommand(command);
     if (result.EventsWereEmitted)
     {
         return command.CreatedGuid;
     }
     throw new CreationFailedException(command.CreatedGuid, typeof (ICustomer));
 }
Exemple #29
0
        public static ICustomer Update(DBCommand cmd, ICustomer instance,string id, string name, string sex, string phone, string address)
        {
            instance.ID = id;
            instance.Name = name;
            instance.Sex = sex;
            instance.Phone = phone;
            instance.Address = address;

            return cmd.Update("Customer", instance);
        }
Exemple #30
0
 public static Subscriber MapCustomerToSubscriber(ICustomer customer)
 {
     return new Subscriber
                {
                    Id = int.Parse(customer.SystemID),
                    FirstName = customer.FirstName,
                    LastName = customer.LastName,
                    Email = customer.Email,
                    Organisation = customer.Organization
                };
 }
Exemple #31
0
 public async Task Add(ICustomer customer)
 {
     _context.Customers.Add((InMemoryDataAccess.Customer)customer);
     await Task.CompletedTask;
 }
Exemple #32
0
 public MortgageAccount(double interestRate, decimal balance, ICustomer customer, DateTime dateCreated)
     : base(interestRate, balance, customer, dateCreated)
 {
 }
Exemple #33
0
 public Result <BuyFromVendorResult <T> > Server_BuyFromVendor(ICustomer <T> customer, T item, int amount = 1)
 {
     return(base.BuyFromVendor(customer, item, amount));
 }
 public CustomersController(ICustomer repo)
 {
     _repo = repo;
 }
 /// <summary>
 /// Gets a collection of <see cref="IInvoice"/> associated with the customer
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <returns>
 /// A collection of <see cref="IInvoice"/>.
 /// </returns>
 public static IEnumerable <IInvoice> Invoices(this ICustomer customer)
 {
     return(customer.Invoices(MerchelloContext.Current));
 }
 /// <summary>
 /// The <see cref="ICustomerAddress"/> to be saved
 /// </summary>
 /// <param name="customer">
 /// The customer associated with the address
 /// </param>
 /// <param name="address">
 /// The address.
 /// </param>
 /// <returns>
 /// The <see cref="ICustomerAddress"/>.
 /// </returns>
 public static ICustomerAddress SaveCustomerAddress(this ICustomer customer, ICustomerAddress address)
 {
     return(customer.SaveCustomerAddress(MerchelloContext.Current, address));
 }
Exemple #37
0
 public void Remove(ICustomer customer)
 {
     this.customersList.Remove(customer);
 }
Exemple #38
0
 /// <summary>
 /// The default customer address.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="addressType">
 /// The address type.
 /// </param>
 /// <returns>
 /// The default <see cref="ICustomerAddress"/> of a given type
 /// </returns>
 internal static ICustomerAddress DefaultCustomerAddress(this ICustomer customer, IMerchelloContext merchelloContext, AddressType addressType)
 {
     return(((ServiceContext)merchelloContext.Services).CustomerAddressService.GetDefaultCustomerAddress(customer.Key, addressType));
 }
Exemple #39
0
 /// <summary>
 /// The addresses.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="merchelloContext">
 /// The merchello Context.
 /// </param>
 /// <param name="addressType">
 /// The address Type.
 /// </param>
 /// <returns>
 /// The collection of <see cref="ICustomerAddress"/> associated with the customer of a given type
 /// </returns>
 internal static IEnumerable <ICustomerAddress> CustomerAddresses(this ICustomer customer, IMerchelloContext merchelloContext, AddressType addressType)
 {
     return(((ServiceContext)merchelloContext.Services).CustomerAddressService.GetByCustomerKey(customer.Key, addressType));
 }
Exemple #40
0
 /// <summary>
 /// The remove from collection.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="collection">
 /// The collection.
 /// </param>
 public static void RemoveFromCollection(this ICustomer customer, IEntityCollection collection)
 {
     customer.RemoveFromCollection(collection.Key);
 }
Exemple #41
0
 /// <summary>
 /// The add to collection.
 /// </summary>
 /// <param name="customer">
 /// The invoice.
 /// </param>
 /// <param name="collection">
 /// The collection.
 /// </param>
 public static void AddToCollection(this ICustomer customer, IEntityCollection collection)
 {
     customer.AddToCollection(collection.Key);
 }
Exemple #42
0
 private static void AssignCustomerValues(ICustomer customer, SalesOrderDt salesOrderDt)
 {
     salesOrderDt.Currency   = customer.Currency;
     salesOrderDt.CustomerId = customer.CustomerId;
     salesOrderDt.Warehouse  = customer.Warehouse;
 }
Exemple #43
0
 public MortgageAccount(ICustomer customer, decimal balance, decimal monthlyInterestRate)
     : base(customer, balance, monthlyInterestRate)
 {
 }
Exemple #44
0
 public async Task Update(ICustomer customer)
 {
     _context.Users.Update((Customer)customer);
     await _context.SaveChangesAsync();
 }
Exemple #45
0
 public void Add(ICustomer customer)
 {
     this.customersList.Add(customer);
 }
Exemple #46
0
        /// <summary>
        /// The create customer address.
        /// </summary>
        /// <param name="customer">
        /// The customer.
        /// </param>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="label">
        /// The customer label
        /// </param>
        /// <param name="addressType">
        /// The address type.
        /// </param>
        /// <returns>
        /// The <see cref="ICustomerAddress"/>.
        /// </returns>
        internal static ICustomerAddress CreateCustomerAddress(this ICustomer customer, IMerchelloContext merchelloContext, IAddress address, string label, AddressType addressType)
        {
            var customerAddress = address.ToCustomerAddress(customer, label, addressType);

            return(customer.SaveCustomerAddress(merchelloContext, customerAddress));
        }
Exemple #47
0
 public ICustomer Find(ICustomer customer)
 {
     return(this.customersList.Find(item => item == customer));
 }
Exemple #48
0
 /// <summary>
 /// Gets the collection of <see cref="IInvoice"/> associated with the customer
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <returns>
 /// A collection of <see cref="IInvoice"/>.
 /// </returns>
 internal static IEnumerable <IInvoice> Invoices(this ICustomer customer, IMerchelloContext merchelloContext)
 {
     return(merchelloContext.Services.InvoiceService.GetInvoicesByCustomerKey(customer.Key));
 }
 /// <summary>
 /// Deletes a customer address.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="address">
 /// The address to be deleted
 /// </param>
 public static void DeleteCustomerAddress(this ICustomer customer, ICustomerAddress address)
 {
     customer.DeleteCustomerAddress(MerchelloContext.Current, address);
 }
Exemple #50
0
 /// <summary>
 /// Gets the collection of <see cref="IPayment"/> associated with a customer
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <returns>
 /// A collection of <see cref="IPayment"/>.
 /// </returns>
 internal static IEnumerable <IPayment> Payments(this ICustomer customer, IMerchelloContext merchelloContext)
 {
     return(merchelloContext.Services.PaymentService.GetPaymentsByCustomerKey(customer.Key));
 }
        public void Delete(Guid id)
        {
            ICustomer customer = _customerDataBase.Single(c => c.Id == id);

            _customerDataBase.Remove(customer);
        }
Exemple #52
0
 /// <summary>
 /// The customer address collection as JSON.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <returns>
 /// The JSON representation <see cref="string"/>.
 /// </returns>
 private static string AddressesAsJson(this ICustomer customer)
 {
     return(JsonConvert.SerializeObject(customer.Addresses ?? new List <ICustomerAddress>()));
 }
Exemple #53
0
 /// <summary>
 /// The default customer address associated with a customer of a given type
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="addressType">
 /// The address type.
 /// </param>
 /// <returns>
 /// The collection of <see cref="ICustomerAddress"/>
 /// </returns>
 public static ICustomerAddress DefaultCustomerAddress(this ICustomer customer, AddressType addressType)
 {
     return(customer.DefaultCustomerAddress(MerchelloContext.Current, addressType));
 }
Exemple #54
0
 /// <summary>
 /// Creates a <see cref="ICustomerAddress"/> based off an <see cref="IAddress"/>
 /// </summary>
 /// <param name="customer">
 /// The customer associated with the address
 /// </param>
 /// <param name="address">
 /// The address.
 /// </param>
 /// <param name="label">
 /// The address label
 /// </param>
 /// <param name="addressType">
 /// The <see cref="AddressType"/>
 /// </param>
 /// <returns>
 /// The <see cref="ICustomerAddress"/>.
 /// </returns>
 public static ICustomerAddress CreateCustomerAddress(this ICustomer customer, IAddress address, string label, AddressType addressType)
 {
     return(customer.CreateCustomerAddress(MerchelloContext.Current, address, label, addressType));
 }
Exemple #55
0
 public Result <SellToVendorResult <T> > Server_SellToVendor(ICustomer <T> customer, IVendorProduct <T> product, int amount = 1)
 {
     return(base.SellToVendor(customer, product, amount));
 }
Exemple #56
0
        public async Task Add(ICustomer customer)
        {
            await _context.Users.AddAsync((Customer)customer);

            await _context.SaveChangesAsync();
        }
Exemple #57
0
 public void ChangeCustomer(ICustomer c)
 {
     touchForm.ChangeCustomer(c);
 }
Exemple #58
0
 public MortgageAccount(ICustomer customer, decimal ballance, double interesetrate)
     : base(customer, ballance, interesetrate)
 {
 }
Exemple #59
0
 public void Show(ICustomer customer)
 {
     touchForm.Show(customer);
 }
Exemple #60
0
 /// <summary>
 /// Gets a collection of <see cref="IPayment"/> associated with the customer
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <returns>
 /// A collection of <see cref="IPayment"/>
 /// </returns>
 public static IEnumerable <IPayment> Payments(this ICustomer customer)
 {
     return(customer.Payments(MerchelloContext.Current));
 }