예제 #1
0
        public ClientData Import (IDataStoreContext ctx, ClientJson json, Guid? localIdHint = null, ClientData mergeBase = null)
        {
            var data = GetByRemoteId<ClientData> (ctx, json.Id.Value, localIdHint);

            var merger = mergeBase != null ? new ClientMerger (mergeBase) : null;
            if (merger != null && data != null)
                merger.Add (new ClientData (data));

            if (json.DeletedAt.HasValue) {
                if (data != null) {
                    ctx.Delete (data);
                    data = null;
                }
            } else if (merger != null || ShouldOverwrite (data, json)) {
                data = data ?? new ClientData ();
                ImportJson (ctx, data, json);

                if (merger != null) {
                    merger.Add (data);
                    data = merger.Result;
                }

                data = ctx.Put (data);
            }

            return data;
        }
예제 #2
0
 public void Dispose ()
 {
     timeEntryDataList.Clear ();
     timeEntryData = new TimeEntryData ();
     projectData = new ProjectData ();
     clientData = new ClientData ();
     taskData = new TaskData ();
 }
예제 #3
0
        public ClientJson Export (IDataStoreContext ctx, ClientData data)
        {
            var workspaceId = GetRemoteId<WorkspaceData> (ctx, data.WorkspaceId);

            return new ClientJson () {
                Id = data.RemoteId,
                ModifiedAt = data.ModifiedAt.ToUtc (),
                Name = data.Name,
                WorkspaceId = workspaceId,
            };
        }
예제 #4
0
        public TimeEntryHolder (IEnumerable<TimeEntryData> timeEntryGroup)
        {
            if (timeEntryGroup == null || !timeEntryGroup.Any ()) {
                throw new ArgumentException ("Must be specified", "timeEntryGroup");
            }

            timeEntryDataList.AddRange (timeEntryGroup);
            timeEntryData = new TimeEntryData (timeEntryGroup.Last ());
            projectData = new ProjectData ();
            clientData = new ClientData ();
            taskData = new TaskData ();
        }
예제 #5
0
        public ClientData Import (IDataStoreContext ctx, ClientJson json, Guid? localIdHint = null, ClientData mergeBase = null)
        {
            var log = ServiceContainer.Resolve<ILogger> ();

            var data = GetByRemoteId<ClientData> (ctx, json.Id.Value, localIdHint);

            var merger = mergeBase != null ? new ClientMerger (mergeBase) : null;
            if (merger != null && data != null) {
                merger.Add (new ClientData (data));
            }

            if (json.DeletedAt.HasValue) {
                if (data != null) {
                    log.Info (Tag, "Deleting local data for {0}.", data.ToIdString ());
                    ctx.Delete (data);
                    data = null;
                }
            } else if (merger != null || ShouldOverwrite (data, json)) {
                data = data ?? new ClientData ();
                ImportJson (ctx, data, json);

                if (merger != null) {
                    merger.Add (data);
                    data = merger.Result;
                }

                if (merger != null) {
                    log.Info (Tag, "Importing {0}, merging with local data.", data.ToIdString ());
                } else {
                    log.Info (Tag, "Importing {0}, replacing local data.", data.ToIdString ());
                }

                data = ctx.Put (data);
            } else {
                log.Info (Tag, "Skipping import of {0}.", json.ToIdString ());
            }

            return data;
        }
예제 #6
0
 private static void ImportJson (IDataStoreContext ctx, ClientData data, ClientJson json)
 {
     data.Name = json.Name;
     data.WorkspaceId = GetLocalId<WorkspaceData> (ctx, json.WorkspaceId);
     ImportCommonJson (data, json);
 }
예제 #7
0
        public Guid ProjectId {  get { return model.Id; } } // TODO: not good :(

        public void SetClient (ClientData clientData)
        {
            model.Client = new ClientModel (clientData);
            ClientName = clientData.Name;
        }
 private View GetClientView (int position, ClientData clientData, View convertView)
 {
     View view = convertView ?? LayoutInflater.FromContext (Activity).Inflate (Resource.Layout.TagListItem, null);
     var nameCheckedTextView = view.FindViewById<CheckedTextView> (Resource.Id.NameCheckedTextView).SetFont (Font.Roboto);
     nameCheckedTextView.Text = clientData.Name;
     return view;
 }
예제 #9
0
 public static ClientData Import (this ClientJson json, IDataStoreContext ctx,
                                  Guid? localIdHint = null, ClientData mergeBase = null)
 {
     var converter = ServiceContainer.Resolve<ClientJsonConverter> ();
     return converter.Import (ctx, json, localIdHint, mergeBase);
 }
예제 #10
0
 public ClientData(ClientData other) : base(other)
 {
     Name        = other.Name;
     WorkspaceId = other.WorkspaceId;
 }
예제 #11
0
 public void OnClientSelected (ClientData data)
 {
     ViewModel.SetClient (data);
 }
        public void OnClientSelected (ClientData data)
        {
            ViewModel.SetClient (data);

            var btnLabel = "NewProjectNoNameClient".Tr ();
            if (!string.IsNullOrEmpty (data.Name)) {
                btnLabel = data.Name;
            }
            clientButton.Apply (Style.NewProject.WithClient);
            clientButton.SetTitle (btnLabel, UIControlState.Normal);

            NavigationController.PopToViewController (this, true);
        }
예제 #13
0
 public ClientData (ClientData other) : base (other)
 {
     Name = other.Name;
     WorkspaceId = other.WorkspaceId;
 }
예제 #14
0
        private static async Task<ClientData> UpdateClient (ProjectData newProjectData, ClientData oldClientData)
        {
            if (!newProjectData.ClientId.HasValue) {
                return new ClientData ();
            }

            if (oldClientData == null && newProjectData.ClientId.HasValue) {
                return await GetClientDataAsync (newProjectData.ClientId.Value);
            }

            if (newProjectData.ClientId.Value != oldClientData.Id) {
                return await GetClientDataAsync (newProjectData.ClientId.Value);
            }

            return oldClientData;
        }
예제 #15
0
        public async Task UpdateAsync (IEnumerable<TimeEntryData> timeEntryGroup)
        {
            timeEntryData = new TimeEntryData (timeEntryGroup.Last ());
            timeEntryDataList.Clear ();
            timeEntryDataList.AddRange (timeEntryGroup);

            projectData = await UpdateProject (timeEntryData, ProjectData);
            clientData = await UpdateClient (projectData, ClientData);
            taskData = await UpdateTask (timeEntryData, TaskData);
            numberOfTags = await GetNumberOfTagsAsync (timeEntryData.Id);
        }
예제 #16
0
        public async Task LoadAsync ()
        {
            numberOfTags = 0;

            if (timeEntryData.ProjectId.HasValue) {
                projectData = await GetProjectDataAsync (timeEntryData.ProjectId.Value);
                if (projectData.ClientId.HasValue) {
                    clientData = await GetClientDataAsync (projectData.ClientId.Value);
                }
            }

            if (timeEntryData.TaskId.HasValue) {
                taskData = await GetTaskDataAsync (timeEntryData.TaskId.Value);
            }
            numberOfTags = await GetNumberOfTagsAsync (timeEntryData.Id);
        }