Exemplo n.º 1
0
        /// <summary>
        /// 增加流程意见表基本信息
        /// </summary>
        /// <param name="wFOpinion">流程意见表基本信息对象实体</param>
        public static bool Add(WFOpinionEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into WF_Opinion (");
            strSql.Append(" Guid,  WfStateId,  WfStateName,  InstanceID,  UserId,  UserName,  CreateTime,  Opinion,  DeptId,  DeptName,  FormID,  Status)");
            strSql.Append(" values ( ");
            strSql.Append("@Guid, @WfStateId, @WfStateName, @InstanceID, @UserId, @UserName, @CreateTime, @Opinion, @DeptId, @DeptName, @FormID, @Status)");

            SqlParameter[] parameters = {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateName", SqlDbType.NVarChar),
                new SqlParameter("@InstanceID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UserId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UserName", SqlDbType.NVarChar),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@Opinion", SqlDbType.NVarChar),
                new SqlParameter("@DeptId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@DeptName", SqlDbType.NVarChar),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@Status", SqlDbType.Int)
            };

            int i = 0;
            parameters[i++].Value = entity.Guid;
            parameters[i++].Value = entity.WfStateId;
            parameters[i++].Value = entity.WfStateName;
            parameters[i++].Value = entity.InstanceID;
            parameters[i++].Value = entity.UserId;
            parameters[i++].Value = entity.UserName;
            if (entity.CreateTime == DateTime.MinValue)
                entity.CreateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.CreateTime;
            parameters[i++].Value = entity.Opinion;
            parameters[i++].Value = entity.DeptId;
            parameters[i++].Value = entity.DeptName;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.Status;

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

            if (row["Guid"] != DBNull.Value)
                entity.Guid = Guid.Parse(row["Guid"].ToString());
            if (row["WfStateId"] != DBNull.Value)
                entity.WfStateId = Guid.Parse(row["WfStateId"].ToString());
            entity.WfStateName = row["WfStateName"].ToString();
            if (row["InstanceID"] != DBNull.Value)
                entity.InstanceID = Guid.Parse(row["InstanceID"].ToString());
            if (row["UserId"] != DBNull.Value)
                entity.UserId = Guid.Parse(row["UserId"].ToString());
            entity.UserName = row["UserName"].ToString();
            if (row["CreateTime"] != DBNull.Value)
                entity.CreateTime = Convert.ToDateTime(row["CreateTime"]);
            entity.Opinion = row["Opinion"].ToString();
            if (row["DeptId"] != DBNull.Value)
                entity.DeptId = Guid.Parse(row["DeptId"].ToString());
            entity.DeptName = row["DeptName"].ToString();
            if (row["FormID"] != DBNull.Value)
                entity.FormID = Guid.Parse(row["FormID"].ToString());
            if (row["Status"] != DBNull.Value)
                entity.Status = Convert.ToInt32(row["Status"]);

            return entity;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新流程意见表基本信息
        /// </summary>
        /// <param name="wF_Opinion">流程意见表基本信息</param>
        /// <returns>bool</returns>
        public static bool Update(WFOpinionEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WF_Opinion set ");
            strSql.Append("Guid = @Guid, ");
            strSql.Append("WfStateId = @WfStateId, ");
            strSql.Append("WfStateName = @WfStateName, ");
            strSql.Append("InstanceID = @InstanceID, ");
            strSql.Append("UserId = @UserId, ");
            strSql.Append("UserName = @UserName, ");
            strSql.Append("CreateTime = @CreateTime, ");
            strSql.Append("Opinion = @Opinion, ");
            strSql.Append("DeptId = @DeptId, ");
            strSql.Append("DeptName = @DeptName, ");
            strSql.Append("FormID = @FormID, ");
            strSql.Append("Status = @Status");
            strSql.Append(" where ");
            strSql.Append(" Guid = @Guid ");

            SqlParameter[] parameters = {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@WfStateName", SqlDbType.NVarChar),
                new SqlParameter("@InstanceID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UserId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@UserName", SqlDbType.NVarChar),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@Opinion", SqlDbType.NVarChar),
                new SqlParameter("@DeptId", SqlDbType.UniqueIdentifier),
                new SqlParameter("@DeptName", SqlDbType.NVarChar),
                new SqlParameter("@FormID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@Status", SqlDbType.Int)
            };

            int i = 0;
            parameters[i++].Value = entity.Guid;
            parameters[i++].Value = entity.WfStateId;
            parameters[i++].Value = entity.WfStateName;
            parameters[i++].Value = entity.InstanceID;
            parameters[i++].Value = entity.UserId;
            parameters[i++].Value = entity.UserName;
            if (entity.CreateTime == DateTime.MinValue)
                entity.CreateTime = (DateTime)SqlDateTime.MinValue;
            parameters[i++].Value = entity.CreateTime;
            parameters[i++].Value = entity.Opinion;
            parameters[i++].Value = entity.DeptId;
            parameters[i++].Value = entity.DeptName;
            parameters[i++].Value = entity.FormID;
            parameters[i++].Value = entity.Status;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }