Beispiel #1
0
        /// <summary>
        /// 根据ProjectID,SpaceID获取立项编号
        /// </summary>
        /// <param name="projectBinder"></param>
        /// <returns></returns>
        public int?GetProjectRequestTask(ProjectBinder projectBinder)
        {
            using (ABZG_DSEntities dbcontext = new ABZG_DSEntities())
            {
                LogHelper.WriteLog("ready to get linked specid");
                int?linkedSpecID = (from b in dbcontext.Bug where b.ProjectID == projectBinder.ProjectID && b.SubProjectID == -(1500000001 + projectBinder.SpaceID) select b).SingleOrDefault <Bug>().LinkedSpecID;

                projectBinder.ProjectRequestID = -linkedSpecID;
                LogHelper.WriteLog("linked specid" + projectBinder.ProjectRequestID);
                return(projectBinder.ProjectRequestID);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根据传入的项目,获取详细的项目信息,封装成项目实体类返回
        /// </summary>
        /// <param name="projectBinder"></param>
        /// <returns></returns>
        public Project GetProjectInfo(ProjectBinder projectBinder)
        {
            Project project = null;

            //根据传入的获取项目信息
            try
            {
                project = new Project(projectBinder);

                //获取项目的基础信息,也要通过app.config记录的匹配信息,获取指定字段的匹配信息
            }
            catch (Exception ex)
            {
                //  LogHelper.WriteLog($"项目初始化发生异常:" + ex.Message);
                LogHelper.Error($"项目初始化发生异常:" + ex.Message, ex);
            }
            return(project);
        }
Beispiel #3
0
        /// <summary>
        /// 根据传入的项目,获取项目的wbs结构,封装成wbs泛型实体类
        /// </summary>
        /// <param name="projectBinder"></param>
        /// <returns></returns>
        public WBSInfo GetWBS(ProjectBinder projectBinder)
        {
            //获取项目下的链接的开发空间中的space下一层目录
            //根据app.config记录的名称和编号的匹配关系,封装成wbs
            WBSInfo wbs = null;

            //根据传入的获取项目信息
            try
            {
                wbs = new WBSInfo(projectBinder);

                //获取项目的基础信息,也要通过app.config记录的匹配信息,获取指定字段的匹配信息
            }
            catch (Exception ex)
            {
                //LogHelper.WriteLog($"wbs初始化发生异常:" + ex.Message);
                LogHelper.Error($"wbs初始化发生异常:" + ex.Message, ex);
            }
            return(wbs);
        }
Beispiel #4
0
 /// <summary>
 /// 根据传入的项目,获取项目的预算信息,封装成预算实体类返回
 /// </summary>
 /// <param name="projectBinder"></param>
 /// <returns></returns>
 public ProjectBudget GetProjectBudget(ProjectBinder projectBinder)
 {
     //解析项目下指定类型任务中指定字段的值,把table格式解析成json
     return(null);
 }
Beispiel #5
0
        //构造函数实现按照指定的项目SpaceID获取具体的项目信息
        public Project(ProjectBinder projectBinder)
        {
            using (ABZG_DSEntities dbcontext = new ABZG_DSEntities())
            {
                //立项任务编号
                //int? BugID = new ProjectHelper().GetProjectRequestTask(projectBinder);
                int?BugID = projectBinder.ProjectRequestID;


                //指定立项任务存储在表CustomerFieldTrackExt中的信息集合
                var customerFieldTrackExt = (from c in dbcontext.CustomerFieldTrackExt where c.ProjectID == projectBinder.ProjectID && c.BugID == BugID select c).SingleOrDefault <CustomerFieldTrackExt>();
                //指定SpaceID所在的表Subproject的单条数据
                var subproject = (from p in dbcontext.SubProject where p.ProjectID == projectBinder.ProjectID && p.SubProjectID == projectBinder.SpaceID select p).SingleOrDefault <SubProject>();

                //项目类型和编码的字典集合
                code4ProjectType = (from code in dbcontext.CustomerFieldListValue where code.ProjectID == projectBinder.ProjectID && code.CustomFieldID == 505 select code).ToDictionary(k => k.ChoiceName.Split(' ')[0], v => v.ChoiceName.Split(' ')[1]);
                //部门类型和编码的字典集合
                code4Depart = (from code in dbcontext.CustomerFieldListValue where code.ProjectID == projectBinder.ProjectID && code.CustomFieldID == 503 select code).ToDictionary(k => k.ChoiceName.Split(' ')[0], v => v.ChoiceName.Split(' ')[1]);

                //用户表集合
                var login = (from l in dbcontext.LogIn select l);

                //获取项目经理对应的personID
                var bugSelection = (from b in dbcontext.BugSelectionInfo select b);
                int loginID      = (from c in bugSelection where c.ProjectID == projectBinder.ProjectID && c.BugID == BugID && c.FieldID == 7 select c.FieldSelectionID).SingleOrDefault();

                //-------------以下是给项目属性赋值---------------------------
                //PPM基础项目编号
                BaseProjectID  = projectBinder.ProjectID;
                ProjectSpaceID = projectBinder.SpaceID;
                //项目编码
                ProjectUniqueID = customerFieldTrackExt.Desc_Custom_1;
                //项目名称
                ProjectName = subproject.Title;
                //项目类型
                ProjectType = customerFieldTrackExt.Desc_Custom_3 is null?"": customerFieldTrackExt.Desc_Custom_3;
                //项目类型对应的编码
                if (code4ProjectType.ContainsKey(ProjectType))
                {
                    ProjectTypeID = code4ProjectType[ProjectType];
                }
                ;

                //项目经理 need improve it..
                ProjectManager = (from c in login where c.PersonID == loginID select c.Login1).SingleOrDefault().ToString();
                //ProjectManager = 00000002;
                //项目代号
                ProjectCodeName = subproject.Title;

                //委托部门名称
                var code4DepartName = customerFieldTrackExt.Custom_4 == null ? "" : customerFieldTrackExt.Custom_4;

                //委托部门
                if (!(code4DepartName == ""))
                {
                    if (code4Depart.ContainsKey(customerFieldTrackExt.Custom_4))
                    {
                        DelegateDepartment = code4Depart[customerFieldTrackExt.Custom_4];
                    }
                    ;
                }
                else
                {
                    DelegateDepartment = "";
                }

                //承担部门
                if (code4Depart.ContainsKey(customerFieldTrackExt.Custom_6))
                {
                    UnderTaskDepartment = code4Depart[customerFieldTrackExt.Custom_6];
                }
                ;
                //项目复杂度等级
                ProjectComplexLevel = customerFieldTrackExt.Custom_10;
                //项目优先级
                ProjectPriority = customerFieldTrackExt.Custom_11;
                //项目状态
                switch (projectBinder.MyFlag)
                {
                case Flag.insert:
                    ProjectStatus = "下达";
                    break;

                case Flag.delay:
                    ProjectStatus = "暂停";
                    break;

                case Flag.close:
                    ProjectStatus = "关闭";
                    break;

                default:
                    ProjectStatus = "";
                    break;
                }
            }
        }
Beispiel #6
0
        public WBSInfo(ProjectBinder projectBinder)
        {
            //wbs编码赋值,初始化wbs编码字典,后续这里通过获取表的值,分析得到
            //code4Wbs = new Dictionary<string, string>()
            //    {
            //        { "TR1/TR2","01"},
            //        { "TR3","02"},
            //        { "TR4A","03"},
            //        { "TR5","04"},
            //        { "TR6","05"},
            //        { "概念与计划阶段","06"},
            //        { "开发阶段","07"},
            //        { "验证阶段","08"},
            //        { "结项阶段","09"},
            //        { "立项准备","10"}
            //    };


            using (ABZG_DSEntities dbcontext = new ABZG_DSEntities())
            {
                //  code4Wbs = (from code in dbcontext.CustomerFieldListValue where code.ProjectID == projectBinder.ProjectID && code.CustomFieldID == 508 select code).ToDictionary(k => k.ChoiceName.Split(' ')[0], v => v.ChoiceName.Split(' ')[1]);
                //立项任务编号
                // int? BugID = new ProjectHelper().GetProjectRequestTask(projectBinder);
                int?BugID = projectBinder.ProjectRequestID;
                //指定立项任务存储在表CustomerFieldTrackExt中的信息集合
                var customerFieldTrackExt = (from c in dbcontext.CustomerFieldTrackExt where c.ProjectID == projectBinder.ProjectID && c.BugID == BugID select c).SingleOrDefault <CustomerFieldTrackExt>();

                var spaceLink = (from link in dbcontext.SpaceLink where link.ProjectID == projectBinder.ProjectID && link.ProjectTypeID == 41 && link.SpaceID == projectBinder.SpaceID select link);

                //项目类型------
                ProjectType = customerFieldTrackExt.Desc_Custom_3 is null ? "" : customerFieldTrackExt.Desc_Custom_3;

                //项目编码
                ProjectUniqueID = customerFieldTrackExt.Desc_Custom_1;

                if (spaceLink.Where(s => s.ToProjectTypeID == 1).Count() > 0)
                {
                    DevProjectID = spaceLink.Where(s => s.ToProjectTypeID == 1).SingleOrDefault().ToProjectID;
                    DevSpaceID   = spaceLink.Where(s => s.ToProjectTypeID == 1).SingleOrDefault().ToSpaceID;
                    //把sql的in查询用linq的嵌套查询来实现
                    //第一步:获取项目下的child folder  id列表
                    var releaseIDList = from f in dbcontext.SubProjectTree where f.ProjectID == DevProjectID && f.ParentID == DevSpaceID select f.ChildID;

                    //第二步:获取所有的sub folders
                    // var allreleaseFolders = from sub in dbcontext.SubProject where sub.ProjectID == DevProjectID && sub.SubProjectType == 99 select sub;
                    var allreleaseFolders = from sub in dbcontext.SubProject where sub.ProjectID == DevProjectID && sub.SubProjectType != 2002
                                            select sub;

                    //第三步:获取对应项目下的满足的folders
                    var releaseFolders = from s in allreleaseFolders where releaseIDList.Contains(s.SubProjectID) select new { s.Title, s.ProjectID, s.SubProjectID };

                    WbsFolders = new List <WBSFolder>();
                    if (releaseFolders.Count() > 0)
                    {
                        foreach (var item in releaseFolders)
                        {
                            WbsFolders.Add(new WBSFolder()
                            {
                                WBSFolderID = item.SubProjectID,
                                WBSName     = item.Title,
                                // WBSUniqueNo = code4Wbs.ContainsKey(item.Title) ? code4Wbs[item.Title] : "NoneMatchCode"
                                WBSUniqueNo = item.SubProjectID.ToString()
                            });
                        }
                    }
                    else
                    {
                    }
                }
                ;
            }
        }