コード例 #1
0
        internal async Task AddTechnician()
        {
            var result = await NewTechnician.Post();

            if (result != default(Technician))
            {
                Technicians.Add(result);
                NewTechnician = new Technician();
            }
        }
コード例 #2
0
        private void OnAddTechnician(UserPromptViewModel result)
        {
            if (result == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(result.FirstInput))
            {
                var technician = new Technician
                {
                    Name                 = result.FirstInput,
                    Number               = result.SecondInput,
                    DateOfLastCheck      = result.DateInput,
                    DateOfLast3YearCheck = result.SecondDateInput,
                    Image                = Signature
                };
                Technicians.Add(technician);
                Repository.Add(technician);
            }
        }
コード例 #3
0
        private void OnEditTechnician(UserPromptViewModel result)
        {
            if (result == null || SelectedTechnician == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(result.FirstInput))
            {
                var selectedTechnician = SelectedTechnician.Clone <Technician>();
                selectedTechnician.Name                 = result.FirstInput;
                selectedTechnician.Number               = result.SecondInput;
                selectedTechnician.DateOfLastCheck      = result.DateInput;
                selectedTechnician.DateOfLast3YearCheck = result.SecondDateInput;
                selectedTechnician.Uploaded             = null;

                var signature = Signature;
                if (signature != null)
                {
                    selectedTechnician.Image = signature;
                }

                var index = Technicians.IndexOf(SelectedTechnician);
                Technicians.Remove(SelectedTechnician);

                if (index > -1)
                {
                    Technicians.Insert(index, selectedTechnician);
                }
                else
                {
                    Technicians.Add(selectedTechnician);
                }
                Repository.AddOrUpdate(selectedTechnician);
                SelectedTechnician = null;
            }
        }