public DataTable Authors() { Conexao conexao = new Conexao(); conexao.Conectar(); SelectSP selAuthor = new SelectSP("BOOK_SP_SEL_AUTHORS", conexao.VoltaConexaoAberta()); selAuthor.Executa(); return(selAuthor.sDataTable); }
public List <SelectListItem> ListGenres() { List <SelectListItem> listGenre = new List <SelectListItem>(); SelectSP selGenre = new SelectSP("BOOK_SP_SEL_GENRES"); selGenre.Executa(); foreach (DataRow genre in selGenre.sDataTable.Rows) { listGenre.Add(new SelectListItem { Value = genre.Field <int>("GEN_ID").ToString(), Text = genre.Field <string>("GEN_NAME") }); } return(listGenre); }
public List <SelectListItem> ListAuthors() { List <SelectListItem> listAuthor = new List <SelectListItem>(); SelectSP selAuthor = new SelectSP("BOOK_SP_SEL_AUTHORS"); selAuthor.Executa(); foreach (DataRow author in selAuthor.sDataTable.Rows) { listAuthor.Add(new SelectListItem { Value = author.Field <int>("AUT_ID").ToString(), Text = author.Field <string>("AUT_NAME") }); } return(listAuthor); }
public JArray DetailsBook(int id) { var arr = new JArray(); SelectSP selBook = new SelectSP("BOOK_SP_SEL_DETAILS_BOOK"); selBook.addParam("ID", id); try { selBook.Executa(); if (selBook.sDataTable.Rows.Count == 0) { return(arr); } else { foreach (DataRow dr in selBook.sDataTable.Rows) { arr.Add(new JObject( new JProperty("BkId", dr.Field <int>("BK_ID")), new JProperty("BkName", dr.Field <string>("BK_NAME")), new JProperty("BkIndication", dr.Field <string>("BK_INDICATION")), new JProperty("BkSaga", dr.Field <string>("BK_SAGA")), new JProperty("BkDate", dr.Field <DateTime?>("BK_DATE_CREATE").ToString()), new JProperty("BkFlag", dr.Field <int>("BK_FLAG")), new JProperty("AutName", dr.Field <string>("AUT_NAME")), new JProperty("AutSaga", dr.Field <string>("AUT_MAIN_SAGA")), new JProperty("AutFavBook", dr.Field <string>("AUT_FAVORITE_BOOK")), new JProperty("GenName", dr.Field <string>("GEN_NAME")), new JProperty("GenDes", dr.Field <string>("GEN_DESCRIPTION")), new JProperty("BkrResume", dr.Field <string>("BKR_RESUME")), new JProperty("BkrDateStart", dr.Field <DateTime?>("BKR_DATESTART").ToString()), new JProperty("BkrDateEnd", dr.Field <DateTime?>("BKR_DATEEND").ToString()) )); } return(arr); } } catch (Exception ex) { return(arr); } }
public JArray GetBook() { var arr = new JArray(); //Instaciamento da proc e adição de paramentros SelectSP selBook = new SelectSP("BOOK_SP_SEL_BOOK"); try { selBook.Executa(); if (selBook.sDataTable.Rows.Count == 0) { return(arr); } else { foreach (DataRow dr in selBook.sDataTable.Rows) { arr.Add(new JObject( new JProperty("Id", dr.Field <int>("BK_ID")), new JProperty("BkName", dr.Field <string>("BK_NAME")), new JProperty("AutName", dr.Field <string>("AUT_NAME")), new JProperty("GenName", dr.Field <string>("GEN_NAME")), new JProperty("BkIndication", dr.Field <string>("BK_INDICATION")), new JProperty("BkSaga", dr.Field <string>("BK_SAGA")), new JProperty("BkDate", dr.Field <DateTime>("BK_DATE_CREATE").ToShortDateString()), new JProperty("BkFlag", dr.Field <int>("BK_FLAG")) )); } return(arr); } } catch (Exception ex) { return(arr); } }