コード例 #1
0
        public void SetUp()
        {
            //create a customer, and fetch it, so we can add an order to it
            String cust1String = Guid.NewGuid().ToString();

            Int32 customerId = DataService.AddCustomer(
                GetCustomer(cust1String, "1"));

            if (customerId > 0)
                cust = DataAccess.DataService.
                    FetchAllCustomers().Where(c => c.CustomerId == customerId).Single();


            //create a Order against the customer we just created

            DataService.AddOrder(GetOrder(customerId));
            DataService.AddOrder(GetOrder(customerId));
            DataService.AddOrder(GetOrder(customerId));
            DataService.AddOrder(GetOrder(customerId));
            Int32 orderId = DataService.AddOrder(
                GetOrder(customerId));


            if (orderId > 0)
                ord = DataAccess.DataService.
                    FetchAllOrders(customerId).Where(o => o.OrderId == orderId).Single();
        }
コード例 #2
0
 /// <summary>
 /// Translates a UI CustomerModel into a data layer Customer
 /// </summary>
 /// <param name="uiLayerCustomer">A UI CustomerModel</param>
 /// <returns>A data layer Customer</returns>
 private Customer TranslateUICustomerToDataLayerCustomer(CustomerModel uiLayerCustomer)
 {
     Customer dataLayerCustomer = new Customer();
     dataLayerCustomer.CustomerId = uiLayerCustomer.CustomerId.DataValue;
     dataLayerCustomer.FirstName = uiLayerCustomer.FirstName.DataValue;
     dataLayerCustomer.LastName = uiLayerCustomer.LastName.DataValue;
     dataLayerCustomer.Email = uiLayerCustomer.Email.DataValue;
     dataLayerCustomer.HomePhoneNumber = uiLayerCustomer.HomePhoneNumber.DataValue;
     dataLayerCustomer.MobilePhoneNumber = uiLayerCustomer.MobilePhoneNumber.DataValue;
     dataLayerCustomer.Address1 = uiLayerCustomer.Address1.DataValue;
     dataLayerCustomer.Address2 = uiLayerCustomer.Address2.DataValue;
     dataLayerCustomer.Address3 = uiLayerCustomer.Address3.DataValue;
     return dataLayerCustomer;
 }
コード例 #3
0
 /// <summary>
 /// Creates a dummy Customer to insert into the database
 /// </summary>
 private Customer GetCustomer(String prefix, String suffix)
 {
     Customer c = new Customer();
     c.FirstName = String.Format("{0}_{1}", prefix, suffix);
     c.LastName = String.Format("{0}_{1}", prefix, suffix);
     c.HomePhoneNumber = String.Format("{0}_{1}", prefix, suffix);
     c.MobilePhoneNumber = String.Format("{0}_{1}", prefix, suffix);
     c.Address1 = String.Format("{0}_{1}", prefix, suffix);
     c.Email = String.Format("{0}_{1}", prefix, suffix);
     c.Address2 = String.Format("{0}_{1}", prefix, suffix);
     c.Address3 = String.Format("{0}_{1}", prefix, suffix);
     return c;
 }
コード例 #4
0
ファイル: CustomerModel.cs プロジェクト: ssickles/archive
        /// <summary>
        /// Allows Service layer objects to be translated into
        /// UI objects
        /// </summary>
        /// <param name="cust">Service layer object</param>
        /// <returns>UI layer object</returns>
        public static CustomerModel CustomerToCustomerModel(Customer cust)
        {
            CustomerModel customerModel = new CustomerModel();
            customerModel.CustomerId.DataValue = cust.CustomerId;
            customerModel.FirstName.DataValue = String.IsNullOrEmpty(cust.FirstName) ? String.Empty : cust.FirstName.Trim();
            customerModel.LastName.DataValue = String.IsNullOrEmpty(cust.LastName) ? String.Empty : cust.LastName.Trim();
            customerModel.Email.DataValue = String.IsNullOrEmpty(cust.Email) ? String.Empty : cust.Email.Trim();
            customerModel.HomePhoneNumber.DataValue = String.IsNullOrEmpty(cust.HomePhoneNumber) ? String.Empty : cust.HomePhoneNumber.Trim();
            customerModel.MobilePhoneNumber.DataValue = String.IsNullOrEmpty(cust.MobilePhoneNumber) ? String.Empty : cust.MobilePhoneNumber.Trim();
            customerModel.Address1.DataValue = String.IsNullOrEmpty(cust.Address1) ? String.Empty : cust.Address1.Trim();
            customerModel.Address2.DataValue = String.IsNullOrEmpty(cust.Address2) ? String.Empty : cust.Address2.Trim();
            customerModel.Address3.DataValue = String.IsNullOrEmpty(cust.Address3) ? String.Empty : cust.Address3.Trim();
            //convert to UI type objects
            customerModel.Orders = new Cinch.DispatcherNotifiedObservableCollection<OrderModel>(cust.Orders.ToList().ConvertAll(
                    new Converter<Order, OrderModel>(OrderModel.OrderToOrderModel)));
            return customerModel;

        }
コード例 #5
0
 partial void DeleteCustomer(Customer instance);
コード例 #6
0
 partial void UpdateCustomer(Customer instance);
コード例 #7
0
 partial void InsertCustomer(Customer instance);