public IEnumerable <InfoLibItem> GetTopLevelInfoLibItems(bool IsArchived) { using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetTopLevelInfoLibItems.Description())) { IList <InfoLibItem> items = null; database.AddInParameter(command, "@IsArchived", DbType.Boolean, IsArchived); using (IDataReader reader = database.ExecuteReader(command)) { InfoLibItem item = null; while (reader.Read()) { if (items == null) { items = new List <InfoLibItem>(); } item = new InfoLibItem { InfoLibItemId = reader.GetInt32(0), ItemHeader = new InfoLibItem.InfoLibItemHeader { HeaderText = reader.IsDBNull(1) ? string.Empty : reader.GetString(1), HeaderType = reader.GetInt16(2).ToEnumObject <InfoLibHeaderType>() }, SpecialIdentifier = reader.IsDBNull(3) ? (InfoLibSpecialIdentifiers?)null : reader.GetInt32(3).ToEnumObject <InfoLibSpecialIdentifiers>() }; items.Add(item); } ; } return(items); } }
public InfoLibItem GetInfoLibItem(int InfoLibItemId, bool IncludeInfoLibItemLinkFile) { using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetInfoLibItem.Description())) { InfoLibItem item = null; database.AddInParameter(command, "@InfoLibItemId", DbType.Int32, InfoLibItemId); database.AddInParameter(command, "@IncludeLinkFileAlso", DbType.Boolean, IncludeInfoLibItemLinkFile); using (IDataReader reader = database.ExecuteReader(command)) { if (reader.Read()) { item = new InfoLibItem { InfoLibItemId = reader.GetInt32(0), ParentId = reader.GetInt32(1), ViewerScope = reader.IsDBNull(2) ? (Scope?)null : reader.GetInt16(2).ToEnumObject <Scope>(), ItemHeader = new InfoLibItem.InfoLibItemHeader { HeaderText = reader.IsDBNull(3) ? string.Empty : reader.GetString(3), HeaderType = reader.GetInt16(4).ToEnumObject <InfoLibHeaderType>(), ItemFileMimeType = reader.IsDBNull(5) ? string.Empty : reader.GetString(5), ItemFileExtension = reader.IsDBNull(6) ? string.Empty : reader.GetString(6), ItemFileSizeInBytes = reader.IsDBNull(7) ? (int?)null : reader.GetInt32(7), ItemFile = reader.IsDBNull(8) ? (byte[])null : (byte[])reader[8], ItemFileName = reader.IsDBNull(9) ? string.Empty : reader.GetString(9), }, CreatedBy = reader.GetInt32(18), CreatedDate = reader.GetDateTime(19), LastUpdatedBy = reader.IsDBNull(20) ? (int?)null : reader.GetInt32(20), LastUpdatedDate = reader.IsDBNull(21) ? (DateTime?)null : reader.GetDateTime(21), IsArchived = reader.GetBoolean(22), SpecialIdentifier = reader.IsDBNull(23) ? (InfoLibSpecialIdentifiers?)null : reader.GetInt32(23).ToEnumObject <InfoLibSpecialIdentifiers>() }; if (!reader.IsDBNull(10)) { item.ItemLink = new InfoLibItem.InfoLibItemLink { LinkUrl = reader.IsDBNull(10) ? string.Empty : reader.GetString(10), LinkType = reader.IsDBNull(11) ? (InfoLibLinkType?)null : reader.GetInt16(11).ToEnumObject <InfoLibLinkType>(), ItemFileMimeType = reader.IsDBNull(12) ? string.Empty : reader.GetString(12), ItemFileExtension = reader.IsDBNull(13) ? string.Empty : reader.GetString(13), ItemFileSizeInBytes = reader.IsDBNull(14) ? (int?)null : reader.GetInt32(14), OpenLinkInNewWindow = reader.GetBoolean(15), ItemFile = reader.IsDBNull(16) ? (byte[])null : (byte[])reader[16], ItemFileName = reader.IsDBNull(17) ? string.Empty : reader.GetString(17), }; } ; } return(item); } } }
public bool AddInfoLibItem(InfoLibItem item, out int InfoLibItemId, out string FailureReason) { if (item == null) { throw new ArgumentNullException("item"); } using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.AddInfoLibItem.Description())) { //database.AddInParameter(command, "@ItemType", DbType.Int16, item.ItemType); database.AddInParameter(command, "@ScopeId", DbType.Int32, item.ViewerScope.HasValue ? item.ViewerScope.Value.EnumValue <int>() : (int?)null); database.AddInParameter(command, "@ParentId", DbType.Int32, item.ParentId); database.AddInParameter(command, "@HeaderType", DbType.Int16, item.ItemHeader.HeaderType); database.AddInParameter(command, "@HeaderText", DbType.String, item.ItemHeader.HeaderText); database.AddInParameter(command, "@HeaderGraphics", DbType.Binary, item.ItemHeader.ItemFile); database.AddInParameter(command, "@HeaderGraphicsFileExtension", DbType.StringFixedLength, item.ItemHeader.ItemFileExtension); database.AddInParameter(command, "@HeaderGraphicsMimeType", DbType.StringFixedLength, item.ItemHeader.ItemFileMimeType); database.AddInParameter(command, "@HeaderGraphicsFileSizeInBytes", DbType.Int32, item.ItemHeader.ItemFileSizeInBytes); database.AddInParameter(command, "@HeaderGraphicsFileName", DbType.String, item.ItemHeader.ItemFileName); database.AddInParameter(command, "@LinkType", DbType.Int16, item.ItemLink.LinkType); database.AddInParameter(command, "@LinkUrl", DbType.String, item.ItemLink.LinkUrl); database.AddInParameter(command, "@LinkFile", DbType.Binary, item.ItemLink.ItemFile); database.AddInParameter(command, "@LinkFileExtension", DbType.StringFixedLength, item.ItemLink.ItemFileExtension); database.AddInParameter(command, "@LinkFileMimeType", DbType.StringFixedLength, item.ItemLink.ItemFileMimeType); database.AddInParameter(command, "@LinkFileSizeInBytes", DbType.Int32, item.ItemLink.ItemFileSizeInBytes); database.AddInParameter(command, "@LinkFileName", DbType.String, item.ItemLink.ItemFileName); database.AddInParameter(command, "@OpenLinkInNewWindow", DbType.Boolean, item.ItemLink.OpenLinkInNewWindow); database.AddInParameter(command, "@CreatedBy", DbType.Int32, item.CreatedBy); database.AddInParameter(command, "@SpecialIdentifier", DbType.Int32, item.SpecialIdentifier); database.AddOutParameter(command, "@InfoLibItemID", DbType.Int32, 4); database.AddOutParameter(command, "@FailureReason", DbType.String, 500); int RecAffected = database.ExecuteNonQuery(command); //Initialize output values InfoLibItemId = 0; FailureReason = string.Empty; if (RecAffected > 0) { InfoLibItemId = (int)database.GetParameterValue(command, "@InfoLibItemID"); } else { FailureReason = database.GetParameterValue(command, "@FailureReason") as string; } return(RecAffected > 0); } }
public IEnumerable <InfoLibItem> GetInfoLibItems(Scope?ScopeId, int ParentId) { using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetInfoLibItems.Description())) { IList <InfoLibItem> items = null; database.AddInParameter(command, "@ScopeId", DbType.Int32, ScopeId.HasValue ? ScopeId.Value.EnumValue <int>() : (int?)null); database.AddInParameter(command, "@ParentId", DbType.Int32, ParentId); using (IDataReader reader = database.ExecuteReader(command)) { InfoLibItem item = null; while (reader.Read()) { if (items == null) { items = new List <InfoLibItem>(); } item = new InfoLibItem { InfoLibItemId = reader.GetInt32(0), ParentId = reader.GetInt32(1), ItemHeader = new InfoLibItem.InfoLibItemHeader { HeaderText = reader.IsDBNull(2) ? string.Empty : reader.GetString(2), HeaderType = reader.GetInt16(3).ToEnumObject <InfoLibHeaderType>() }, IsArchived = reader.GetBoolean(7), SpecialIdentifier = reader.IsDBNull(8) ? (InfoLibSpecialIdentifiers?)null : reader.GetInt32(8).ToEnumObject <InfoLibSpecialIdentifiers>(), ViewerScope = reader.IsDBNull(9) ? (Scope?)null : reader.GetInt16(9).ToEnumObject <Scope>() }; if (!reader.IsDBNull(4)) { item.ItemLink = new InfoLibItem.InfoLibItemLink { LinkType = reader.IsDBNull(4) ? null : (InfoLibLinkType?)reader.GetInt16(4).ToEnumObject <InfoLibHeaderType>(), LinkUrl = reader.IsDBNull(5) ? string.Empty : reader.GetString(5), OpenLinkInNewWindow = reader.GetBoolean(6) }; } ; items.Add(item); } ; } return(items); } }
/// <summary> /// Returns new InfoLibItem record Id value /// </summary> /// <param name="item"></param> /// <returns></returns> public static int?AddInfoLibItem(InfoLibItem item, out string FailureReason) { int NewInfoLibItemId; InfoLibDAL dal = new InfoLibDAL(); if (dal.AddInfoLibItem(item, out NewInfoLibItemId, out FailureReason)) { return(NewInfoLibItemId); } else { return(null); } }
private string GetTopLevelParentLink() { if (ParentId != 0) { InfoLibItem item = InfoLibBLL.GetInfoLibTopLevelParent(ParentId.Value, false); if (item != null && ParentItem.ParentId != 0) { //return RouteController.ViewInfoLibItems(item.InfoLibItemId); return(InfoLibUtil.ConstructInfoLibItemNavigationUrl( QueryStringHelper.QueryStringParamNames.INFOLIB_PARENTID_INT.Description(), item.InfoLibItemId.ToString())); } } return(string.Empty); }
public InfoLibItem GetInfoLibTopLevelParent(int InfoLibItemId, bool IsArchived) { using (var command = database.GetStoredProcCommand(StoredProcNames.InfoLib.GetInfoLibTopLevelParent.Description())) { database.AddInParameter(command, "@InfoLibItemId", DbType.Int32, InfoLibItemId); database.AddInParameter(command, "@Archived", DbType.Boolean, IsArchived); InfoLibItem item = null; using (IDataReader reader = database.ExecuteReader(command)) { if (reader.Read()) { item = new InfoLibItem { InfoLibItemId = reader.GetInt32(0), ParentId = reader.GetInt32(1), ItemHeader = new InfoLibItem.InfoLibItemHeader { HeaderText = reader.IsDBNull(2) ? string.Empty : reader.GetString(2), HeaderType = reader.GetInt16(3).ToEnumObject <InfoLibHeaderType>() }, IsArchived = reader.GetBoolean(7), SpecialIdentifier = reader.IsDBNull(8) ? (InfoLibSpecialIdentifiers?)null : reader.GetInt32(8).ToEnumObject <InfoLibSpecialIdentifiers>() }; if (!reader.IsDBNull(4)) { item.ItemLink = new InfoLibItem.InfoLibItemLink { LinkType = reader.IsDBNull(4) ? (InfoLibLinkType?)null : reader.GetInt16(4).ToEnumObject <InfoLibLinkType>(), LinkUrl = reader.IsDBNull(5) ? string.Empty : reader.GetString(5), OpenLinkInNewWindow = reader.GetBoolean(6), }; } } ; } return(item); } }
private void InitializeView() { InfoLibForumCallItem forumCallItem = InfoLibBLL.GetInfoLibForumCallItem(); if (forumCallItem != null) { divforumCallSummaryView.Visible = true; InfoLibItem summaryItem = forumCallItem.SummaryItem; litSummaryViewContent.Text = summaryItem.ItemHeader.HeaderText; if (forumCallItem.DetailedItem != null) { hlMoreLink.Visible = true; NameValueCollection nvColl = new NameValueCollection(); nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_ITEMID_INT.Description(), forumCallItem.DetailedItem.InfoLibItemId.ToString()); nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_PARENTID_INT.Description(), forumCallItem.DetailedItem.ParentId.ToString()); nvColl.Add(QueryStringHelper.QueryStringParamNames.INFOLIB_SPECIAL_IDENTIFIER.Description(), InfoLibSpecialIdentifiers.Forum_call.EnumValue <int>().ToString()); hlMoreLink.NavigateUrl = InfoLibUtil.ConstructInfoLibItemNavigationUrl(nvColl); } } }
private void InitializeData() { IHttpHandler handler = this.Page as IHttpHandler; IRouteDataPage routeDataPage = null; if (handler != null) { routeDataPage = (handler as IRouteDataPage); } if (routeDataPage != null) { if (routeDataPage.RouteData.Values[INFOLIBITEM_PARENT_ID_ROUTE_KEY] + string.Empty != string.Empty) { ParentId = Convert.ToInt32(routeDataPage.RouteData.Values[INFOLIBITEM_PARENT_ID_ROUTE_KEY]); } } if (!ParentId.HasValue || ParentId.Value == 0) { return; } data = InfoLibBLL.GetInfoLibItem(ParentId.Value, RETREIVE_LINKED_FILE_BINARY); }
/// <summary> /// Updates an InfoLibitem /// </summary> /// <param name="item"></param> /// <returns></returns> public static bool UpdateInfoLibItem(InfoLibItem item, out string FailureReason) { InfoLibDAL dal = new InfoLibDAL(); return(dal.UpdateInfoLibItem(item, out FailureReason)); }