private ProjectProfiles ConvertLocalToServer(Projects local) { ProjectProfiles profile = new ProjectProfiles(); profile.Id = local.SId; //profile.Color=Utils.ConvertColorToRGB(local.Color)); // TODO 颜色暂时不考虑 profile.InAll = local.IsShowInAll(); profile.ModifiedTime = local.ModifiedTime; profile.Name = local.Name; profile.SortOrder = local.SortOrder; profile.SortType = local.SortType; profile.Closed = local.IsClosed(); return profile; }
public Projects ConvertServerToLocal(ProjectProfiles profile, Projects project) { project.Status = ModelStatusEnum.SYNC_DONE; project.SId = profile.Id; project.Name = profile.Name; project.Color = profile.Color ?? null; project.SortOrder = profile.SortOrder; project.UserCount = profile.UserCount; project.ShowInAll = profile.InAll; project.Etag = profile.Etag; project.SortType = profile.SortType; project.ModifiedTime = profile.ModifiedTime; if (profile.Closed != null) { project.Closed = profile.Closed ?? false ? ModelStatusEnum.CLOSED_YES : ModelStatusEnum.CLOSED_NO; } else { project.Closed = ModelStatusEnum.CLOSED_NO; } //试着记录日志 return project; }
public async Task UpdateProjects(Projects projects) { await ProjectBll.UpdateAsync(projects); }
/// <summary> /// 新增一条数据 /// </summary> /// <param name="projects"></param> public async Task AddProjects(Projects projects) { if (await ProjectBll.InsertAsync(projects) > 0) { Projects.Add(projects); } }
/// <summary> /// 删除projects,到垃圾箱去 /// </summary> /// <param name="projects"></param> /// <returns></returns> public async Task DeleteProjects(Projects projects) { await ProjectBll.DeleteForeverWithTasks(projects); }
/// <summary> /// 确认修改projects /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void BtnConfirmEditProject_Clicked(object sender, RoutedEventArgs e) { var editProjectName = this.txtEditProjectName.Text; if (string.IsNullOrEmpty(editProjectName)) { await MessageDialogHelper.MessageDialogShowAsync("清单名称不能为空", "提示"); //this.pickerFlyoutEditProject.Hide(); return; } this.txtMainTitle.Text = editProjectName; this.pickerFlyoutEditProject.Hide(); if (IsAddNewProjects) { var project = new Projects { Name = editProjectName }; await ViewModel.AddProjects(project); ViewModel.ProjectsSelected = project; await InitialAsyncAndBindingResource(TasksSortEnum.Custom_Sort); } else { var project = ViewModel.ProjectsSelected; project.Name = editProjectName; await ViewModel.UpdateProjects(project); } }
public Projects ConvertServerToLocal(ProjectProfiles serverProfile, string userId) { Projects project = new Projects(); project.UserId = userId; return ConvertServerToLocal(serverProfile, project); }