public bool Add(Journal model) { SqlParameter[] parameters = { new SqlParameter("@ISSN", SqlDbType.NVarChar,32), new SqlParameter("@EISSN", SqlDbType.NVarChar,32), new SqlParameter("@Publisher", SqlDbType.NVarChar,1024), new SqlParameter("@Subject", SqlDbType.NVarChar,1024), new SqlParameter("@JournalLanguage", SqlDbType.NVarChar,128), new SqlParameter("@StartYear", SqlDbType.NVarChar,32), new SqlParameter("@PublicationFee", SqlDbType.NVarChar,32), new SqlParameter("@CategoryWebsiteID", SqlDbType.Int,4), new SqlParameter("@JournalName", SqlDbType.NVarChar, 1024) }; parameters[0].Value = model.ISSN; parameters[1].Value = model.EISSN; parameters[2].Value = model.Publisher; parameters[3].Value = model.Subject; parameters[4].Value = model.JournalLanguage; parameters[5].Value = model.StartYear; parameters[6].Value = model.PublicationFee; parameters[7].Value = model.CategoryWebsiteID; parameters[8].Value = model.JournalName; StringBuilder sb = new StringBuilder(); sb.Append(SQL_INSERT_JOURNAL); bool result =new DBHelperSQL().ExecuteNonQuery(sb, parameters, MethodInfo.GetCurrentMethod().Name); return result; }
public IList<CategoryWebsite> GetAllCategoryWebsites() { IList<CategoryWebsite> categoryWebsites = new List<CategoryWebsite>(); try { DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder(); sb.Append(SQL_SELECT_CategoryWebsite); dt =new DBHelperSQL().ExecuteQuery(sb, MethodInfo.GetCurrentMethod().Name); foreach (DataRow dr in dt.Rows) { CategoryWebsite cw = new CategoryWebsite(Convert.ToInt32(dr["CategoryWebsiteID"].ToString()), dr["CategoryLevelOne"].ToString(), dr["CategoryLevelTwo"].ToString(), dr["CategoryLevelThree"].ToString(), dr["Website"].ToString(), Convert.ToInt32(dr["WebsiteCount"].ToString())); categoryWebsites.Add(cw); } return categoryWebsites; } catch (System.Exception ex) { Console.WriteLine(ex.Message); } return null; }