public static BinhLuan Update(BinhLuan Updated) { BinhLuan Item = new BinhLuan(); SqlParameter[] obj = new SqlParameter[8]; obj[0] = new SqlParameter("BL_ID", Updated.ID); obj[1] = new SqlParameter("BL_T_ID", Updated.T_ID); obj[2] = new SqlParameter("BL_Ten", Updated.Ten); obj[3] = new SqlParameter("BL_Email", Updated.Email); obj[4] = new SqlParameter("BL_NoiDung", Updated.NoiDung); if (Updated.NgayTao > DateTime.MinValue) { obj[5] = new SqlParameter("BL_NgayTao", Updated.NgayTao); } else { obj[5] = new SqlParameter("BL_NgayTao", DBNull.Value); } obj[6] = new SqlParameter("BL_RowId", Updated.RowId); obj[7] = new SqlParameter("BL_Active", Updated.Active); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBinhLuan_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } var c = HttpRuntime.Cache; c.Remove(CacheKeyAll); return(Item); }
public static BinhLuan SelectById(Int32 BL_ID) { BinhLuan Item = new BinhLuan(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("BL_ID", BL_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBinhLuan_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static BinhLuan getFromReader(IDataReader rd) { BinhLuan Item = new BinhLuan(); if (rd.FieldExists("BL_ID")) { Item.ID = (Int32)(rd["BL_ID"]); } if (rd.FieldExists("BL_T_ID")) { Item.T_ID = (Int32)(rd["BL_T_ID"]); } if (rd.FieldExists("BL_Ten")) { Item.Ten = (String)(rd["BL_Ten"]); } if (rd.FieldExists("BL_Email")) { Item.Email = (String)(rd["BL_Email"]); } if (rd.FieldExists("BL_NoiDung")) { Item.NoiDung = (String)(rd["BL_NoiDung"]); } if (rd.FieldExists("BL_NgayTao")) { Item.NgayTao = (DateTime)(rd["BL_NgayTao"]); } if (rd.FieldExists("BL_RowId")) { Item.RowId = (Guid)(rd["BL_RowId"]); } if (rd.FieldExists("BL_Active")) { Item.Active = (Boolean)(rd["BL_Active"]); } return(Item); }
public static BinhLuan Update(Int32?id, Int32?t_id, String ten, String email, String noidung, DateTime?ngaytao, Guid?rowid, Boolean?active) { BinhLuan Item = new BinhLuan(); SqlParameter[] obj = new SqlParameter[8]; if (id != null) { obj[0] = new SqlParameter("BL_ID", id); } else { obj[0] = new SqlParameter("BL_ID", DBNull.Value); } if (t_id != null) { obj[1] = new SqlParameter("BL_T_ID", t_id); } else { obj[1] = new SqlParameter("BL_T_ID", DBNull.Value); } if (ten != null) { obj[2] = new SqlParameter("BL_Ten", ten); } else { obj[2] = new SqlParameter("BL_Ten", DBNull.Value); } if (email != null) { obj[3] = new SqlParameter("BL_Email", email); } else { obj[3] = new SqlParameter("BL_Email", DBNull.Value); } if (noidung != null) { obj[4] = new SqlParameter("BL_NoiDung", noidung); } else { obj[4] = new SqlParameter("BL_NoiDung", DBNull.Value); } if (ngaytao != null) { obj[5] = new SqlParameter("BL_NgayTao", ngaytao); } else { obj[5] = new SqlParameter("BL_NgayTao", DBNull.Value); } if (rowid != null) { obj[6] = new SqlParameter("BL_RowId", rowid); } else { obj[6] = new SqlParameter("BL_RowId", DBNull.Value); } if (active != null) { obj[7] = new SqlParameter("BL_Active", active); } else { obj[7] = new SqlParameter("BL_Active", DBNull.Value); } using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssBinhLuan_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } var c = HttpRuntime.Cache; c.Remove(CacheKeyAll); return(Item); }