public static Bao getFromReader(IDataReader rd) { Bao Item = new Bao(); if (rd.FieldExists("B_ID")) { Item.ID = (Int32)(rd["B_ID"]); } if (rd.FieldExists("B_Ten")) { Item.Ten = (String)(rd["B_Ten"]); } if (rd.FieldExists("B_Url")) { Item.Url = (String)(rd["B_Url"]); } if (rd.FieldExists("B_RssUrl")) { Item.RssUrl = (String)(rd["B_RssUrl"]); } if (rd.FieldExists("B_TotalTin")) { Item.TotalTin = (Int32)(rd["B_TotalTin"]); } return(Item); }
public static Bao Update(Int32?id, String ten, String url, String rssurl, Int32?totaltin) { Bao Item = new Bao(); SqlParameter[] obj = new SqlParameter[5]; if (id != null) { obj[0] = new SqlParameter("B_ID", id); } else { obj[0] = new SqlParameter("B_ID", DBNull.Value); } if (ten != null) { obj[1] = new SqlParameter("B_Ten", ten); } else { obj[1] = new SqlParameter("B_Ten", DBNull.Value); } if (url != null) { obj[2] = new SqlParameter("B_Url", url); } else { obj[2] = new SqlParameter("B_Url", DBNull.Value); } if (rssurl != null) { obj[3] = new SqlParameter("B_RssUrl", rssurl); } else { obj[3] = new SqlParameter("B_RssUrl", DBNull.Value); } if (totaltin != null) { obj[4] = new SqlParameter("B_TotalTin", totaltin); } else { obj[4] = new SqlParameter("B_TotalTin", DBNull.Value); } using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBao_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static Bao SelectById(Int32 B_ID) { Bao Item = new Bao(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("B_ID", B_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBao_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static Bao Insert(Bao Inserted) { Bao Item = new Bao(); SqlParameter[] obj = new SqlParameter[4]; obj[0] = new SqlParameter("B_Ten", Inserted.Ten); obj[1] = new SqlParameter("B_Url", Inserted.Url); obj[2] = new SqlParameter("B_RssUrl", Inserted.RssUrl); obj[3] = new SqlParameter("B_TotalTin", Inserted.TotalTin); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBao_Insert_InsertNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }