public async System.Threading.Tasks.Task ExecuteAddressCommand(DisplayItem displayItem)
        {
            var request = displayItem.Tag as MaintenanceRequest;

            if (!await runTask(async() =>
            {
                request.IsAddressed = true;
                var toSave = Common.Clone <MaintenanceRequest>(request);
                if (toSave.AssignedTo != null)
                {
                    toSave.AssignedToId = toSave.AssignedTo.UserIdValue;
                }
                toSave.AssignedTo = null;
                if (toSave.RequestedBy != null)
                {
                    toSave.RequestedByIdValue = toSave.RequestedBy.UserIdValue;
                }
                toSave.AssignedTo = null;
                await DataService.PutItemAsync <MaintenanceRequest>("maintenanceRequests", toSave.MaintenanceRequestIdValue, toSave);
            },
                               "Are you sure you want to mark this request as addressed?"))
            {
                return;
            }

            if (UnaddressedOnly)
            {
                LoadDataCommand.Execute(null);
            }
            else
            {
                populateDisplayItem(displayItem, request);
                displayItem.Refresh();
            }
        }
示例#2
0
        private async System.Threading.Tasks.Task assign(DisplayItem displayItem)
        {
            var    schedule = displayItem.Tag as DataLayer.Models.Schedule;
            string selected = await UserDialogs.Instance.ActionSheetAsync("Select Employee", "Cancel", "", null, getRealUsers().Select(u => u.DisplayName).ToArray());

            var usr = Users.FirstOrDefault(u => u.DisplayName == selected);

            if (usr == null)
            {
                return;
            }

            schedule.UserIdValue = usr.UserIdValue;
            schedule.User        = usr;
            schedule.Published   = !this.WeekUnpublished;

            var toSave = Common.Clone <Schedule>(schedule);

            toSave.ScheduleTrades = null;
            toSave.Shift          = null;
            toSave.Task           = null;
            toSave.User           = null;

            await runTask(async() => await DataService.PutItemAsync <Schedule>("schedules", toSave.ScheduleIdValue, toSave));

            scheduleToDisplayItem(displayItem, schedule);
            displayItem.Refresh();
        }
        private async System.Threading.Tasks.Task tradeSchedule(DisplayItem displayItem)
        {
            var schedule = displayItem.Tag as DataLayer.Models.Schedule;
            var result   = await runTask(async() => await DataService.PostItemAsync("postTrade", new { scheduleId = schedule.ScheduleId }));

            schedule.ScheduleTrades.Add(new ScheduleTrade());
            scheduleToDisplayItem(displayItem, schedule);
            displayItem.Refresh();
        }
        private void setComplete(DisplayItem userProgressDisplayItem)
        {
            var usr = LoginHelper.GetLoggedInUser();
            var userProgressItem = userProgressDisplayItem.Tag as UserProgressItem;

            userProgressItem.CompletedDate      = DateTime.Now;
            userProgressItem.CompletedBy        = usr.User;
            userProgressItem.CompletedByIdValue = usr.User.UserIdValue;
            //if (IsNotNew)
            //	await saveChecklist(false);
            itemToDisplayItem(userProgressItem, userProgressDisplayItem);
            userProgressDisplayItem.Refresh();
        }
示例#5
0
        private async System.Threading.Tasks.Task unassign(DisplayItem displayItem)
        {
            var schedule = displayItem.Tag as DataLayer.Models.Schedule;

            schedule.User   = null;
            schedule.UserId = null;
            var toSave = Common.Clone <Schedule>(schedule);

            toSave.Shift          = null;
            toSave.Task           = null;
            toSave.ScheduleTrades = null;

            var result = await runTask <Schedule>(async() => await DataService.PutItemAsync <Schedule>("schedules", toSave.ScheduleIdValue, toSave));

            scheduleToDisplayItem(displayItem, schedule);
            displayItem.Refresh();
        }
        async System.Threading.Tasks.Task ExecuteApproveDenyCommand(DisplayItem displayItem, bool approve)
        {
            var leaveRequest = displayItem.Tag as LeaveRequest;

            if (await runTask(async() =>
            {
                var user = LoginHelper.GetLoggedInUser().User;
                leaveRequest.StatusValue = approve ? 1 : 2;
                leaveRequest.ApprovedDeniedDate = DateTime.Now;
                leaveRequest.ApprovedDeniedById = user.UserId;
                leaveRequest.ApprovedDeniedBy = user;
                await DataService.PutItemAsync("leaveRequests", leaveRequest.LeaveRequestIdValue, leaveRequest);
            }, $"Are you sure you want to {(approve ? "approve" : "deny")} this request?"))
            {
                populateDisplayItem(displayItem, leaveRequest);
                displayItem.Refresh();
            }
        }
 public void MaintenanceRequestSaved(MaintenanceRequest request, DisplayItem displayItem)
 {
     if (request.IsAddressedValue && !UnaddressedOnly)
     {
         if (displayItem != null)
         {
             LoadDataCommand.Execute(null);
         }
     }
     else if (displayItem == null)
     {
         LoadDataCommand.Execute(null);
     }
     else
     {
         populateDisplayItem(displayItem, request);
         displayItem.Refresh();
     }
 }