private async void SelectLabor()
        {
            var mainViewModel = MainViewModel.GetInstance();

            mainViewModel.LaborSelected = this.LaborId;
            var laborEdit = LaborViewModel.GetInstance();
            var laborList = LaborsViewModel.GetInstance();

            laborEdit.Description    = this.Description;
            laborEdit.StartDate      = this.StartDate ?? DateTime.Today;
            laborEdit.StartDateBak   = this.StartDate ?? DateTime.Today;
            laborEdit.LaborId        = this.LaborId;
            laborEdit.EstimationTime = this.EstimationTime ?? 0;
            laborEdit.WorkedTime     = this.WorkedTime ?? 0;
            var worked     = laborEdit.WorkedTime.ToString(CultureInfo.InvariantCulture).ToString().Split('.');
            var estimation = laborEdit.EstimationTime.ToString(CultureInfo.InvariantCulture).ToString().Split('.');

            laborEdit.WorkedTime     = int.Parse(worked[0]);
            laborEdit.EstimationTime = int.Parse(estimation[0]);
            laborEdit.WorkedMin      = GetMinutes(worked);
            laborEdit.EstimationMin  = GetMinutes(estimation);
            laborEdit.CanEditLabor   = laborList.CanEditTask;
            if (this.State.StateId != Constant.Iniciar)
            {
                laborEdit.CanEditLabor = false;
                await dialogService.ShowMessage("", "Solo puede editar una labor en ejecución.");
            }

            await navigationService.Navigate("LaborPage");
        }
Ejemplo n.º 2
0
        private async void AddLabor()
        {
            var mainViewModel = MainViewModel.GetInstance();

            mainViewModel.LaborSelected = 0;
            var laborEdit = LaborViewModel.GetInstance();

            laborEdit.Description    = null;
            laborEdit.StartDate      = DateTime.Today;
            laborEdit.StartDateBak   = DateTime.Today;
            laborEdit.LaborId        = 0;
            laborEdit.EstimationTime = 0;
            laborEdit.WorkedTime     = 0;
            laborEdit.WorkedMin      = 1;
            laborEdit.EstimationMin  = 1;
            laborEdit.CanEditLabor   = true;
            await navigationService.Navigate("LaborPage");
        }