Exemplo n.º 1
0
#pragma warning restore 612,618
        public void AddNewDetails(Product product,
                                  [DefaultValue((short)1)] short quantity)
        {
            var detail = AddNewDetail(product, quantity);

            Container.Persist(ref detail);
        }
Exemplo n.º 2
0
        public SalesOrderHeader NewOrder()
        {
            var order = OrderContributedActions.CreateNewOrder(Root, true);

            Container.Persist(ref order);
            return(order);
        }
Exemplo n.º 3
0
        public void Persisted()
        {
            var ca = Container.NewTransientInstance <CustomerAddress>();

            ca.Address     = this;
            ca.AddressType = AddressType;
            ca.Customer    = ForCustomer;
            Container.Persist(ref ca);
        }
Exemplo n.º 4
0
        public void Persisted()
        {
            var relationship = Container.NewTransientInstance <BusinessEntityContact>();

            relationship.BusinessEntityID = ForEntity.BusinessEntityID;
            relationship.PersonID         = this.BusinessEntityID;
            relationship.ContactTypeID    = ContactType.ContactTypeID;
            Container.Persist(ref relationship);
        }
        public WorkOrder CreateNewWorkOrder3([ContributedAction("Work Orders"), FindMenu, Description("product partial name")] Product product, int orderQty)
        {
            var wo = CreateNewWorkOrder(product);

            wo.OrderQty    = orderQty;
            wo.ScrappedQty = 0;
            Container.Persist(ref wo);
            return(wo);
        }
Exemplo n.º 6
0
 public void AddAllItemsInCartToOrder(SalesOrderHeader order)
 {
     foreach (ShoppingCartItem item in Cart())
     {
         var detail = order.AddNewDetail(item.Product, (short)item.Quantity);
         Container.Persist <SalesOrderDetail>(ref detail);
     }
     EmptyCart();
 }
Exemplo n.º 7
0
        public void Persisted()
        {
            var relationship = new BusinessEntityContact();

            relationship.BusinessEntityID = ForEntity.BusinessEntityID;
            relationship.PersonID         = this.BusinessEntityID;
            relationship.ContactTypeID    = ContactType.ContactTypeID;
            Container.Persist(ref relationship);
        }
Exemplo n.º 8
0
        public void Persisted()
        {
            var link = Container.NewTransientInstance <ContactCreditCard>();

            link.CreditCard = this;
            link.Contact    = ForContact;
            Container.Persist(ref link);

            Creator.CreatedCardHasBeenSaved(this);
        }
Exemplo n.º 9
0
        public void AddNewDetails(Product prod, short qty, decimal unitPrice)
        {
            var det = AddNewDetail(prod, qty);

            det.UnitPrice   = unitPrice;
            det.DueDate     = DateTime.Today.AddDays(7);
            det.ReceivedQty = 0;
            det.RejectedQty = 0;
            Container.Persist(ref det);
        }
Exemplo n.º 10
0
        public void ChangeSalesQuota(decimal newQuota)
        {
            SalesQuota = newQuota;
            var history = Container.NewTransientInstance <SalesPersonQuotaHistory>();

            history.SalesPerson = this;
            history.SalesQuota  = newQuota;
            history.QuotaDate   = DateTime.Now;
            Container.Persist(ref history);
            QuotaHistory.Add(history);
        }
Exemplo n.º 11
0
        public void ChangeSalesQuota(decimal newQuota)
        {
            SalesQuota = newQuota;
            var history = new SalesPersonQuotaHistory();

            history.SalesPerson = this;
            history.SalesQuota  = newQuota;
            history.QuotaDate   = DateTime.Now;
            Container.Persist(ref history);
            QuotaHistory.Add(history);
        }
 public static void AddAllItemsInCartToOrder(
     SalesOrderHeader order,
     IFunctionalContainer container)
 {
     foreach (ShoppingCartItem item in Cart(container))
     {
         var detail = order.AddNewDetail(item.Product, (short)item.Quantity, container);
         Container.Persist(ref detail);
     }
     EmptyCart(container);
 }
Exemplo n.º 13
0
        public void Persisted()
        {
            var ca = Container.NewTransientInstance <BusinessEntityAddress>();

            ca.AddressID        = this.AddressID;
            ca.AddressTypeID    = this.AddressType.AddressTypeID;
            ca.BusinessEntityID = AddressFor.BusinessEntityID;
            ca.AddressType      = this.AddressType;
            ca.rowguid          = Guid.NewGuid();
            ca.ModifiedDate     = DateTime.Now;
            Container.Persist(ref ca);
        }
Exemplo n.º 14
0
        public void ChangeSalesTerritory(SalesTerritory newTerritory)
        {
            SalesTerritory = newTerritory;
            var history = Container.NewTransientInstance <SalesTerritoryHistory>();

            history.SalesPerson    = this;
            history.SalesTerritory = newTerritory;
            history.StartDate      = DateTime.Now;
            Container.Persist(ref history);
            TerritoryHistory.Add(history);
            CurrentTerritoryHistory().EndDate = DateTime.Now;
        }
Exemplo n.º 15
0
        public void ChangeDepartmentOrShift(Department department, [Optionally] Shift shift)
        {
            CurrentAssignment().EndDate = DateTime.Now;
            var newAssignment = Container.NewTransientInstance <EmployeeDepartmentHistory>();

            newAssignment.Department = department;
            newAssignment.Shift      = shift;
            newAssignment.Employee   = this;
            newAssignment.StartDate  = DateTime.Now;
            Container.Persist(ref newAssignment);
            DepartmentHistory.Add(newAssignment);
        }
Exemplo n.º 16
0
        public void CreateNewPhoneNumber(PhoneNumberType type,
                                         [RegularExpression(@"[0-9][0-9\s-]+")] string phoneNumber)
        {
            var pp = Container.NewTransientInstance <PersonPhone>();

            pp.BusinessEntityID  = this.BusinessEntityID;
            pp.Person            = this;
            pp.PhoneNumberType   = type;
            pp.PhoneNumberTypeID = type.PhoneNumberTypeID;
            pp.PhoneNumber       = phoneNumber;
            Container.Persist(ref pp);
            this.PhoneNumbers.Add(pp);
        }
Exemplo n.º 17
0
        public void Persisted()
        {
            var link = new PersonCreditCard();

            link.CreditCard = this;
            link.Person     = ForContact;
            Container.Persist(ref link);

            if (Creator != null)
            {
                Creator.CreatedCardHasBeenSaved(this);
            }
        }
        public SalesOrderHeader CreateOrder()
        {
            SalesOrderHeader soh = OrderRepo.CreateNewOrder(Customer, true);

            soh.Status = (byte)OrderStatus.InProcess;
            Container.Persist(ref soh);

            foreach (OrderLine d in Details)
            {
                d.AddTo(soh);
            }

            return(soh);
        }
 public void AddNewSalesReason(SalesReason reason)
 {
     if (SalesOrderHeaderSalesReason.All(y => y.SalesReason != reason))
     {
         var link = Container.NewTransientInstance <SalesOrderHeaderSalesReason>();
         link.SalesOrderHeader = this;
         link.SalesReason      = reason;
         Container.Persist(ref link);
         SalesOrderHeaderSalesReason.Add(link);
     }
     else
     {
         Container.WarnUser(string.Format("{0} already exists in Sales Reasons", reason.Name));
     }
 }
Exemplo n.º 20
0
        public void Persisted()
        {
            if (Contactee is Store)
            {
                var contactRole = Container.NewTransientInstance <StoreContact>();
                contactRole.Store       = (Store)Contactee;
                contactRole.Contact     = this;
                contactRole.ContactType = ContactType;

                Container.Persist(ref contactRole);
            }
            else if (Contactee is Vendor)
            {
                var vendorContact = Container.NewTransientInstance <VendorContact>();
                vendorContact.Vendor      = (Vendor)Contactee;
                vendorContact.Contact     = this;
                vendorContact.ContactType = ContactType;

                Container.Persist(ref vendorContact);
            }
        }
Exemplo n.º 21
0
        public void CreateMultipleSpecialOffers(
            string description,
            [Mask("P")] decimal discountPct,
            string type,
            string category,
            int minQty,
            DateTime startDate
            )
        {
            var so = NewTransientInstance <SpecialOffer>();

            so.Description = description;
            so.DiscountPct = discountPct;
            so.Type        = type;
            so.Category    = category;
            so.MinQty      = minQty;
            //Deliberately created non-current so they don't show up
            //in Current Special Offers (but can be viewed via All Special Offers)
            so.StartDate = startDate;
            so.EndDate   = new DateTime(2003, 12, 31);
            Container.Persist(ref so);
        }
Exemplo n.º 22
0
 /// <summary>
 ///     Make the specified transient object persistent. Throws an exception if object is already persistent.
 /// </summary>
 protected static void Persist <T>(ref T transientObject)
 {
     Container.Persist(ref transientObject);
 }
        public void AddTo(SalesOrderHeader salesOrder)
        {
            SalesOrderDetail sod = salesOrder.AddNewDetail(Product, Number);

            Container.Persist(ref sod);
        }