Esempio n. 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;
 }
Esempio n. 2
0
        /// <summary>
        /// 增加消息表
        /// </summary>
        /// <param name="wFMessages">消息表对象实体</param>
        public static bool Add(WFMessagesEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into WF_Messages (");
            strSql.Append(" ID,  FormID,  FromUserID,  FromUserName,  SendTime,  ReceiveUserId,  ReceiveUserName,  ReceiveTime,  ReceiveDeptId,  ReceiveDeptName,  MessageType,  BusinessType,  Emergency,  CurrentWfStateId,  CurrentWfStateName,  WfInstanceId)");
            strSql.Append(" values ( ");
            strSql.Append("@ID, @FormID, @FromUserID, @FromUserName, @SendTime, @ReceiveUserId, @ReceiveUserName, @ReceiveTime, @ReceiveDeptId, @ReceiveDeptName, @MessageType, @BusinessType, @Emergency, @CurrentWfStateId, @CurrentWfStateName, @WfInstanceId)");

            SqlParameter[] parameters = {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FromUserID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FromUserName", SqlDbType.NVarChar),
                new SqlParameter("@SendTime", SqlDbType.DateTime),
                new SqlParameter("@ReceiveUserId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@ReceiveUserName", SqlDbType.VarChar),
                new SqlParameter("@ReceiveTime", SqlDbType.DateTime),
                new SqlParameter("@ReceiveDeptId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@ReceiveDeptName", SqlDbType.VarChar),
                new SqlParameter("@MessageType", SqlDbType.Int),
                new SqlParameter("@BusinessType", SqlDbType.VarChar),
                new SqlParameter("@Emergency", SqlDbType.Int),
                new SqlParameter("@CurrentWfStateId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@CurrentWfStateName", SqlDbType.VarChar),
                new SqlParameter("@WfInstanceId", SqlDbType.UniqueIdentifier)
            };

            int i = 0;
            parameters[i++].Value = entity.ID;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.FromUserID;
            parameters[i++].Value = entity.FromUserName;
            if (entity.SendTime == DateTime.MinValue)
                entity.SendTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.SendTime;
            parameters[i++].Value = entity.ReceiveUserId;
            parameters[i++].Value = entity.ReceiveUserName;
            if (entity.ReceiveTime == DateTime.MinValue)
                entity.ReceiveTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.ReceiveTime;
            parameters[i++].Value = entity.ReceiveDeptId;
            parameters[i++].Value = entity.ReceiveDeptName;
            parameters[i++].Value = entity.MessageType;
            parameters[i++].Value = entity.BusinessType;
            parameters[i++].Value = entity.Emergency;
            parameters[i++].Value = entity.CurrentWfStateId;
            parameters[i++].Value = entity.CurrentWfStateName;
            parameters[i++].Value = entity.WfInstanceId;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }
Esempio n. 3
0
        /// <summary>
        /// 更新消息表
        /// </summary>
        /// <param name="wF_Message">消息表</param>
        /// <returns>bool</returns>
        public static bool Update(WFMessagesEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WF_Messages set ");
            strSql.Append("ID = @ID, ");
            strSql.Append("FormID = @FormID, ");
            strSql.Append("FromUserID = @FromUserID, ");
            strSql.Append("FromUserName = @FromUserName, ");
            strSql.Append("SendTime = @SendTime, ");
            strSql.Append("ReceiveUserId = @ReceiveUserId, ");
            strSql.Append("ReceiveUserName = @ReceiveUserName, ");
            strSql.Append("ReceiveTime = @ReceiveTime, ");
            strSql.Append("ReceiveDeptId = @ReceiveDeptId, ");
            strSql.Append("ReceiveDeptName = @ReceiveDeptName, ");
            strSql.Append("MessageType = @MessageType, ");
            strSql.Append("BusinessType = @BusinessType, ");
            strSql.Append("Emergency = @Emergency, ");
            strSql.Append("CurrentWfStateId = @CurrentWfStateId, ");
            strSql.Append("CurrentWfStateName = @CurrentWfStateName, ");
            strSql.Append("WfInstanceId = @WfInstanceId");
            strSql.Append(" where ");
            strSql.Append(" ID = @ID ");

            SqlParameter[] parameters = {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FromUserID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@FromUserName", SqlDbType.NVarChar),
                new SqlParameter("@SendTime", SqlDbType.DateTime),
                new SqlParameter("@ReceiveUserId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@ReceiveUserName", SqlDbType.VarChar),
                new SqlParameter("@ReceiveTime", SqlDbType.DateTime),
                new SqlParameter("@ReceiveDeptId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@ReceiveDeptName", SqlDbType.VarChar),
                new SqlParameter("@MessageType", SqlDbType.Int),
                new SqlParameter("@BusinessType", SqlDbType.VarChar),
                new SqlParameter("@Emergency", SqlDbType.Int),
                new SqlParameter("@CurrentWfStateId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@CurrentWfStateName", SqlDbType.VarChar),
                new SqlParameter("@WfInstanceId", SqlDbType.UniqueIdentifier)
            };

            int i = 0;
            parameters[i++].Value = entity.ID;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.FromUserID;
            parameters[i++].Value = entity.FromUserName;
            if (entity.SendTime == DateTime.MinValue)
                entity.SendTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.SendTime;
            parameters[i++].Value = entity.ReceiveUserId;
            parameters[i++].Value = entity.ReceiveUserName;
            if (entity.ReceiveTime == DateTime.MinValue)
                entity.ReceiveTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.ReceiveTime;
            parameters[i++].Value = entity.ReceiveDeptId;
            parameters[i++].Value = entity.ReceiveDeptName;
            parameters[i++].Value = entity.MessageType;
            parameters[i++].Value = entity.BusinessType;
            parameters[i++].Value = entity.Emergency;
            parameters[i++].Value = entity.CurrentWfStateId;
            parameters[i++].Value = entity.CurrentWfStateName;
            parameters[i++].Value = entity.WfInstanceId;

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

            if (row["ID"] != DBNull.Value)
                entity.ID = Guid.Parse(row["ID"].ToString());
            if (row["FormID"] != DBNull.Value)
                entity.FormID = Guid.Parse(row["FormID"].ToString());
            if (row["FromUserID"] != DBNull.Value)
                entity.FromUserID = Guid.Parse(row["FromUserID"].ToString());
            entity.FromUserName = row["FromUserName"].ToString();
            if (row["SendTime"] != DBNull.Value)
                entity.SendTime = Convert.ToDateTime(row["SendTime"]);
            if (row["ReceiveUserId"] != DBNull.Value)
                entity.ReceiveUserId = Guid.Parse(row["ReceiveUserId"].ToString());
            entity.ReceiveUserName = row["ReceiveUserName"].ToString();
            if (row["ReceiveTime"] != DBNull.Value)
                entity.ReceiveTime = Convert.ToDateTime(row["ReceiveTime"]);
            if (row["ReceiveDeptId"] != DBNull.Value)
                entity.ReceiveDeptId = Guid.Parse(row["ReceiveDeptId"].ToString());
            entity.ReceiveDeptName = row["ReceiveDeptName"].ToString();
            if (row["MessageType"] != DBNull.Value)
                entity.MessageType = Convert.ToInt32(row["MessageType"]);
            entity.BusinessType = row["BusinessType"].ToString();
            if (row["Emergency"] != DBNull.Value)
                entity.Emergency = Convert.ToInt32(row["Emergency"]);
            if (row["CurrentWfStateId"] != DBNull.Value)
                entity.CurrentWfStateId = Guid.Parse(row["CurrentWfStateId"].ToString());
            entity.CurrentWfStateName = row["CurrentWfStateName"].ToString();
            if (row["WfInstanceId"] != DBNull.Value)
                entity.WfInstanceId = Guid.Parse(row["WfInstanceId"].ToString());

            return entity;
        }
Esempio n. 5
0
        /// <summary>
        /// 写运行时ACL表,待办表
        /// </summary>
        /// <param name="formId"></param>
        /// <param name="dealPersonInfos"></param>
        /// <param name="currentDealPersonId"></param>
        /// <param name="wfinstanceId"></param>
        /// <param name="businessType"></param>
        /// <param name="currentWfStateId"> </param>
        public static void WriteAcletc(Guid formId, List<DealPersonInfo> dealPersonInfos, Guid currentDealPersonId, Guid wfinstanceId, string businessType, Guid currentWfStateId)
        {
            try
            {
                List<WFMessagesEntity> list = new List<WFMessagesEntity>();

                //发待办
                foreach (var dealPersonInfo in dealPersonInfos)
                {
                    WFMessagesEntity entity = new WFMessagesEntity();
                    entity.BusinessType = businessType;
                    entity.CurrentWfStateId = currentWfStateId;
                    entity.CurrentWfStateName = string.Empty;
                    entity.Emergency = 0;
                    entity.FormID = formId;
                    entity.FromUserID = currentDealPersonId;
                    entity.FromUserName = "";
                    entity.ID = Guid.NewGuid();
                    entity.MessageType = (int)EnumWfMessageType.WaitForDo;
                    entity.ReceiveDeptId = dealPersonInfo.DeptId;
                    entity.ReceiveDeptName = dealPersonInfo.DeptName;
                    entity.ReceiveTime = DateTime.MinValue;
                    entity.ReceiveUserId = dealPersonInfo.PersonId;
                    entity.ReceiveUserName = dealPersonInfo.PersonName;
                    entity.SendTime = DateTime.Now;
                    entity.WfInstanceId = wfinstanceId;

                    list.Add(entity);
                }

                WFMessagesBusiness.BatchAddMessage(list);

            }
            catch (Exception ex)
            {
                LogWritter.WriteSystemExceptionLog(ex);
                throw ex;
            }
        }