Example #1
0
        public ActionResult WBSTemplateAddWithAttrDefine()
        {
            string childType = this.Request["Type"];

            ViewBag.NameTitle = EnumBaseHelper.GetEnumDescription(typeof(WBSNodeType), childType);
            if (String.IsNullOrEmpty(childType))
            {
                throw new Formula.Exceptions.BusinessException("未指定需要增加的WBS节点类型,无法增加节点");
            }
            var list = BaseConfigFO.GetWBSEnum(childType);

            ViewBag.DefineAttr = JsonHelper.ToJson(list);
            return(this.View());
        }
Example #2
0
        /// <summary>
        /// 根据新的专业信息同步项目关联的专业以及同步新增专业的OBS结构
        /// </summary>
        /// <param name="addMajorList"></param>
        /// <param name="majorUserList"></param>
        /// <param name="newMajors"></param>
        /// <param name="isSynchOBS"></param>
        public void SynchMajorData(string newMajors)
        {
            if (String.IsNullOrEmpty(newMajors))
            {
                return;
            }
            var majorEnumTable = BaseConfigFO.GetWBSEnum(WBSNodeType.Major);
            //反写项目的专业信息
            var major = newMajors.Split(',').Select(
                c => new
            {
                Name   = majorEnumTable.Select("value='" + c + "'")[0]["text"],
                Value  = c,
                NameEN = majorEnumTable.Select("value='" + c + "'")[0]["NameEN"],
            }
                );

            this.Major = JsonHelper.ToJson(major);
        }
Example #3
0
        public ActionResult WBSAddWithAttrDefine()
        {
            string childType = this.Request["Type"];

            ViewBag.NameTitle = EnumBaseHelper.GetEnumDescription(typeof(WBSNodeType), childType);
            if (String.IsNullOrEmpty(childType))
            {
                throw new Formula.Exceptions.BusinessException("未指定需要增加的WBS节点类型,无法增加节点");
            }

            //项目策划-专业、阶段根据策划及业务类型过滤
            string projectInfoID = this.GetQueryString("ProjectInfoID");
            var    project       = this.entities.Set <S_I_ProjectInfo>().Find(projectInfoID);
            var    prjClass      = string.Empty;

            if (project != null)
            {
                prjClass = project.ProjectClass;
            }
            var list = BaseConfigFO.GetWBSEnum(childType, prjClass);

            ViewBag.DefineAttr = JsonHelper.ToJson(list);
            var allDefineAttr = BaseConfigFO.GetWBSEnum(childType, "");

            ViewBag.AllDefineAttr = JsonHelper.ToJson(allDefineAttr);
            var prjClassDt       = EnumBaseHelper.GetEnumTable("Base.ProjectClass");
            var projectClassRows = prjClassDt.Select("value='" + prjClass + "'");

            if (projectClassRows != null && projectClassRows.Count() > 0)
            {
                ViewBag.ProjectClassName = projectClassRows[0]["text"].ToString();
            }
            else
            {
                ViewBag.ProjectClassName = "";
            }
            ViewBag.WBSType = childType;


            return(this.View());
        }
Example #4
0
        public override ActionResult List()
        {
            ViewBag.ColumnEnums = new Dictionary <string, string>();
            var dt = BaseConfigFO.GetWBSEnum(WBSNodeType.Phase.ToString());

            var tab           = new Tab();
            var stateCategory = CategoryFactory.GetCategory(typeof(ProjectCommoneState), "State");

            stateCategory.SetDefaultItem();
            stateCategory.Multi = false;
            tab.Categories.Add(stateCategory);

            var deptCategory = CategoryFactory.GetCategory("System.ManDept", "部门", "ChargeDeptID");

            deptCategory.SetDefaultItem();
            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
Example #5
0
        public ActionResult WBSAddWithAttrDefine()
        {
            string childType = this.Request["Type"];

            ViewBag.NameTitle = EnumBaseHelper.GetEnumDescription(typeof(WBSNodeType), childType);
            if (String.IsNullOrEmpty(childType))
            {
                throw new Formula.Exceptions.BusinessException("未指定需要增加的WBS节点类型,无法增加节点");
            }

            //项目策划-专业、阶段根据策划及业务类型过滤
            string projectInfoID = this.GetQueryString("ProjectInfoID");
            var    project       = this.entities.Set <S_I_ProjectInfo>().Find(projectInfoID);
            var    prjClass      = string.Empty;

            if (project != null)
            {
                prjClass = project.ProjectClass;
            }
            var list = BaseConfigFO.GetWBSEnum(childType, prjClass);

            ViewBag.DefineAttr = JsonHelper.ToJson(list);
            return(this.View());
        }
Example #6
0
        /// <summary>
        /// 多阶段只立一个项目
        /// </summary>
        /// <returns></returns>
        public S_I_ProjectInfo Push()
        {
            var    context     = this.GetDbContext <ProjectEntities>();
            string projectCode = this.SerialNumber;
            var    projectInfo = new S_I_ProjectInfo
            {
                ID                    = string.IsNullOrEmpty(this.ProjectInfoID) ? FormulaHelper.CreateGuid() : this.ProjectInfoID,
                Name                  = this.ProjectInfo,
                Code                  = projectCode,
                PhaseValue            = this.Phase,
                WorkContent           = this.WorkContent,
                State                 = ProjectCommoneState.Plan.ToString(),
                ChargeUserName        = this.ChargeUserName,
                ChargeUserID          = this.ChargeUser,
                ChargeDeptID          = string.IsNullOrEmpty(this.ChargeDept) ? this.DesignDept : this.ChargeDept,
                ChargeDeptName        = string.IsNullOrEmpty(this.ChargeDeptName) ? this.DesignDeptName: this.ChargeDeptName,
                OtherDeptID           = this.OtherDept,
                OtherDeptName         = this.OtherDeptName,
                PlanStartDate         = this.PlanStartDate,
                PlanFinishDate        = this.PlanFinishDate,
                CustomerID            = this.Customer,
                CustomerName          = this.CustomerName,
                CustomerSub           = this.CustomerSub,
                CustomerSubName       = this.CustomerSubName,
                CompletePercent       = 0,
                ProjectClass          = this.ProjectClass,
                ProjectSpecialty      = this.ProjectSpecialty,
                Country               = this.Country,
                Province              = this.Province,
                Area                  = this.Area,
                CustomerRequireInfoID = this.CustomerRequestReview,
                City                  = this.City,
                CoopUnitID            = this.CoopUnitID,
                CoopUnitIDName        = this.CoopUnitIDName,
                Long                  = this.Long,
                Lat                   = this.Lat,
                Address               = this.Address,
                District              = this.District
            };

            SyncExtention(projectInfo);
            if (!String.IsNullOrEmpty(this.BuildArea))
            {
                decimal d;
                if (Decimal.TryParse(this.BuildArea, out d))
                {
                    projectInfo.Proportion = d;
                }
            }

            var majorEnumTable = BaseConfigFO.GetWBSEnum(WBSNodeType.Major);

            if (!string.IsNullOrEmpty(this.Major))
            {
                var major = this.Major.Split(',').Select(
                    c => new
                {
                    Name  = majorEnumTable.Select("value='" + c + "'")[0]["text"],
                    Value = c,
                }
                    );
                projectInfo.Major = JsonHelper.ToJson(major);
            }
            var phaseName = "";
            var phaseList = BaseConfigFO.GetWBSAttrList(WBSNodeType.Phase);
            var list      = phaseList.Where(d => projectInfo.PhaseValue.Contains(d.Code)).ToList();

            foreach (var item in list)
            {
                phaseName += item.Name + ",";
            }
            projectInfo.PhaseName           = phaseName.TrimEnd(',');
            projectInfo.MarketProjectInfoID = this.MarketProjectID;
            projectInfo.Build();
            projectInfo.ProjectLevel = String.IsNullOrEmpty(this.ProjectLevel) ? 10 : Convert.ToInt32(this.ProjectLevel);
            if (projectInfo.CBSRoot != null)
            {
                projectInfo.CBSRoot.Quantity  = this.Workload ?? 0;
                projectInfo.CBSRoot.UnitPrice = this.WorkloadUnitPrice ?? 1;
                if (projectInfo.CBSRoot.Quantity.HasValue && projectInfo.CBSRoot.UnitPrice.HasValue)
                {
                    projectInfo.CBSRoot.TotalPrice = projectInfo.CBSRoot.Quantity.Value * projectInfo.CBSRoot.UnitPrice.Value;
                }
            }
            context.SaveChanges();
            if (String.IsNullOrEmpty(this.MultiProjMode) || this.MultiProjMode.ToLower() != "1")
            {
                this.ProjectInfoID = projectInfo.ID;
            }
            context.SaveChanges();
            return(projectInfo);
        }
Example #7
0
        public void BuildMajorWBS(S_W_WBS majorParentWBS, List <Dictionary <string, object> > majorList)
        {
            if (majorList == null || majorList.Count <= 0)
            {
                return;
            }
            var majorEnum = BaseConfigFO.GetWBSEnum(WBSNodeType.Major)
                            .AsEnumerable()
                            .Select(c => new DicItem
            {
                Text  = c["text"].ToString(),
                Value = c["value"].ToString()
            }).ToList();
            var majorAttrList = BaseConfigFO.GetWBSAttrList(WBSNodeType.Major.ToString());

            foreach (var major in majorList)
            {
                var     mCode    = major.GetValue("Major").ToString();
                S_W_WBS majorwbs = majorParentWBS.AllChildren.FirstOrDefault(c => c.WBSValue == mCode);
                if (majorwbs == null)
                {
                    #region 新增
                    majorwbs = new S_W_WBS
                    {
                        WBSType  = WBSNodeType.Major.ToString(),
                        Name     = majorEnum.FirstOrDefault(c => c.Value == mCode).Text,
                        WBSValue = mCode
                                   //Code = mCode,
                    };
                    var attrDefine = majorAttrList.FirstOrDefault(d => d.Code == majorwbs.WBSValue);
                    if (attrDefine != null)
                    {
                        majorwbs.SortIndex = attrDefine.SortIndex;
                    }
                    majorParentWBS.AddChild(majorwbs);
                    #endregion
                }
                else
                {
                    majorwbs.Name = majorEnum.FirstOrDefault(c => c.Value == mCode).Text;
                    var attrDefine = majorAttrList.FirstOrDefault(d => d.Code == majorwbs.WBSValue);
                    if (attrDefine != null)
                    {
                        majorwbs.SortIndex = attrDefine.SortIndex;
                    }
                }

                if (!String.IsNullOrEmpty(major.GetValue("MajorPrincipleID")))
                {
                    majorwbs.SetUsers(ProjectRole.MajorPrinciple.ToString(), major.GetValue("MajorPrincipleID").ToString().Split(','));
                }
                if (!String.IsNullOrEmpty(major.GetValue("DesignID")))
                {
                    majorwbs.SetUsers(ProjectRole.Designer.ToString(), major.GetValue("DesignID").Split(','));
                }
                if (!String.IsNullOrEmpty(major.GetValue("CollactorID")))
                {
                    majorwbs.SetUsers(ProjectRole.Collactor.ToString(), major.GetValue("CollactorID").Split(','));
                }
                if (!String.IsNullOrEmpty(major.GetValue("AuditorID")))
                {
                    majorwbs.SetUsers(ProjectRole.Auditor.ToString(), major.GetValue("AuditorID").Split(','));
                }
                if (!String.IsNullOrEmpty(major.GetValue("CheckID")))
                {
                    majorwbs.SetUsers(ProjectRole.Approver.ToString(), major.GetValue("CheckID").Split(','));
                }
            }
        }