public int Update(BaseWorkFlowBillTemplateEntity entity, out string statusCode)
        {
            statusCode = string.Empty;
            int result = this.UpdateObject(entity);

            if (result > 0)
            {
                statusCode = Status.OKUpdate.ToString();
            }
            else
            {
                statusCode = Status.ErrorDeleted.ToString();
            }
            return(result);
        }
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
        public int UpdateEntity(BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, baseWorkFlowBillTemplateEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseWorkFlowBillTemplateEntity.FieldModifiedOn);
            sqlBuilder.SetWhere(BaseWorkFlowBillTemplateEntity.FieldId, baseWorkFlowBillTemplateEntity.Id);
            return(sqlBuilder.EndUpdate());
        }
        public int Update(BaseWorkFlowBillTemplateEntity entity, out string statusCode)
        {
            statusCode = string.Empty;
            int returnValue = this.UpdateEntity(entity);

            if (returnValue > 0)
            {
                statusCode = StatusCode.OKUpdate.ToString();
            }
            else
            {
                statusCode = StatusCode.ErrorDeleted.ToString();
            }
            return(returnValue);
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity)
 {
     SetEntityExpand(sqlBuilder, baseWorkFlowBillTemplateEntity);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldTitle, baseWorkFlowBillTemplateEntity.Title);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldCode, baseWorkFlowBillTemplateEntity.Code);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldCategoryCode, baseWorkFlowBillTemplateEntity.CategoryCode);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldIntroduction, baseWorkFlowBillTemplateEntity.Introduction);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldContents, baseWorkFlowBillTemplateEntity.Contents);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldTemplateType, baseWorkFlowBillTemplateEntity.TemplateType);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldUseWorkFlow, baseWorkFlowBillTemplateEntity.UseWorkFlow);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldAddPage, baseWorkFlowBillTemplateEntity.AddPage);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldEditPage, baseWorkFlowBillTemplateEntity.EditPage);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldShowPage, baseWorkFlowBillTemplateEntity.ShowPage);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldListPage, baseWorkFlowBillTemplateEntity.ListPage);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldAdminPage, baseWorkFlowBillTemplateEntity.AdminPage);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldAuditStatus, baseWorkFlowBillTemplateEntity.AuditStatus);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldDeletionStateCode, baseWorkFlowBillTemplateEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldDescription, baseWorkFlowBillTemplateEntity.Description);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldEnabled, baseWorkFlowBillTemplateEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldSortCode, baseWorkFlowBillTemplateEntity.SortCode);
 }
        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="folderId">文件夹主键</param>
        /// <param name="fileName">文件名</param>
        /// <param name="file">文件</param>
        /// <param name="category">文件分类</param>
        /// <param name="enabled">有效</param>
        /// <param name="statusCode">状态</param>
        /// <returns>主键</returns>
        public string Add(BaseWorkFlowBillTemplateEntity entity, out string statusCode)
        {
            statusCode = string.Empty;
            string result = string.Empty;
            // 检查是否重复
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldTitle, entity.Title));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldDeletionStateCode, 0));

            if (this.Exists(parameters))
            {
                // 名称已重复
                statusCode = Status.ErrorNameExist.ToString();
            }
            else
            {
                result = this.AddObject(entity);
                // 运行成功
                statusCode = Status.OKAdd.ToString();
            }
            return(result);
        }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity)
 {
     return(this.AddEntity(baseWorkFlowBillTemplateEntity));
 }
 // 这个是声明扩展方法
 partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity);
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
        public string AddEntity(BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity)
        {
            string sequence = string.Empty;

            this.Identity = false;
            if (baseWorkFlowBillTemplateEntity.SortCode == null || baseWorkFlowBillTemplateEntity.SortCode == 0)
            {
                BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                baseWorkFlowBillTemplateEntity.SortCode = int.Parse(sequence);
            }
            if (baseWorkFlowBillTemplateEntity.Id != null)
            {
                sequence = baseWorkFlowBillTemplateEntity.Id.ToString();
            }
            SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, BaseWorkFlowBillTemplateEntity.FieldId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(baseWorkFlowBillTemplateEntity.Id))
                {
                    sequence = BaseBusinessLogic.NewGuid();
                    baseWorkFlowBillTemplateEntity.Id = sequence;
                }
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldId, baseWorkFlowBillTemplateEntity.Id);
            }
            else
            {
                if (!this.ReturnId && (DbHelper.CurrentDbType == CurrentDbType.Oracle || DbHelper.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DbHelper.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(BaseWorkFlowBillTemplateEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DbHelper.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(BaseWorkFlowBillTemplateEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DbHelper.CurrentDbType == CurrentDbType.Oracle || DbHelper.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(baseWorkFlowBillTemplateEntity.Id))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            baseWorkFlowBillTemplateEntity.Id = sequence;
                        }
                        sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldId, baseWorkFlowBillTemplateEntity.Id);
                    }
                }
            }
            this.SetEntity(sqlBuilder, baseWorkFlowBillTemplateEntity);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldCreateUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldCreateBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseWorkFlowBillTemplateEntity.FieldCreateOn);
            if (UserInfo != null)
            {
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldModifiedUserId, UserInfo.Id);
                sqlBuilder.SetValue(BaseWorkFlowBillTemplateEntity.FieldModifiedBy, UserInfo.RealName);
            }
            sqlBuilder.SetDBNow(BaseWorkFlowBillTemplateEntity.FieldModifiedOn);
            if (this.Identity && (DbHelper.CurrentDbType == CurrentDbType.SqlServer || DbHelper.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="id">主键</param>
        public BaseWorkFlowBillTemplateEntity GetEntity(string id)
        {
            BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity = new BaseWorkFlowBillTemplateEntity(this.GetDataTable(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldId, id)));

            return(baseWorkFlowBillTemplateEntity);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
 public int Update(BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity)
 {
     return(this.UpdateEntity(baseWorkFlowBillTemplateEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseWorkFlowBillTemplateEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(BaseWorkFlowBillTemplateEntity baseWorkFlowBillTemplateEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(baseWorkFlowBillTemplateEntity));
 }
Exemplo n.º 12
0
        /// <summary>
        /// 获取第一步审核的
        /// </summary>
        /// <param name="categoryCode">单据分类</param>
        /// <param name="workFlowCode">审批流程编号</param>
        /// <returns>审核步骤</returns>
        public BaseWorkFlowActivityEntity GetFirstActivityEntity(string workFlowCode, string categoryCode = null)
        {
            BaseWorkFlowActivityEntity workFlowActivityEntity = null;

            string    workFlowId = string.Empty;
            DataTable dt         = null;
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            // 这里是获取用户的工作流, 按用户主键,按模板编号
            if (string.IsNullOrEmpty(workFlowCode))
            {
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldCategoryCode, categoryCode));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldDeletionStateCode, 0));
                BaseWorkFlowBillTemplateManager templateManager = new BaseWorkFlowBillTemplateManager(this.DbHelper, this.UserInfo);
                dt = templateManager.GetDataTable(parameters);
                BaseWorkFlowBillTemplateEntity templateEntity = BaseEntity.Create <BaseWorkFlowBillTemplateEntity>(dt);
                if (!string.IsNullOrEmpty(templateEntity.Id))
                {
                    workFlowCode = this.UserInfo.Id + "_" + templateEntity.Id;
                }
            }
            if (string.IsNullOrEmpty(workFlowCode))
            {
                return(null);
            }
            // 1. 先检查工作流是否存在?
            BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);

            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldCode, workFlowCode));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0));

            string[] names  = new string[] { BaseWorkFlowProcessEntity.FieldCode, BaseWorkFlowProcessEntity.FieldEnabled, BaseWorkFlowProcessEntity.FieldDeletionStateCode }; // 2010.01.25 LiangMingMing 将 BaseWorkFlowProcessEntity.FieldCode 改 BaseWorkFlowProcessEntity.FieldId
            object[] values = new object[] { workFlowCode, 1, 0 };
            workFlowId = workFlowProcessManager.GetId(parameters);
            if (string.IsNullOrEmpty(workFlowId))
            {
                return(null);
            }
            // 2. 查找第一步是按帐户审核?还是按角色审核?
            BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);

            // 2010.01.25 LiangMingMing 新加了两个参数new string[] { BaseWorkFlowActivityEntity.FieldProcessId }, new string[] { Convert.ToString(workFlowId) },(具体获取哪个流程的步骤)

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

            dt = workFlowActivityManager.GetDataTable(parameters);
            // 3. 取第一个排序的数据
            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            workFlowActivityEntity = BaseEntity.Create <BaseWorkFlowActivityEntity>(dt.Rows[0]);
            if ((workFlowActivityEntity.AuditUserId == null) && (workFlowActivityEntity.AuditRoleId == null))
            {
                return(null);
            }
            return(workFlowActivityEntity);
        }