Example #1
0
        /// <summary>
        /// 下移
        /// </summary>
        /// <returns>影响行数</returns>
        public int SetDown()
        {
            RowCount = RowIndex;
            int    returnValue = 0;
            string targetId    = "";

            if (dataTableFlag)
            {
                targetId = BaseSortLogic.GetNextId(this.dataView, this.EntityId);
            }
            else
            {
                targetId = BaseSortLogic.GetNextIdDyn(this.lstT, this.EntityId);
            }
            if (targetId.Length > 0)
            {
                if (dataTableFlag)
                {
                    returnValue = BaseSortLogic.Swap(this.dataView.Table, this.EntityId, targetId);
                }
                else
                {
                    returnValue = BaseSortLogic.SwapDyn(this.lstT, this.EntityId, targetId);
                    SetCRow();
                }
            }
            else
            {
                if (BaseSystemInfo.ShowInformation)
                {
                    MessageBox.Show(AppMessage.MSG0022, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return(returnValue);
        }
Example #2
0
        /// <summary>
        /// 置底
        /// </summary>
        /// <returns>影响行数</returns>
        public int SetBottom()
        {
            RowCount = RowIndex;
            int    returnValue = 0;
            string targetId    = "";

            if (dataTableFlag)
            {
                targetId = BaseSortLogic.GetNextId(this.dataView, this.EntityId);
            }
            else
            {
                targetId = BaseSortLogic.GetNextIdDyn(this.lstT, this.EntityId);
            }
            if (targetId.Length > 0)
            {
                DotNetService dotNetService = new DotNetService();
                string        sequence      = dotNetService.SequenceService.GetSequence(UserInfo, dataTableFlag ? this.dataView.Table.TableName : tabelName);
                if (dotNetService.SequenceService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.SequenceService).Close();
                }
                if (dataTableFlag)
                {
                    returnValue = BaseBusinessLogic.SetProperty(this.dataView.Table, this.EntityId, BaseBusinessLogic.FieldSortCode, sequence);
                }
                else
                {
                    returnValue = BaseBusinessLogic.SetPropertyDyn(this.lstT, this.EntityId, BaseBusinessLogic.FieldSortCode, sequence);
                    SetCRow();
                }
            }
            else
            {
                if (BaseSystemInfo.ShowInformation)
                {
                    MessageBox.Show(AppMessage.MSG0022, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return(returnValue);
        }
Example #3
0
        /// <summary>
        /// 获取下一步是谁审核的功能
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审核情况</param>
        /// <returns>下一步审核</returns>
        public BaseWorkFlowStepEntity GetNextWorkFlowStep(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
        {
            BaseWorkFlowStepEntity workFlowStepEntity = null;
            DataTable dt             = null;
            string    nextActivityId = string.Empty;
            // 1. 从工作流审核步骤里选取审核步骤
            BaseWorkFlowStepManager workFlowStepManager = new BaseWorkFlowStepManager(this.DbHelper, this.UserInfo);

            // 若是会签
            bool allPersons = false;

            if (!string.IsNullOrEmpty(workFlowCurrentEntity.ActivityType) && workFlowCurrentEntity.ActivityType.Equals("AllPersons"))
            {
                if (!string.IsNullOrEmpty(workFlowCurrentEntity.ToUserId) && workFlowCurrentEntity.ToUserId.IndexOf(",") >= 0)
                {
                    // 这里是识别是会签
                    allPersons = true;

                    List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldObjectId, workFlowCurrentEntity.ObjectId));
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldProcessId, workFlowCurrentEntity.ProcessId));
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldActivityId, workFlowCurrentEntity.ActivityId));

                    workFlowStepEntity = BaseEntity.Create <BaseWorkFlowStepEntity>(workFlowStepManager.GetDataTable(parameters));
                    // 这里是替换已经审核的人员
                    workFlowCurrentEntity.ToUserId       = workFlowCurrentEntity.ToUserId.Replace(this.UserInfo.Id, "").Trim(',');
                    workFlowStepEntity.AuditUserId       = workFlowCurrentEntity.ToUserId;
                    workFlowStepEntity.AuditUserRealName = new BaseUserManager().GetUsersName(workFlowCurrentEntity.ToUserId);
                }
            }

            // 若不是会签
            if (!allPersons)
            {
                // 工作流主键
                string workFlowId = workFlowCurrentEntity.ProcessId.ToString();

                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldCategoryCode, workFlowCurrentEntity.CategoryCode));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldObjectId, workFlowCurrentEntity.ObjectId));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldProcessId, workFlowId));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldEnabled, 1));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 0));

                dt = workFlowStepManager.GetDataTable(parameters, BaseWorkFlowStepEntity.FieldSortCode);

                if (dt.Rows.Count > 0)
                {
                    dt.Columns.Remove(BaseWorkFlowStepEntity.FieldId);
                    dt.Columns[BaseWorkFlowStepEntity.FieldActivityId].ColumnName = BaseWorkFlowStepEntity.FieldId;
                }
                else
                {
                    // 2. 从工作流审核模板里选取审核步骤 下一步是多少?按工作流进行查找审核步骤
                    BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);

                    parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldProcessId, workFlowId));
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldEnabled, 1));
                    parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldDeletionStateCode, 0));

                    dt = workFlowActivityManager.GetDataTable(parameters, BaseWorkFlowActivityEntity.FieldSortCode);
                }

                // 审核步骤主键
                string activityId = string.Empty;
                if (workFlowCurrentEntity.ActivityId != null)
                {
                    activityId = workFlowCurrentEntity.ActivityId.ToString();
                }
                if (dt.Rows.Count == 0)
                {
                    return(workFlowStepEntity);
                }

                if (!string.IsNullOrEmpty(activityId))
                {
                    nextActivityId = BaseSortLogic.GetNextId(dt, activityId.ToString());
                }
                else
                {
                    nextActivityId = dt.Rows[0][BaseWorkFlowActivityEntity.FieldId].ToString();
                }
            }

            if (!string.IsNullOrEmpty(nextActivityId) && dt != null)
            {
                // workFlowActivityEntity = workFlowActivityManager.GetObject(nextActivityId);
                DataRow dr = BaseBusinessLogic.GetDataRow(dt, nextActivityId);
                workFlowStepEntity            = BaseEntity.Create <BaseWorkFlowStepEntity>(dr);
                workFlowStepEntity.ActivityId = int.Parse(nextActivityId);
            }
            return(workFlowStepEntity);
        }
Example #4
0
        public BaseWorkFlowActivityEntity GetNextWorkFlowActivity(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
        {
            BaseWorkFlowActivityEntity workFlowActivityEntity = null;
            DataTable dataTable = null;

            // 工作流主键
            string workFlowId = workFlowCurrentEntity.WorkFlowId.ToString();

            // 1. 从工作流审核步骤里选取审核步骤
            BaseWorkFlowStepManager workFlowStepManager = new BaseWorkFlowStepManager(this.DbHelper, this.UserInfo);

            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldCategoryCode, workFlowCurrentEntity.CategoryCode));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldObjectId, workFlowCurrentEntity.ObjectId));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldWorkFlowId, workFlowId));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 0));

            dataTable = workFlowStepManager.GetDataTable(parameters, BaseWorkFlowStepEntity.FieldSortCode);

            if (dataTable.Rows.Count > 0)
            {
                dataTable.Columns.Remove(BaseWorkFlowStepEntity.FieldId);
                dataTable.Columns[BaseWorkFlowStepEntity.FieldActivityId].ColumnName = BaseWorkFlowStepEntity.FieldId;
            }
            else
            {
                // 2. 从工作流审核模板里选取审核步骤 下一步是多少?按工作流进行查找审核步骤
                BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);

                parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldWorkFlowId, workFlowId));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldEnabled, 1));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldDeletionStateCode, 0));

                dataTable = workFlowActivityManager.GetDataTable(parameters, BaseWorkFlowActivityEntity.FieldSortCode);
            }

            // 审核步骤主键
            string activityId = string.Empty;

            if (workFlowCurrentEntity.ActivityId != null)
            {
                activityId = workFlowCurrentEntity.ActivityId.ToString();
            }
            if (dataTable.Rows.Count == 0)
            {
                return(workFlowActivityEntity);
            }
            string nextActivityId = string.Empty;

            if (!string.IsNullOrEmpty(activityId))
            {
                nextActivityId = BaseSortLogic.GetNextId(dataTable, activityId.ToString());
            }
            else
            {
                nextActivityId = dataTable.Rows[0][BaseWorkFlowActivityEntity.FieldId].ToString();
            }
            if (!string.IsNullOrEmpty(nextActivityId))
            {
                // workFlowActivityEntity = workFlowActivityManager.GetEntity(nextActivityId);
                DataRow dataRow = BaseBusinessLogic.GetDataRow(dataTable, nextActivityId);
                workFlowActivityEntity = new BaseWorkFlowActivityEntity(dataRow);
            }
            return(workFlowActivityEntity);
        }