public static Articles SelectById(Int32 ID) { Articles Item = new Articles(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("ID", ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_Articles_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static Articles Update(Articles Updated) { Articles Item = new Articles(); SqlParameter[] obj = new SqlParameter[22]; obj[0] = new SqlParameter("ID", Updated.ID); obj[1] = new SqlParameter("PortalID", Updated.PortalID); obj[2] = new SqlParameter("Subject", Updated.Subject); obj[3] = new SqlParameter("Title", Updated.Title); obj[4] = new SqlParameter("Summary", Updated.Summary); obj[5] = new SqlParameter("Content", Updated.Content); obj[6] = new SqlParameter("SourceID", Updated.SourceID); obj[7] = new SqlParameter("PhotoID", Updated.PhotoID); obj[8] = new SqlParameter("PhotoPath", Updated.PhotoPath); obj[9] = new SqlParameter("VideoPath", Updated.VideoPath); obj[10] = new SqlParameter("Checked", Updated.Checked); obj[11] = new SqlParameter("Counter", Updated.Counter); obj[12] = new SqlParameter("CreatedTime", Updated.CreatedTime); obj[13] = new SqlParameter("DisplayTime", Updated.DisplayTime); obj[14] = new SqlParameter("UpdatedTime", Updated.UpdatedTime); obj[15] = new SqlParameter("ReviewedTime", Updated.ReviewedTime); obj[16] = new SqlParameter("CreatedBy", Updated.CreatedBy); obj[17] = new SqlParameter("UpdatedBy", Updated.UpdatedBy); obj[18] = new SqlParameter("ReviewedBy", Updated.ReviewedBy); obj[19] = new SqlParameter("DesktopViewID", Updated.DesktopViewID); obj[20] = new SqlParameter("Language", Updated.Language); obj[21] = new SqlParameter("FileAttath", Updated.FileAttath); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_Articles_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static Articles getFromReader(IDataReader rd) { Articles Item = new Articles(); if (rd.FieldExists("ID")) { Item.ID = (Int32)(rd["ID"]); } if (rd.FieldExists("PortalID")) { Item.PortalID = (Int32)(rd["PortalID"]); } if (rd.FieldExists("Subject")) { Item.Subject = (String)(rd["Subject"]); } if (rd.FieldExists("Title")) { Item.Title = (String)(rd["Title"]); } if (rd.FieldExists("Summary")) { Item.Summary = (String)(rd["Summary"]); } if (rd.FieldExists("Content")) { Item.Content = (String)(rd["Content"]); } if (rd.FieldExists("SourceID")) { Item.SourceID = (Int32)(rd["SourceID"]); } if (rd.FieldExists("PhotoID")) { Item.PhotoID = (Int32)(rd["PhotoID"]); } if (rd.FieldExists("PhotoPath")) { Item.PhotoPath = (String)(rd["PhotoPath"]); } if (rd.FieldExists("VideoPath")) { Item.VideoPath = (String)(rd["VideoPath"]); } if (rd.FieldExists("Checked")) { Item.Checked = (Boolean)(rd["Checked"]); } if (rd.FieldExists("Counter")) { Item.Counter = (Int32)(rd["Counter"]); } if (rd.FieldExists("CreatedTime")) { Item.CreatedTime = (DateTime)(rd["CreatedTime"]); } if (rd.FieldExists("DisplayTime")) { Item.DisplayTime = (DateTime)(rd["DisplayTime"]); } if (rd.FieldExists("UpdatedTime")) { Item.UpdatedTime = (DateTime)(rd["UpdatedTime"]); } if (rd.FieldExists("ReviewedTime")) { Item.ReviewedTime = (DateTime)(rd["ReviewedTime"]); } if (rd.FieldExists("CreatedBy")) { Item.CreatedBy = (String)(rd["CreatedBy"]); } if (rd.FieldExists("UpdatedBy")) { Item.UpdatedBy = (String)(rd["UpdatedBy"]); } if (rd.FieldExists("ReviewedBy")) { Item.ReviewedBy = (String)(rd["ReviewedBy"]); } if (rd.FieldExists("DesktopViewID")) { Item.DesktopViewID = (Int32)(rd["DesktopViewID"]); } if (rd.FieldExists("Language")) { Item.Language = (String)(rd["Language"]); } if (rd.FieldExists("FileAttath")) { Item.FileAttath = (String)(rd["FileAttath"]); } return(Item); }