/// <summary> /// 增加请求单处理日志 /// </summary> /// <param name="cS_DealLog">请求单处理日志对象实体</param> public static bool Add(CS_DealLogEntity entity) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CS_DealLog ("); strSql.Append(" DealID, FormID, BusinessType, DealerGuid, DealerName, DealTime, DealDescription, IsDelete)"); strSql.Append(" values ( "); strSql.Append("@DealID, @FormID, @BusinessType, @DealerGuid, @DealerName, @DealTime, @DealDescription, @IsDelete)"); SqlParameter[] parameters = { new SqlParameter("@DealID", SqlDbType.UniqueIdentifier), new SqlParameter("@FormID", SqlDbType.NVarChar), new SqlParameter("@BusinessType", SqlDbType.NVarChar), new SqlParameter("@DealerGuid", SqlDbType.UniqueIdentifier), new SqlParameter("@DealerName", SqlDbType.NVarChar), new SqlParameter("@DealTime", SqlDbType.DateTime), new SqlParameter("@DealDescription", SqlDbType.NVarChar), new SqlParameter("@IsDelete", SqlDbType.Bit) }; int i = 0; parameters[i++].Value = entity.DealID; parameters[i++].Value = entity.FormID; parameters[i++].Value = entity.BusinessType; parameters[i++].Value = entity.DealerGuid; parameters[i++].Value = entity.DealerName; if (entity.DealTime == DateTime.MinValue) entity.DealTime = (DateTime)SqlDateTime.MinValue; parameters[i++].Value = entity.DealTime; parameters[i++].Value = entity.DealDescription; parameters[i++].Value = entity.IsDelete; return DataHelper.ExcuteNonQuery(strSql.ToString(), parameters) > 0; }
/// <summary> /// 获取实体信息 /// </summary> /// <param name="row">数据行</param> /// <returns></returns> private static CS_DealLogEntity GetEntity(DataRow row) { CS_DealLogEntity entity = new CS_DealLogEntity(); entity.DealID = Guid.Parse(row["DealID"].ToString()); entity.FormID = row["FormID"].ToString(); entity.BusinessType = row["BusinessType"].ToString(); entity.DealerGuid = Guid.Parse(row["DealerGuid"].ToString()); entity.DealerName = row["DealerName"].ToString(); if (row["DealTime"] != DBNull.Value) entity.DealTime = Convert.ToDateTime(row["DealTime"]); entity.DealDescription = row["DealDescription"].ToString(); entity.IsDelete = Convert.ToBoolean(row["IsDelete"]); return entity; }
/// <summary> /// 更新请求单处理日志 /// </summary> /// <param name="cS_DealLog">请求单处理日志</param> /// <returns>bool</returns> public static bool UpdateCS_DealLog(CS_DealLogEntity entity) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CS_DealLog set "); strSql.Append("DealID = @DealID, "); strSql.Append("FormID = @FormID, "); strSql.Append("BusinessType = @BusinessType, "); strSql.Append("DealerGuid = @DealerGuid, "); strSql.Append("DealerName = @DealerName, "); strSql.Append("DealTime = @DealTime, "); strSql.Append("DealDescription = @DealDescription, "); strSql.Append("IsDelete = @IsDelete"); strSql.Append(" where "); strSql.Append(" DealID = @DealID "); SqlParameter[] parameters = { new SqlParameter("@DealID", SqlDbType.UniqueIdentifier), new SqlParameter("@FormID", SqlDbType.NVarChar), new SqlParameter("@BusinessType", SqlDbType.NVarChar), new SqlParameter("@DealerGuid", SqlDbType.UniqueIdentifier), new SqlParameter("@DealerName", SqlDbType.NVarChar), new SqlParameter("@DealTime", SqlDbType.DateTime), new SqlParameter("@DealDescription", SqlDbType.NVarChar), new SqlParameter("@IsDelete", SqlDbType.Bit) }; int i = 0; parameters[i++].Value = entity.DealID; parameters[i++].Value = entity.FormID; parameters[i++].Value = entity.BusinessType; parameters[i++].Value = entity.DealerGuid; parameters[i++].Value = entity.DealerName; if (entity.DealTime == DateTime.MinValue) entity.DealTime = (DateTime)SqlDateTime.MinValue; parameters[i++].Value = entity.DealTime; parameters[i++].Value = entity.DealDescription; parameters[i++].Value = entity.IsDelete; return DataHelper.ExcuteNonQuery(strSql.ToString(), parameters) > 0; }