public static int Add(HtmlBlock htmlBlock) { return HtmlBlockDataMapper.Add(htmlBlock); }
public static void Update(HtmlBlock htmlBlock) { HtmlBlockDataMapper.Update(htmlBlock); }
internal static HtmlBlock GetHtmlBlock(List<HtmlBlock> htmlBlocks, SqlDataReader reader) { int colIndex = 0; colIndex = reader.GetOrdinal(CN_HTMLBLOCK_ID); int value = reader.GetInt32(colIndex); HtmlBlock htmlBlock = htmlBlocks.Where(c => c.ID == value).FirstOrDefault(); if (htmlBlock == null) { htmlBlock = new HtmlBlock(); htmlBlocks.Add(htmlBlock); } return htmlBlock; }
internal static void FillFromReader(HtmlBlock htmlBlock, SqlDataReader reader) { int colIndex = 0; int days = 0, seconds = 0; colIndex = reader.GetOrdinal(CN_HTMLBLOCK_CREATION_DAY); if (!reader.IsDBNull(colIndex)) days = reader.GetInt32(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_CREATION_SEC); if (!reader.IsDBNull(colIndex)) seconds = reader.GetInt32(colIndex); htmlBlock.CreationDate = CMSCoreHelper.GetDateTime(days, seconds); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_DETAILS); if (!reader.IsDBNull(colIndex)) htmlBlock.Details = reader.GetString(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_ID); if (!reader.IsDBNull(colIndex)) htmlBlock.ID = reader.GetInt32(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_IS_DELETED); if (!reader.IsDBNull(colIndex)) htmlBlock.IsDeleted = reader.GetBoolean(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_LANGUAGE_ID); if (!reader.IsDBNull(colIndex)) htmlBlock.LanguageID = reader.GetInt32(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_NAME); if (!reader.IsDBNull(colIndex)) htmlBlock.Name = reader.GetString(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_PORTAL_ID); if (!reader.IsDBNull(colIndex)) htmlBlock.PortalID = reader.GetInt32(colIndex); colIndex = reader.GetOrdinal(CN_HTMLBLOCK_CREATED_BY); if (!reader.IsDBNull(colIndex)) htmlBlock.CreatedBy = reader.GetInt32(colIndex); }
internal static HtmlBlock GetHtmlBlockById(int HtmlBlockID) { HtmlBlock htmlBlock = null; using (SqlConnection sqlConnection = new SqlConnection(CMSCoreBase.CMSCoreConnectionString)) { SqlCommand sqlCommand = new SqlCommand(SN_HTMLBLOCK_GET_BY_ID, sqlConnection); sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter parameter = new SqlParameter(PN_HTMLBLOCK_ID, System.Data.SqlDbType.Int); parameter.Direction = System.Data.ParameterDirection.Input; parameter.Value = HtmlBlockID; sqlCommand.Parameters.Add(parameter); sqlCommand.Connection.Open(); using (SqlDataReader reader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)) { while (reader.Read()) { if (htmlBlock == null) htmlBlock = new HtmlBlock(); FillFromReader(htmlBlock, reader); } reader.Close(); sqlCommand.Connection.Close(); } } return htmlBlock; }