Beispiel #1
0
 /// <summary>
 /// 添加流程锁
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="userID"></param>
 /// <param name="formID"></param>
 /// <returns></returns>
 public static bool AddLockInfo(WFMessagesEntity entity, Guid userID, Guid formID)
 {
     var result = false;
     try
     {
         var wfLockInfoEntity = new WfFormLockInfoEntity();
         wfLockInfoEntity.Guid = Guid.NewGuid();
         wfLockInfoEntity.CreatePerson = userID;
         wfLockInfoEntity.CreateTime = DateTime.Now;
         wfLockInfoEntity.FormID = formID;
         wfLockInfoEntity.InstanceID = entity.WfInstanceId;
         wfLockInfoEntity.IsDelete = false;
         wfLockInfoEntity.IsLocked = 1;
         wfLockInfoEntity.UpdatePerson = wfLockInfoEntity.CreatePerson;
         wfLockInfoEntity.UpdateTime = wfLockInfoEntity.CreateTime;
         wfLockInfoEntity.WfStateID = entity.CurrentWfStateId;
         wfLockInfoEntity.WfStateName = entity.CurrentWfStateName;
         result = WfFormLockInfoDal.Add(wfLockInfoEntity);
     }
     catch (Exception ex)
     {
         LogWritter.WriteSystemExceptionLog(ex);
     }
     return result;
 }
Beispiel #2
0
        /// <summary>
        /// 增加流程锁基本信息
        /// </summary>
        /// <param name="wfFormLockInfo">流程锁基本信息对象实体</param>
        public static bool Add(WfFormLockInfoEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into WF_FormLockInfo (");
            strSql.Append(" Guid,  FormID,  InstanceID,  IsLocked,  WfStateID,  WfStateName,  CreatePerson,  CreateTime,  UpdatePerson,  UpdateTime,  IsDelete)");
            strSql.Append(" values ( ");
            strSql.Append("@Guid, @FormID, @InstanceID, @IsLocked, @WfStateID, @WfStateName, @CreatePerson, @CreateTime, @UpdatePerson, @UpdateTime, @IsDelete)");

            SqlParameter[] parameters = {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@InstanceID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@IsLocked", SqlDbType.Int),
                new SqlParameter("@WfStateID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateName", SqlDbType.NVarChar),
                new SqlParameter("@CreatePerson", SqlDbType.UniqueIdentifier),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@UpdatePerson", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UpdateTime", SqlDbType.DateTime),
                new SqlParameter("@IsDelete", SqlDbType.Bit)
            };

            int i = 0;
            parameters[i++].Value = entity.Guid;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.InstanceID;
            parameters[i++].Value = entity.IsLocked;
            parameters[i++].Value = entity.WfStateID;
            parameters[i++].Value = entity.WfStateName;
            parameters[i++].Value = entity.CreatePerson;
            if (entity.CreateTime == DateTime.MinValue)
                entity.CreateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.CreateTime;
            parameters[i++].Value = entity.UpdatePerson;
            if (entity.UpdateTime == DateTime.MinValue)
                entity.UpdateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.UpdateTime;
            parameters[i++].Value = entity.IsDelete;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }
Beispiel #3
0
        /// <summary>
        /// 更新流程锁基本信息
        /// </summary>
        /// <param name="wF_FormLockInfo">流程锁基本信息</param>
        /// <returns>bool</returns>
        public static bool Update(WfFormLockInfoEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WF_FormLockInfo set ");
            strSql.Append("Guid = @Guid, ");
            strSql.Append("FormID = @FormID, ");
            strSql.Append("InstanceID = @InstanceID, ");
            strSql.Append("IsLocked = @IsLocked, ");
            strSql.Append("WfStateID = @WfStateID, ");
            strSql.Append("WfStateName = @WfStateName, ");
            strSql.Append("CreatePerson = @CreatePerson, ");
            strSql.Append("CreateTime = @CreateTime, ");
            strSql.Append("UpdatePerson = @UpdatePerson, ");
            strSql.Append("UpdateTime = @UpdateTime, ");
            strSql.Append("IsDelete = @IsDelete");
            strSql.Append(" where ");
            strSql.Append(" Guid = @Guid ");

            SqlParameter[] parameters = {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@InstanceID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@IsLocked", SqlDbType.Int),
                new SqlParameter("@WfStateID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateName", SqlDbType.NVarChar),
                new SqlParameter("@CreatePerson", SqlDbType.UniqueIdentifier),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@UpdatePerson", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UpdateTime", SqlDbType.DateTime),
                new SqlParameter("@IsDelete", SqlDbType.Bit)
            };

            int i = 0;
            parameters[i++].Value = entity.Guid;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.InstanceID;
            parameters[i++].Value = entity.IsLocked;
            parameters[i++].Value = entity.WfStateID;
            parameters[i++].Value = entity.WfStateName;
            parameters[i++].Value = entity.CreatePerson;
            if (entity.CreateTime == DateTime.MinValue)
                entity.CreateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.CreateTime;
            parameters[i++].Value = entity.UpdatePerson;
            if (entity.UpdateTime == DateTime.MinValue)
                entity.UpdateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.UpdateTime;
            parameters[i++].Value = entity.IsDelete;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }
Beispiel #4
0
        /// <summary>
        /// 获取实体信息
        /// </summary>
        /// <param name="row">数据行</param>
        /// <returns></returns>
        public static WfFormLockInfoEntity GetEntity(DataRow row)
        {
            WfFormLockInfoEntity entity = new WfFormLockInfoEntity();

            if (row["Guid"] != DBNull.Value)
                entity.Guid = Guid.Parse(row["Guid"].ToString());
            if (row["FormID"] != DBNull.Value)
                entity.FormID = Guid.Parse(row["FormID"].ToString());
            if (row["InstanceID"] != DBNull.Value)
                entity.InstanceID = Guid.Parse(row["InstanceID"].ToString());
            if (row["IsLocked"] != DBNull.Value)
                entity.IsLocked = Convert.ToInt32(row["IsLocked"]);
            if (row["WfStateID"] != DBNull.Value)
                entity.WfStateID = Guid.Parse(row["WfStateID"].ToString());
            entity.WfStateName = row["WfStateName"].ToString();
            if (row["CreatePerson"] != DBNull.Value)
                entity.CreatePerson = Guid.Parse(row["CreatePerson"].ToString());
            if (row["CreateTime"] != DBNull.Value)
                entity.CreateTime = Convert.ToDateTime(row["CreateTime"]);
            if (row["UpdatePerson"] != DBNull.Value)
                entity.UpdatePerson = Guid.Parse(row["UpdatePerson"].ToString());
            if (row["UpdateTime"] != DBNull.Value)
                entity.UpdateTime = Convert.ToDateTime(row["UpdateTime"]);
            if (row["IsDelete"] != DBNull.Value)
                entity.IsDelete = Convert.ToBoolean(row["IsDelete"]);

            return entity;
        }