Exemplo n.º 1
0
        protected virtual void AddNewContact()
        {
            try
            {
                ContactDto newContact = _controller.GetConfigs <ContactCardView, ContactCardViewModel>()
                                        .View(v => v.Icon = _imageManager.GetImage(ImageType.ContactImage))
                                        .RunDialogWithResult(vm => vm.Contact);

                if (newContact != null)
                {
                    newContact.Organization_Id = SelectedOrganization.Id;

                    var result = _dataProxy.CreateItems(newContact);

                    if (result?.Count > 0)
                    {
                        SelectedOrganization.Contacts.Add(result.First());
                        Contacts.Add(result.First());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void AddNewTask()
        {
            try
            {
                TaskDto newTask = _controller.GetConfigs <TaskCardView, TaskCardViewModel>()
                                  .View(v => v.Icon = _imageManager.GetImage(ImageType.TaskImage))
                                  .RunDialogWithResult(r => r.Task);

                if (newTask != null)
                {
                    newTask.Organization_Id = SelectedOrganization.Id;
                    newTask.Status          = 1;

                    var result = _dataProxy.CreateItems(newTask);

                    if (result?.Count > 0)
                    {
                        newTask = result.First();
                        newTask.Organization = SelectedOrganization;
                        SelectedOrganization.Tasks.Add(newTask);
                        Tasks.Add(newTask);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
        }