Пример #1
0
 public Task LoadAssignmentFromHistory (AssignmentHistory assignmentHistory)
 {
     return service
         .GetAssignmentFromHistory (assignmentHistory)
         .ContinueOnCurrentThread (t => {
             PastAssignment = t.Result.FirstOrDefault ();
             PastAssignment.IsHistory = true;
             return t.Result;
         });
 }
Пример #2
0
 public Task <List <Assignment> > GetAssignmentFromHistory(AssignmentHistory assignmentHistory, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Database.GetConnection(cancellationToken)
            .QueryAsync <Assignment> (@"
             select Assignment.*, 
                    (SELECT SUM(Labor.Ticks) FROM Labor WHERE Assignment.Id = Labor.AssignmentId) as TotalTicks,       
                    (SELECT COUNT(AssignmentItem.Id) FROM AssignmentItem WHERE Assignment.Id = AssignmentItem.AssignmentId) AS TotalItems,       
                    (SELECT SUM(Expense.Cost) FROM Expense WHERE Assignment.Id = Expense.AssignmentId) AS TotalExpenses
             from Assignment
             where Assignment.Id = ?
         ", assignmentHistory.AssignmentId));
 }
		public SummaryHistoryActivity ()
		{
			historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
			itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();
			laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();
			photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();
			expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel> ();
			documentViewModel = ServiceContainer.Resolve<DocumentViewModel> ();
			menuViewModel = ServiceContainer.Resolve<MenuViewModel> ();

			assignmentHistory = historyViewModel.SelectedAssignmentHistory;
		}
		/// <summary>
		/// Sets up the history record for this cell
		/// </summary>
		public void SetHistory (AssignmentHistory history, bool enabled)
		{
			//Any 1-time settings
			if (!loaded) {
				number.TextColor = 
					length.TextColor =
					description.TextColor = 
					date.TextColor = Theme.LabelColor;

				phone.IconImage = Theme.IconPhone;
				phoneIcon.Image = Theme.IconPhoneDark;
				address.IconImage = Theme.Map;	
				address.UserInteractionEnabled = false;

				loaded = true;
			}

			SelectionStyle = history.Type == AssignmentHistoryType.PhoneCall || !enabled ? UITableViewCellSelectionStyle.None : UITableViewCellSelectionStyle.Blue;
			date.Text = history.Date.ToShortDateString ();
			phone.TopLabel.Text = history.ContactName;
			phone.BottomLabel.Text = history.ContactPhone;

			if (history.Type == AssignmentHistoryType.PhoneCall) {
				number.Hidden =
					address.Hidden = true;
				length.Hidden =
					description.Hidden =
					phoneIcon.Hidden = false;

				length.Text = "Length: " + history.CallLength.ToString ();
				description.Text = history.CallDescription;
			} else {
				number.Hidden =
					address.Hidden = false;
				length.Hidden =
					description.Hidden =
					phoneIcon.Hidden = true;

				number.Text = "#" + history.JobNumber;
				address.TopLabel.Text = history.Address;
				address.BottomLabel.Text = string.Format ("{0}, {1} {2}", history.City, history.State, history.Zip);
			}
			title.Text = history.CompanyName;
		}
 public Task<List<Assignment>> GetAssignmentFromHistory (AssignmentHistory assignmentHistory, CancellationToken cancellationToken)
 {
     return Task.Factory.StartNew (() => new List<Assignment> { new Assignment { Id = assignmentHistory.AssignmentId } });
 }
 public Task<List<Assignment>> GetAssignmentFromHistory (AssignmentHistory assignmentHistory, CancellationToken cancellationToken = default(CancellationToken))
 {
     return Database.GetConnection (cancellationToken)
         .QueryAsync<Assignment> (@"
             select Assignment.*, 
                    (SELECT SUM(Labor.Ticks) FROM Labor WHERE Assignment.Id = Labor.AssignmentId) as TotalTicks,       
                    (SELECT COUNT(AssignmentItem.Id) FROM AssignmentItem WHERE Assignment.Id = AssignmentItem.AssignmentId) AS TotalItems,       
                    (SELECT SUM(Expense.Cost) FROM Expense WHERE Assignment.Id = Expense.AssignmentId) AS TotalExpenses
             from Assignment
             where Assignment.Id = ?
         ", assignmentHistory.AssignmentId);
 }