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; }
public void Dispose () { timeEntryDataList.Clear (); timeEntryData = new TimeEntryData (); projectData = new ProjectData (); clientData = new ClientData (); taskData = new TaskData (); }
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, }; }
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 (); }
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; }
private static void ImportJson (IDataStoreContext ctx, ClientData data, ClientJson json) { data.Name = json.Name; data.WorkspaceId = GetLocalId<WorkspaceData> (ctx, json.WorkspaceId); ImportCommonJson (data, json); }
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; }
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); }
public ClientData(ClientData other) : base(other) { Name = other.Name; WorkspaceId = other.WorkspaceId; }
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); }
public ClientData (ClientData other) : base (other) { Name = other.Name; WorkspaceId = other.WorkspaceId; }
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; }
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); }
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); }