/// <summary> /// 增加常用流程意见表 /// </summary> /// <param name="wFOpinion">常用流程意见表对象实体</param> public static bool Add(WFCommonOpinionEntity entity) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into WF_CommonOpinion ("); strSql.Append(" Guid, OpionContent, UserId, UserName, CreateTime, ModifyTime)"); strSql.Append(" values ( "); strSql.Append("@Guid, @OpionContent, @UserId, @UserName, @CreateTime, @ModifyTime)"); SqlParameter[] parameters = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier), new SqlParameter("@OpionContent", SqlDbType.NVarChar), new SqlParameter("@UserId", SqlDbType.UniqueIdentifier), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@ModifyTime", SqlDbType.DateTime), }; int i = 0; parameters[i++].Value = entity.Guid; parameters[i++].Value = entity.OpionContent; 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; if (entity.ModifyTime == DateTime.MinValue) entity.ModifyTime = (DateTime)SqlDateTime.MinValue; return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0; }
/// <summary> /// 获取实体信息 /// </summary> /// <param name="row">数据行</param> /// <returns></returns> public static WFCommonOpinionEntity GetEntity(DataRow row) { WFCommonOpinionEntity entity = new WFCommonOpinionEntity(); if (row["Guid"] != DBNull.Value) entity.Guid = Guid.Parse(row["Guid"].ToString()); if (row["OpionContent"] != DBNull.Value) entity.OpionContent = row["OpionContent"].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"]); if (row["ModifyTime"] != DBNull.Value) entity.CreateTime = Convert.ToDateTime(row["ModifyTime"]); return entity; }
/// <summary> /// 更新常用流程意见表 /// </summary> /// <param name="wF_Opinion">常用流程意见表</param> /// <returns>bool</returns> public static bool Update(WFCommonOpinionEntity entity) { StringBuilder strSql = new StringBuilder(); strSql.Append("update WF_CommonOpinion set "); strSql.Append("OpionContent = @OpionContent, "); strSql.Append("ModifyTime = @ModifyTime "); strSql.Append(" where "); strSql.Append(" UserId = @UserId "); SqlParameter[] parameters = { new SqlParameter("@OpionContent", SqlDbType.NVarChar), new SqlParameter("@ModifyTime", SqlDbType.DateTime), new SqlParameter("@UserId", SqlDbType.UniqueIdentifier), }; int i = 0; parameters[i++].Value = entity.OpionContent; if (entity.ModifyTime == DateTime.MinValue) entity.ModifyTime = (DateTime)SqlDateTime.MinValue; parameters[i++].Value = entity.ModifyTime; parameters[i++].Value = entity.UserId; return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0; }