示例#1
0
        private void grdItemDetails_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            // 当前记录是否允许被删除
            BaseItemDetailsEntity ItemDetailsEntity = new BaseItemDetailsEntity();
            DataRow dataRow = BaseBusinessLogic.GetDataRow(this.DTItemDetails, this.EntityId);

            ItemDetailsEntity.GetFrom(dataRow);
            // 判断是否允许删除
            if (ItemDetailsEntity.AllowDelete == 0)
            {
                MessageBox.Show(AppMessage.MSG0017, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Question);
                e.Cancel = true;
            }
            else
            {
                if (MessageBox.Show(AppMessage.MSG0015, AppMessage.MSG0000, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
                else
                {
                    // 删除数据
                    DotNetService.Instance.ItemDetailsService.Delete(UserInfo, this.TargetTable, this.EntityId);
                }
            }
        }
        private void grdWorkFlow_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            // 判断是否有删除权限
            if (!this.PermissionDelete)
            {
                e.Cancel = true;
                return;
            }
            // 当前记录是否允许被删除
            BaseWorkFlowProcessEntity workFlowProcessEntity = new BaseWorkFlowProcessEntity();
            DataRow dataRow = BaseBusinessLogic.GetDataRow(this.DTWorkFlow, this.EntityId);

            workFlowProcessEntity.GetFrom(dataRow);
            if (this.DTWorkFlow.Rows.Count < 0)
            {
                MessageBox.Show(AppMessage.MSG0017, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Question);
                e.Cancel = true;
            }
            else
            {
                if (MessageBox.Show(AppMessage.MSG0015, AppMessage.MSG0000, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }
        }
示例#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);
        }
示例#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);
        }