public void Install() {
            SVEN = EmployeeFixture.SVEN;
            DICK = EmployeeFixture.DICK;

            var date1 = new DateTime(2007, 7, 15);

            SVEN_CLAIM_4 = CreateNewClaim(SVEN, DICK, "July 07 - 2 visits to Dublin", ProjectCodeFixture.CODE2, date1);
            AddPrivateCarJourney(SVEN_CLAIM_4, date1, "Own car to airport", "Henley on Thames", "Heathrow", true, 50);
            AddGeneralExpense(SVEN_CLAIM_4, date1, "Car Parking at Heathrow", Convert.ToDecimal(42.9));
            AddAirfare(SVEN_CLAIM_4, date1, null, 165M, "Aer Lingus", "LHR", "DUB", true);
            AddTaxi(SVEN_CLAIM_4, date1, "Taxis to & from Hotel", 30M, "Dublin Airport", "Alexander Hotel", true);
            AddHotel(SVEN_CLAIM_4, date1, "Alexander Hotel", 0M, "http://ocallaghanhotels.visrez.com/dublinmain/Alexander.aspx", 1, 89M, Convert.ToDecimal(15.45), Convert.ToDecimal(3.5));
            AddMeal(SVEN_CLAIM_4, date1, "Dinner", 28M);

            date1 = new DateTime(2007, 7, 23);

            AddPrivateCarJourney(SVEN_CLAIM_4, date1, "Own car to airport", "Henley on Thames", "Heathrow", true, 50);
            AddGeneralExpense(SVEN_CLAIM_4, date1, "Car Parking at Heathrow", Convert.ToDecimal(42.9));
            AddAirfare(SVEN_CLAIM_4, date1, null, 129M, "Aer Lingus", "LHR", "DUB", true);
            AddTaxi(SVEN_CLAIM_4, date1, "Taxis to & from Hotel", 32M, "Dublin Airport", "Alexander Hotel", true);
            AddHotel(SVEN_CLAIM_4, date1, "Alexander Hotel", 0M, "http://ocallaghanhotels.visrez.com/dublinmain/Alexander.aspx", 1, 89M, Convert.ToDecimal(15.45), Convert.ToDecimal(4.8));
            AddMeal(SVEN_CLAIM_4, date1, "Dinner", 31M);

            SVEN_CLAIM_4.Submit(DICK, false);
            SVEN_CLAIM_4.ApproveItems(false);
        }
Ejemplo n.º 2
0
 protected internal virtual Claim CreateNewClaim(Employee employee, Employee approver, string description, ProjectCode projectCode, DateTime dateCreated) {
     Claim claim = ClaimRepository.CreateNewClaim(employee, description);
     claim.ModifyApprover(approver);
     claim.ModifyProjectCode(projectCode);
     claim.DateCreated = dateCreated;
     return claim;
 }
Ejemplo n.º 3
0
            public virtual bool DescriptionIsUniqueForClaimant(Employee employee, string initialDescription) {
                IQueryable<Claim> query =
                    from claim in Instances<Claim>()
                    where claim.Claimant.Equals(employee) && claim.Description == initialDescription
                    select claim;

                return query.Count() == 0;
            }
            public virtual bool DescriptionIsUniqueForClaimant(Employee employee, string initialDescription) {
                IQueryable<Claim> query =
                    from claim in Instances<Claim>()
                    where claim.Claimant.Id == employee.Id && claim.Description == initialDescription
                    select claim;

                return !query.Any();
            }
        public void Install() {
            SVEN = EmployeeFixture.SVEN;
            DICK = EmployeeFixture.DICK;

            SVEN_CLAIM_5 = CreateNewClaim(SVEN, null, "14th Mar - Sales call, London", ProjectCodeFixture.CODE1, new DateTime(2007, 4, 3));
            var mar14th = new DateTime(2007, 3, 14);
            AddTaxi(SVEN_CLAIM_5, mar14th, null, 18M, "Euston", "City", true);
            AddMeal(SVEN_CLAIM_5, mar14th, "Lunch with client", 50M);
        }
        private void createEmployees() {
            SVEN = CreateEmployee("Sven Bloggs", "sven", "*****@*****.**", CurrencyFixture.GBP);
            DICK = CreateEmployee("Dick Barton", "dick", "*****@*****.**", CurrencyFixture.GBP);
            BOB = CreateEmployee("Robert Bruce", "bob", "*****@*****.**", CurrencyFixture.USD);
            JOE = CreateEmployee("Joe Sixpack", "joe", "*****@*****.**", CurrencyFixture.USD);
            CreateEmployee("Intrepid Explorer", "exploration", "*****@*****.**", CurrencyFixture.USD);

            SVEN.NormalApprover = DICK;
            DICK.NormalApprover = BOB;
        }
Ejemplo n.º 7
0
        public  void Install() {
            SVEN = EmployeeFixture.SVEN;
            DICK = EmployeeFixture.DICK;

            SVEN_CLAIM_1 = CreateNewClaim(SVEN, DICK, "28th Mar - Sales call, London", ProjectCodeFixture.CODE1, new DateTime(2007, 4, 3));
            var mar28th = new DateTime(2007, 3, 28);
            AddTaxi(SVEN_CLAIM_1, mar28th, null, Convert.ToDecimal(8.5), "Euston", "Mayfair", false);
            AddMeal(SVEN_CLAIM_1, mar28th, "Lunch with client", Convert.ToDecimal(31.9));
            AddTaxi(SVEN_CLAIM_1, mar28th, null, 11M, "Mayfair", "City", false);
        }
Ejemplo n.º 8
0
        public  void Install() {
            SVEN = EmployeeFixture.SVEN;
            DICK = EmployeeFixture.DICK;

            SVEN_CLAIM_3 = CreateNewClaim(SVEN, DICK, "23rd Feb - Sales trip, London", ProjectCodeFixture.CODE1, new DateTime(2007, 4, 3));
            var feb23rd = new DateTime(2007, 2, 23);
            AddTaxi(SVEN_CLAIM_3, feb23rd, null, 18M, "Euston", "City", false);
            AddTaxi(SVEN_CLAIM_3, feb23rd, null, 10M, "City", "West End", false);
            GeneralExpense meal = AddMeal(SVEN_CLAIM_3, feb23rd, "Lunch with client", 50M);
            SVEN_CLAIM_3.Submit(DICK, false);
            meal.Reject("Too expensive");
            SVEN_CLAIM_3.ApproveItems(true);
            SVEN_CLAIM_3.ReturnToClaimant("Please discuss Meal item with me", false);
        }
Ejemplo n.º 9
0
 private string CreateUniqueDescription(Employee employee, string initialDescription) {
     int increment = 2;
     string description = initialDescription;
     while (! (DescriptionIsUniqueForClaimant(employee, description))) {
         description = initialDescription + CLAIM_DIFFERENTIATOR + increment;
         increment += 1;
     }
     return description;
 }
Ejemplo n.º 10
0
 public virtual string DefaultUniqueClaimDescription(Employee employee) {
     return CreateUniqueDescription(employee, CreateDefaultClaimDescription(null));
 }
Ejemplo n.º 11
0
 public virtual Claim CreateNewClaim(Employee employee, string description) {
     var newClaim = NewTransientInstance<Claim>();
     newClaim.Claimant = employee;
     newClaim.Approver = employee.NormalApprover;
     newClaim.InitialiseTotal();
     newClaim.Description = CreateUniqueDescription(employee, description);
     Persist(ref newClaim);
     newClaim.ChangeStatusToNew();
     return newClaim;
 }
Ejemplo n.º 12
0
            public IList<AbstractExpenseItem> findExpenseItemsOfType(Employee employee, ExpenseType type) {
                IQueryable<AbstractExpenseItem> query =
                    from item in Instances<AbstractExpenseItem>()
                    where item.ExpenseType.Equals(type) && item.Claim.Claimant.Equals(employee)
                    select item;

                return query.ToList();
            }
Ejemplo n.º 13
0
 public virtual string ValidateApprover(Employee approverToValidate) {
     return Convert.ToString(((((approverToValidate.Equals(Claimant))) ? Employee.CANT_BE_APPROVER_FOR_OWN_CLAIMS : null)));
 }
Ejemplo n.º 14
0
 public virtual void ModifyApprover(Employee newApprover) {
     Approver = newApprover;
 }
Ejemplo n.º 15
0
            private IList<Claim> FindClaims(Employee employee, ClaimStatus status, string description) {
                IQueryable<Claim> query =
                    from claim in Instances<Claim>()
                    where (employee == null || claim.Claimant.Equals(employee)) && (status == null || claim.Status.Equals(status)) && (description == null || claim.Description.LastIndexOf(description) >= 0)
                    select claim;

                return query.ToList();
            }
 private Claim CreateClaim(Employee employee) {
     var rDate = new DateTime(random.Next(7) + 2000, random.Next(12) + 1, random.Next(28) + 1);
     Claim claim = ClaimRepository.CreateNewClaim(employee, rDate.ToString());
     claim.DateCreated = rDate;
     return claim;
 }
 private void CreateClaims(Employee employee) {
     for (int i = claimCount - 1; i >= 0; i--) {
         AddRandomExpenseItems(CreateClaim(employee));
     }
 }
            private IList<Claim> FindClaims(Employee employee, ClaimStatus status, string description) {
                IQueryable<Claim> query = Instances<Claim>();

                if (employee != null) {
                    query = query.Where(c => c.Claimant.Id == employee.Id);
                }

                if (status != null) {
                    query = query.Where(c => c.Status.Id == status.Id);
                }

                if (description != null) {
                    query = query.Where(c => c.Description.Contains(description));
                }

                return query.ToList();
            }
Ejemplo n.º 19
0
            public IList<Claim> findClaimsAwaitingApprovalBy(Employee approver) {
                IQueryable<Claim> query =
                    from claim in Instances<Claim>()
                    where approver.Equals(claim.Approver) && claim.Status.TitleString.Equals(ClaimStatus.SUBMITTED)
                    select claim;

                return query.ToList();
            }
Ejemplo n.º 20
0
 public virtual void ModifyNormalApprover(Employee newNormalApprover) {
     m_recordActionService.RecordFieldChange(this, "Normal Approver", NormalApprover, m_normalApprover);
     NormalApprover = newNormalApprover;
 }
Ejemplo n.º 21
0
 public virtual void ClearApprover() {
     Approver = null;
 }
Ejemplo n.º 22
0
 public virtual void ClearNormalApprover() {
     m_recordActionService.RecordFieldChange(this, "Normal Approver", NormalApprover, "EMPTY");
     NormalApprover = null;
 }
Ejemplo n.º 23
0
 public virtual void Submit(Employee approver, [Named("Advise approver by email")] bool sendEmail) {
     ChangeStatusToSubmitted();
     for (int i = 0; i < ExpenseItems.Count; i++) {
         AbstractExpenseItem item = (ExpenseItems[i]);
         item.IsLocked = (true);
     }
     string message = Claimant.Name + CLAIM_AWAITING_YOUR_APPROVAL;
     SendEmailIfPossible(sendEmail, approver.EmailAddress, message);
     m_recordActionService.RecordMenuAction(this, "Submit", "to " + approver.Title());
 }
Ejemplo n.º 24
0
 public virtual string ValidateNormalApprover(Employee newApprover) {
     return Convert.ToString(((Equals(newApprover)) ? CANT_BE_APPROVER_FOR_OWN_CLAIMS : null));
 }