public T_WorkItemBase InsertWorkItemBase(SysWorkItem wi, SysProcessInstance pi, SysActivityInstance ai)
        {
            T_WorkItemBase base4;

            try
            {
                int num  = this._context.GetNextIdentity_Int(false);
                int num2 = this._context.GetNextIdentity_Int(false);
                wi.WorkItemId     = num;
                wi.WorkItemBaseId = new int?(num2);
                string         str   = this.GetWorkItemDisplayText(wi, pi, ai);
                string         str2  = this.GetWorkItemCompletePageUrl(wi, pi, ai, true);
                T_WorkItemBase base2 = new T_WorkItemBase {
                    WorkItemBase_Id   = num2,
                    WorkItemBase_Name = str,
                    Title             = str,
                    CompletePageUrl   = str2,
                    CreateTime        = new DateTime?(DateTime.Now),
                    StartTime         = new DateTime?(DateTime.Now),
                    EndTime           = null,
                    IsAllDay          = true,
                    WorkItemId        = num.ToString(),
                    OwnerId           = wi.OwnerId,
                    State             = wi.Status
                };
                this._context.Insert(base2);
                base4 = base2;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(base4);
        }
Exemple #2
0
        public bool ChangeWorkItemState(int id, T_WorkItemBaseStateEnum state, out string errorMsg)
        {
            bool flag;

            errorMsg = string.Empty;
            try
            {
                using (BizDataContext context = new BizDataContext(true))
                {
                    T_WorkItemBase base2 = context.FindById <T_WorkItemBase>(new object[] { id });
                    if ((base2 != null) && (base2.WorkItemBase_Id > 0))
                    {
                        base2.State = new int?((int)state);
                        context.UpdatePartial <T_WorkItemBase>(base2, p => new { State = p.State });
                        return(true);
                    }
                    errorMsg = "未获取到T_WorkItemBase实体";
                    flag     = false;
                }
            }
            catch (Exception exception)
            {
                errorMsg = exception.Message;
                flag     = false;
            }
            return(flag);
        }
Exemple #3
0
 public string OnWorkItemCreating(T_WorkItemBase wiBase, SysWorkItem wi)
 {
     if (this.HasHandler)
     {
         return(this.Handler.OnWorkItemCreating(wiBase, wi));
     }
     return(null);
 }
        public void AddWorkItem(SysWorkItem wi, SysProcessInstance pi, SysActivityInstance ai)
        {
            T_WorkItemBase wiBase = this.InsertWorkItemBase(wi, pi, ai);
            string         str    = new CustomWorkItemHandler(this.Context).OnWorkItemCreating(wiBase, wi);

            wi.WwfBookmarkId = str;
            this.Context.Insert(wi);
            wi.ProcessInstance  = pi;
            wi.ActivityInstance = ai;
            ai.WorkItems.Add(wi);
            wi.ActivityParticipant = ai.Activity.ActivityParticipants.FirstOrDefault <SysActivityParticipant>(i => i.ActivityParticipantId == wi.ActivityParticipantId);
            wi.ApproveGroup        = ai.ApproveGroups.FirstOrDefault <SysWorkItemApproveGroup>(i => i.ApproveGroupId == wi.ApproveGroupId);
            wi.ApproveGroup.WorkItems.Add(wi);
            new ActivityRemindHandler(this, pi, ai, ActivityRemindUseTimeType.WorkItemCreate, wi, null).Execute();
        }
Exemple #5
0
 public virtual string OnWorkItemCreating(T_WorkItemBase wiBase, SysWorkItem wi)
 {
     if (WebConfigAppSettings.UseSSOModel)
     {
         using (BizDataContext context = new BizDataContext(WebConfigAppSettings.HomeBizDBConnString, true))
         {
             wiBase.WorkItemBase_Id = context.GetNextIdentity_Int(false);
             context.Insert(wiBase);
             DbParameter parameter = context.CreateParameter();
             parameter.ParameterName = context.AddPrefixToParameterName("OwnerBiz");
             parameter.Value         = WebConfigAppSettings.ApplicationName;
             string sql = string.Format("update T_WorkItemBase set OwnerBiz = {0}", parameter.ParameterName);
             context.ExecuteNonQuery(sql, new DbParameter[] { parameter });
             return(wiBase.WorkItemBase_Id.ToString());
         }
     }
     return(null);
 }
Exemple #6
0
 public virtual void OnWorkItemCompleted(int wiBaseId, int wiId, string Id)
 {
     if (WebConfigAppSettings.UseSSOModel)
     {
         using (BizDataContext context = new BizDataContext(WebConfigAppSettings.HomeBizDBConnString, true))
         {
             int num;
             if (int.TryParse(Id, out num))
             {
                 T_WorkItemBase base2 = context.FindById <T_WorkItemBase>(new object[] { num });
                 if (base2 != null)
                 {
                     base2.State = 1;
                     context.Update(base2);
                 }
             }
         }
     }
 }