Пример #1
0
        /// <summary>
        /// 为单一用户创建活动
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="userName">用户名称</param>
        /// <param name="actType">活动类别(默认是设计活动)</param>
        /// <returns>活动对象</returns>
        public S_W_Activity CreateAcitivityForSingleUser(string userID, string userName, ActivityType actType = ActivityType.DesignTask)
        {
            var activity     = new S_W_Activity();
            var activityName = this.S_W_WBS.S_I_ProjectInfo.Name + "-";

            foreach (var item in this.S_W_WBS.Seniorities)
            {
                if (item.WBSType == WBSNodeType.SubProject.ToString())
                {
                    activityName += item.Name + "-";
                }
            }
            foreach (var item in this.S_W_WBS.Seniorities)
            {
                if (item.WBSType == WBSNodeType.Major.ToString())
                {
                    activityName += item.Name + "-";
                }
            }
            activity.DisplayName   = activityName + "-" + this.Name;
            activity.ActvityName   = EnumBaseHelper.GetEnumDescription(typeof(ActivityType), actType.ToString());
            activity.ActivityKey   = actType.ToString();
            activity.BusniessID    = this.ID;
            activity.OwnerUserID   = userID;
            activity.OwnerUserName = userName;
            activity.State         = ProjectCommoneState.Create.ToString();
            activity.LinkUrl       = CommonConst.designSubmitActivityUrl;
            this.S_W_WBS.AddActivity(activity);
            return(activity);
        }
Пример #2
0
        public S_W_Activity CreateAcitivity(string key, string name, string displayName)
        {
            UserInfo user     = FormulaHelper.GetUserInfo();
            var      activity = new S_W_Activity();

            activity.ActvityName   = name;
            activity.ActivityKey   = key;
            activity.DisplayName   = displayName;
            activity.CreateUser    = user.UserName;
            activity.CreateUserID  = user.UserID;
            activity.CreateDate    = DateTime.Now;
            activity.AuditPatchID  = this.ID;
            activity.BusniessID    = this.ID;
            activity.ID            = FormulaHelper.CreateGuid();
            activity.LinkUrl       = "/Project/AutoUI/AuditView/PageView?TmplCode=ProjectExecutive_Auditor&ID=" + this.ID;
            activity.OwnerUserID   = user.UserID;
            activity.OwnerUserName = user.UserName;
            activity.ProjectInfoID = this.ProjectInfoID;
            activity.State         = ProjectCommoneState.Finish.ToString();
            activity.FinishDate    = DateTime.Now;
            activity.WBSID         = this.WBSID;
            var projectEntities = this.GetDbContext <ProjectEntities>();

            projectEntities.S_W_Activity.Add(activity);
            return(activity);
        }