/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TFCode_Deadline model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TFCode_Deadline set "); strSql.Append("s_Name=@s_Name,"); strSql.Append("s_Type=@s_Type,"); strSql.Append("s_ValueRule=@s_ValueRule,"); strSql.Append("s_Description=@s_Description,"); strSql.Append("s_Classification=@s_Classification,"); strSql.Append("s_AllowEdit=@s_AllowEdit,"); strSql.Append("s_StoredProcedure=@s_StoredProcedure"); strSql.Append(" where g_ID=@g_ID "); SqlParameter[] parameters = { new SqlParameter("@s_Name", SqlDbType.NVarChar, 100), new SqlParameter("@s_Type", SqlDbType.NVarChar, 50), new SqlParameter("@s_ValueRule", SqlDbType.NVarChar, 50), new SqlParameter("@s_Description", SqlDbType.NVarChar, 1000), new SqlParameter("@s_Classification", SqlDbType.NVarChar, 50), new SqlParameter("@s_AllowEdit", SqlDbType.NVarChar, 1), new SqlParameter("@s_StoredProcedure", SqlDbType.NVarChar, 500), new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16) }; parameters[0].Value = model.s_Name; parameters[1].Value = model.s_Type; parameters[2].Value = model.s_ValueRule; parameters[3].Value = model.s_Description; parameters[4].Value = model.s_Classification; parameters[5].Value = model.s_AllowEdit; parameters[6].Value = model.s_StoredProcedure; parameters[7].Value = model.g_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TFCode_Deadline DataRowToModel(DataRow row) { IPSP.Model.TFCode_Deadline model = new IPSP.Model.TFCode_Deadline(); if (row != null) { if (row["g_ID"] != null && row["g_ID"].ToString() != "") { model.g_ID = new Guid(row["g_ID"].ToString()); } if (row["s_Name"] != null) { model.s_Name = row["s_Name"].ToString(); } if (row["s_Type"] != null) { model.s_Type = row["s_Type"].ToString(); } if (row["s_ValueRule"] != null) { model.s_ValueRule = row["s_ValueRule"].ToString(); } if (row["s_Description"] != null) { model.s_Description = row["s_Description"].ToString(); } if (row["s_Classification"] != null) { model.s_Classification = row["s_Classification"].ToString(); } if (row["s_AllowEdit"] != null) { model.s_AllowEdit = row["s_AllowEdit"].ToString(); } if (row["s_StoredProcedure"] != null) { model.s_StoredProcedure = row["s_StoredProcedure"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TFCode_Deadline model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TFCode_Deadline("); strSql.Append("g_ID,s_Name,s_Type,s_ValueRule,s_Description,s_Classification,s_AllowEdit,s_StoredProcedure)"); strSql.Append(" values ("); strSql.Append("@g_ID,@s_Name,@s_Type,@s_ValueRule,@s_Description,@s_Classification,@s_AllowEdit,@s_StoredProcedure)"); SqlParameter[] parameters = { new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@s_Name", SqlDbType.NVarChar, 100), new SqlParameter("@s_Type", SqlDbType.NVarChar, 50), new SqlParameter("@s_ValueRule", SqlDbType.NVarChar, 50), new SqlParameter("@s_Description", SqlDbType.NVarChar, 1000), new SqlParameter("@s_Classification", SqlDbType.NVarChar, 50), new SqlParameter("@s_AllowEdit", SqlDbType.NVarChar, 1), new SqlParameter("@s_StoredProcedure", SqlDbType.NVarChar, 500) }; parameters[0].Value = Guid.NewGuid(); parameters[1].Value = model.s_Name; parameters[2].Value = model.s_Type; parameters[3].Value = model.s_ValueRule; parameters[4].Value = model.s_Description; parameters[5].Value = model.s_Classification; parameters[6].Value = model.s_AllowEdit; parameters[7].Value = model.s_StoredProcedure; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TFCode_Deadline GetModel(Guid g_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 g_ID,s_Name,s_Type,s_ValueRule,s_Description,s_Classification,s_AllowEdit,s_StoredProcedure from TFCode_Deadline "); strSql.Append(" where g_ID=@g_ID "); SqlParameter[] parameters = { new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16) }; parameters[0].Value = g_ID; IPSP.Model.TFCode_Deadline model = new IPSP.Model.TFCode_Deadline(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TFCode_Deadline model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TFCode_Deadline model) { return(dal.Add(model)); }