Ejemplo n.º 1
0
        public EmployeePayHistory ChangePayRate()
        {
            EmployeePayHistory current = CurrentEmployeePayHistory();
            var eph = Container.NewTransientInstance <EmployeePayHistory>();

            eph.Employee       = this;
            eph.RateChangeDate = DateTime.Now.Date;
            eph.PayFrequency   = current.PayFrequency;
            return(eph);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
 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));
     }
 }
Ejemplo n.º 8
0
        public WorkOrderRouting AddNewRouting(Location loc)
        {
            var wor = Container.NewTransientInstance <WorkOrderRouting>();

            wor.WorkOrder = this;
            wor.Location  = loc;
            short highestSequence = 0;
            short increment       = 1;

            if (WorkOrderRoutings.Count > 0)
            {
                highestSequence = WorkOrderRoutings.Max(n => n.OperationSequence);
            }
            highestSequence      += increment;
            wor.OperationSequence = highestSequence;
            return(wor);
        }
Ejemplo n.º 9
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);
            }
        }
        public SalesOrderDetail AddNewDetail(Product product,
                                             [DefaultValue((short)1), Range(1, 999)] short quantity)
        {
            int stock = product.NumberInStock();

            if (stock < quantity)
            {
                var t = Container.NewTitleBuilder();
                t.Append("Current inventory of").Append(product).Append(" is").Append(stock);
                Container.WarnUser(t.ToString());
            }
            var sod = Container.NewTransientInstance <SalesOrderDetail>();

            sod.SalesOrderHeader    = this;
            sod.SalesOrderID        = SalesOrderID;
            sod.OrderQty            = quantity;
            sod.SpecialOfferProduct = product.BestSpecialOfferProduct(quantity);
            sod.Recalculate();

            return(sod);
        }
Ejemplo n.º 11
0
 public virtual Product NewProduct()
 {
     return(Container.NewTransientInstance <Product>());
 }
Ejemplo n.º 12
0
 public Address CreateNewAddress() {
     var _Address = Container.NewTransientInstance<Address>();
     _Address.AddressFor = this;
     return _Address;
 }