private bool Check() { string projectName = this.textBoxName.Text.Trim(); if (CommonUtil.IsNullOrBlank(projectName)) { CommonUtil.Alert("验证", "请录入项目名称."); return(false); } else { //新建项目 if (this.Project == null) { this.Project = new Proj_Main(); SaveInputToPrjectObject(); return(true); } else { //判断此项目名称是否存在且Id不同 Proj_Main p = ProjectTaskAccess.GetProjectInfoByNameFromDB(projectName); if (p != null && p.Id != this.Project.Id) { CommonUtil.Alert("验证", "已存在的项目名称,请使用其它名称."); return(false); } else { SaveInputToPrjectObject(); return(true); } } } }
private bool DeleteProject(Proj_Main project) { if (CommonUtil.Confirm("确认", "确认删除项目 '" + project.Name + "' 吗?")) { return(ProjectTaskAccess.DeleteProject(project.Id)); } else { return(false); } }
private bool DeleteGroup(Proj_Group group) { if (CommonUtil.Confirm("确认", "确认删除分组 '" + group.Name + "' 吗?")) { return(ProjectTaskAccess.DeleteGroup(group.Id)); } else { return(false); } }
private void ShowAllGroups() { List <Proj_Group> allGroups = ProjectTaskAccess.GetAllGroupsFromDB(); if (allGroups != null) { foreach (Proj_Group group in allGroups) { ShowGroup(group, false); } } }
private void ShowAllProjects() { List <Proj_Main> allProjects = ProjectTaskAccess.GetAllProjectsFromDB(); if (allProjects != null) { foreach (Proj_Main project in allProjects) { TreeNode groupNode = GetGroupNode(project.Group_Id); if (groupNode != null) { ShowProject(groupNode, project, false); RefreshGroupNodeText(groupNode); } } } }
private bool SaveToDB() { if (CommonUtil.IsNullOrBlank(this.Group.Id)) { string id = ProjectTaskAccess.AddNewGroup(this.Group); if (id != null) { this.Group.Id = id; return(true); } else { return(false); } } else { return(ProjectTaskAccess.UpdateGroup(this.Group)); } }
private bool Check() { string groupName = this.textBoxName.Text.Trim(); if (CommonUtil.IsNullOrBlank(groupName)) { CommonUtil.Alert("验证", "请录入组名."); return(false); } else { //新建分组 if (this.Group == null) { this.Group = new Proj_Group(); this.Group.Name = groupName; this.Group.Description = this.textBoxDescription.Text.Trim(); return(true); } else { //判断此组名是否存在且Id不同 Proj_Group g = ProjectTaskAccess.GetGroupInfoByNameFromDB(groupName); if (g != null && g.Id != this.Group.Id) { CommonUtil.Alert("验证", "已存在的组名,请使用其它名称."); return(false); } else { this.Group.Name = groupName; this.Group.Description = this.textBoxDescription.Text.Trim(); return(true); } } } }