public static string GetText(ETaxisType type) { if (type == ETaxisType.OrderById) { return("内容ID(升序)"); } if (type == ETaxisType.OrderByIdDesc) { return("内容ID(降序)"); } if (type == ETaxisType.OrderByChannelId) { return("栏目ID(升序)"); } if (type == ETaxisType.OrderByChannelIdDesc) { return("栏目ID(降序)"); } if (type == ETaxisType.OrderByAddDate) { return("添加时间(升序)"); } if (type == ETaxisType.OrderByAddDateDesc) { return("添加时间(降序)"); } if (type == ETaxisType.OrderByLastEditDate) { return("更新时间(升序)"); } if (type == ETaxisType.OrderByLastEditDateDesc) { return("更新时间(降序)"); } if (type == ETaxisType.OrderByTaxis) { return("自定义排序(升序)"); } if (type == ETaxisType.OrderByTaxisDesc) { return("自定义排序(降序)"); } if (type == ETaxisType.OrderByHits) { return("点击量排序"); } if (type == ETaxisType.OrderByHitsByDay) { return("日点击量排序"); } if (type == ETaxisType.OrderByHitsByWeek) { return("周点击量排序"); } if (type == ETaxisType.OrderByHitsByMonth) { return("月点击量排序"); } throw new Exception(); }
public static string GetContentOrderByString(int siteId, string orderValue, ETaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDate.ToLower())) { taxisType = ETaxisType.OrderByLastEditDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDateBack.ToLower())) { taxisType = ETaxisType.OrderByLastEditDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByDay.ToLower())) { taxisType = ETaxisType.OrderByHitsByDay; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByWeek.ToLower())) { taxisType = ETaxisType.OrderByHitsByWeek; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByMonth.ToLower())) { taxisType = ETaxisType.OrderByHitsByMonth; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } return(ETaxisTypeUtils.GetContentOrderByString(taxisType, orderByString)); }
public static ListItem GetListItem(ETaxisType type, bool selected) { var item = new ListItem(GetText(type), GetValue(type)); if (selected) { item.Selected = true; } return(item); }
public static bool Equals(ETaxisType type, string typeStr) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower())) { return(true); } return(false); }
public static string GetContentOrderAttributeName(ETaxisType taxisType) { var retVal = nameof(IContentInfo.Taxis); switch (taxisType) { case ETaxisType.OrderById: case ETaxisType.OrderByIdDesc: retVal = nameof(IContentInfo.Id); break; case ETaxisType.OrderByChannelId: case ETaxisType.OrderByChannelIdDesc: retVal = nameof(IContentInfo.ChannelId); break; case ETaxisType.OrderByAddDate: case ETaxisType.OrderByAddDateDesc: retVal = nameof(IContentInfo.AddDate); break; case ETaxisType.OrderByLastEditDate: case ETaxisType.OrderByLastEditDateDesc: retVal = nameof(IContentInfo.LastEditDate); break; case ETaxisType.OrderByHits: retVal = nameof(IContentInfo.Hits); break; case ETaxisType.OrderByHitsByDay: retVal = nameof(IContentInfo.HitsByDay); break; case ETaxisType.OrderByHitsByWeek: retVal = nameof(IContentInfo.HitsByWeek); break; case ETaxisType.OrderByHitsByMonth: retVal = nameof(IContentInfo.HitsByMonth); break; } return(retVal); }
public static string GetChannelOrderByString(int siteId, string orderValue, ETaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } return ETaxisTypeUtils.GetChannelOrderByString(taxisType, orderByString, null); }
public static string GetValue(ETaxisType type) { if (type == ETaxisType.OrderById) { return(nameof(ETaxisType.OrderById)); } if (type == ETaxisType.OrderByIdDesc) { return(nameof(ETaxisType.OrderByIdDesc)); } if (type == ETaxisType.OrderByChannelId) { return(nameof(ETaxisType.OrderByChannelId)); } if (type == ETaxisType.OrderByChannelIdDesc) { return(nameof(ETaxisType.OrderByChannelIdDesc)); } if (type == ETaxisType.OrderByAddDate) { return(nameof(ETaxisType.OrderByAddDate)); } if (type == ETaxisType.OrderByAddDateDesc) { return(nameof(ETaxisType.OrderByAddDateDesc)); } if (type == ETaxisType.OrderByLastEditDate) { return(nameof(ETaxisType.OrderByLastEditDate)); } if (type == ETaxisType.OrderByLastEditDateDesc) { return(nameof(ETaxisType.OrderByLastEditDateDesc)); } if (type == ETaxisType.OrderByTaxis) { return(nameof(ETaxisType.OrderByTaxis)); } if (type == ETaxisType.OrderByTaxisDesc) { return(nameof(ETaxisType.OrderByTaxisDesc)); } if (type == ETaxisType.OrderByHits) { return(nameof(ETaxisType.OrderByHits)); } if (type == ETaxisType.OrderByHitsByDay) { return(nameof(ETaxisType.OrderByHitsByDay)); } if (type == ETaxisType.OrderByHitsByWeek) { return(nameof(ETaxisType.OrderByHitsByWeek)); } if (type == ETaxisType.OrderByHitsByMonth) { return(nameof(ETaxisType.OrderByHitsByMonth)); } if (type == ETaxisType.OrderByRandom) { return(nameof(ETaxisType.OrderByRandom)); } throw new Exception(); }
public static string GetContentOrderByString(ETaxisType taxisType, string orderByString) { if (!string.IsNullOrEmpty(orderByString)) { if (orderByString.Trim().ToUpper().StartsWith("ORDER BY ")) { return(orderByString); } return("ORDER BY " + orderByString); } var retVal = string.Empty; if (taxisType == ETaxisType.OrderById) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.Id)} ASC"; } else if (taxisType == ETaxisType.OrderByIdDesc) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByChannelId) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.ChannelId)} ASC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByChannelIdDesc) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.ChannelId)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByAddDate) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.AddDate)} ASC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByAddDateDesc) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.AddDate)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDate) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.LastEditDate)} ASC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDateDesc) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.LastEditDate)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByTaxis) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.Taxis)} ASC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByTaxisDesc) { retVal = $"ORDER BY {nameof(ContentAttribute.IsTop)} DESC, {nameof(IContentInfo.Taxis)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByHits) { retVal = $"ORDER BY {nameof(IContentInfo.Hits)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByHitsByDay) { retVal = $"ORDER BY {nameof(IContentInfo.HitsByDay)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByHitsByWeek) { retVal = $"ORDER BY {nameof(IContentInfo.HitsByWeek)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByHitsByMonth) { retVal = $"ORDER BY {nameof(IContentInfo.HitsByMonth)} DESC, {nameof(IContentInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByRandom) { retVal = SqlUtils.GetOrderByRandom(); } return(retVal); }
public static string GetContentOrderByString(ETaxisType taxisType) { return(GetContentOrderByString(taxisType, string.Empty)); }
public static string GetInputContentOrderByString(ETaxisType taxisType) { return(GetOrderByString(ETableStyle.InputContent, taxisType)); }
public static string GetOrderByString(int publishmentSystemId, string orderValue, ETableStyle tableStyle, ETaxisType defaultType) { var taxisType = defaultType; var orderByString = string.Empty; if (!string.IsNullOrEmpty(orderValue)) { if (tableStyle == ETableStyle.Channel) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } else if (tableStyle == ETableStyle.BackgroundContent) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDate.ToLower())) { taxisType = ETaxisType.OrderByLastEditDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderLastEditDateBack.ToLower())) { taxisType = ETaxisType.OrderByLastEditDate; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByDay.ToLower())) { taxisType = ETaxisType.OrderByHitsByDay; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByWeek.ToLower())) { taxisType = ETaxisType.OrderByHitsByWeek; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderHitsByMonth.ToLower())) { taxisType = ETaxisType.OrderByHitsByMonth; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderStars.ToLower())) { taxisType = ETaxisType.OrderByStars; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderDigg.ToLower())) { taxisType = ETaxisType.OrderByDigg; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderComments.ToLower())) { taxisType = ETaxisType.OrderByComments; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderRandom.ToLower())) { taxisType = ETaxisType.OrderByRandom; } else { orderByString = orderValue; } } else if (tableStyle == ETableStyle.InputContent) { if (orderValue.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (orderValue.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else { orderByString = orderValue; } } } ArrayList orderedContentIdArrayList = null; if (taxisType == ETaxisType.OrderByHits) { if (tableStyle == ETableStyle.Channel) { orderedContentIdArrayList = DataProvider.TrackingDao.GetPageNodeIdArrayListByAccessNum(publishmentSystemId); } } else if (taxisType == ETaxisType.OrderByStars) { orderedContentIdArrayList = DataProvider.StarDao.GetContentIdArrayListByPoint(publishmentSystemId); } else if (taxisType == ETaxisType.OrderByDigg) { orderedContentIdArrayList = BaiRongDataProvider.DiggDao.GetRelatedIdentityArrayListByTotal(publishmentSystemId); } else if (taxisType == ETaxisType.OrderByComments) { orderedContentIdArrayList = DataProvider.CommentDao.GetContentIdArrayListByCount(publishmentSystemId); } return(ETaxisTypeUtils.GetOrderByString(tableStyle, taxisType, orderByString, orderedContentIdArrayList)); }
public static string GetValue(ETaxisType type) { if (type == ETaxisType.OrderById) { return("OrderByID"); } else if (type == ETaxisType.OrderByIdDesc) { return("OrderByIDDesc"); } else if (type == ETaxisType.OrderByNodeId) { return("OrderByNodeID"); } else if (type == ETaxisType.OrderByNodeIdDesc) { return("OrderByNodeIDDesc"); } else if (type == ETaxisType.OrderByAddDate) { return("OrderByAddDate"); } else if (type == ETaxisType.OrderByAddDateDesc) { return("OrderByAddDateDesc"); } else if (type == ETaxisType.OrderByLastEditDate) { return("OrderByLastEditDate"); } else if (type == ETaxisType.OrderByLastEditDateDesc) { return("OrderByLastEditDateDesc"); } else if (type == ETaxisType.OrderByTaxis) { return("OrderByTaxis"); } else if (type == ETaxisType.OrderByTaxisDesc) { return("OrderByTaxisDesc"); } else if (type == ETaxisType.OrderByHits) { return("OrderByHits"); } else if (type == ETaxisType.OrderByHitsByDay) { return("OrderByHitsByDay"); } else if (type == ETaxisType.OrderByHitsByWeek) { return("OrderByHitsByWeek"); } else if (type == ETaxisType.OrderByHitsByMonth) { return("OrderByHitsByMonth"); } else if (type == ETaxisType.OrderByStars) { return("OrderByStars"); } else if (type == ETaxisType.OrderByDigg) { return("OrderByDigg"); } else if (type == ETaxisType.OrderByComments) { return("OrderByComments"); } else if (type == ETaxisType.OrderByRandom) { return("OrderByRandom"); } else { throw new Exception(); } }
public static string GetOrderByString(ETableStyle tableStyle, ETaxisType taxisType, string orderByString, ArrayList orderedContentIdArrayList) { if (!string.IsNullOrEmpty(orderByString)) { if (orderByString.Trim().ToUpper().StartsWith("ORDER BY ")) { return(orderByString); } else { return("ORDER BY " + orderByString); } } var retval = string.Empty; if (tableStyle == ETableStyle.Channel) { if (taxisType == ETaxisType.OrderById) { retval = "ORDER BY NodeID ASC"; } else if (taxisType == ETaxisType.OrderByIdDesc) { retval = "ORDER BY NodeID DESC"; } else if (taxisType == ETaxisType.OrderByNodeId) { retval = "ORDER BY NodeID ASC"; } else if (taxisType == ETaxisType.OrderByNodeIdDesc) { retval = "ORDER BY NodeID DESC"; } else if (taxisType == ETaxisType.OrderByAddDate) { retval = "ORDER BY AddDate ASC"; } else if (taxisType == ETaxisType.OrderByAddDateDesc) { retval = "ORDER BY AddDate DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDate) { retval = "ORDER BY AddDate ASC"; } else if (taxisType == ETaxisType.OrderByLastEditDateDesc) { retval = "ORDER BY AddDate DESC"; } else if (taxisType == ETaxisType.OrderByTaxis) { retval = "ORDER BY Taxis ASC"; } else if (taxisType == ETaxisType.OrderByTaxisDesc) { retval = "ORDER BY Taxis DESC"; } else if (taxisType == ETaxisType.OrderByHits) { if (orderedContentIdArrayList != null && orderedContentIdArrayList.Count > 0) { orderedContentIdArrayList.Reverse(); retval = $"ORDER BY CHARINDEX(CONVERT(VARCHAR,NodeID), '{TranslateUtils.ObjectCollectionToString(orderedContentIdArrayList)}') DESC, Taxis ASC"; } else { retval = "ORDER BY Taxis ASC"; } } else if (taxisType == ETaxisType.OrderByRandom) { retval = "ORDER BY NEWID() DESC"; } } else if (ETableStyleUtils.IsContent(tableStyle)) { if (taxisType == ETaxisType.OrderById) { retval = "ORDER BY IsTop DESC, ID ASC"; } else if (taxisType == ETaxisType.OrderByIdDesc) { retval = "ORDER BY IsTop DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByNodeId) { retval = "ORDER BY IsTop DESC, NodeID ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByNodeIdDesc) { retval = "ORDER BY IsTop DESC, NodeID DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByAddDate) { retval = "ORDER BY IsTop DESC, AddDate ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByAddDateDesc) { retval = "ORDER BY IsTop DESC, AddDate DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDate) { retval = "ORDER BY IsTop DESC, LastEditDate ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDateDesc) { retval = "ORDER BY IsTop DESC, LastEditDate DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByTaxis) { retval = "ORDER BY IsTop DESC, Taxis ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByTaxisDesc) { retval = "ORDER BY IsTop DESC, Taxis DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByHits) { retval = "ORDER BY Hits DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByHitsByDay) { retval = "ORDER BY HitsByDay DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByHitsByWeek) { retval = "ORDER BY HitsByWeek DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByHitsByMonth) { retval = "ORDER BY HitsByMonth DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByStars || taxisType == ETaxisType.OrderByDigg || taxisType == ETaxisType.OrderByComments) { if (orderedContentIdArrayList != null && orderedContentIdArrayList.Count > 0) { orderedContentIdArrayList.Reverse(); retval = $"ORDER BY CHARINDEX(CONVERT(VARCHAR,ID), '{TranslateUtils.ObjectCollectionToString(orderedContentIdArrayList)}') DESC, IsTop DESC, Taxis DESC, ID DESC"; } else { retval = "ORDER BY IsTop DESC, Taxis DESC, ID DESC"; } } else if (taxisType == ETaxisType.OrderByRandom) { retval = "ORDER BY NEWID() DESC"; } } else if (tableStyle == ETableStyle.InputContent) { if (taxisType == ETaxisType.OrderById) { retval = "ORDER BY ID ASC"; } else if (taxisType == ETaxisType.OrderByIdDesc) { retval = "ORDER BY ID DESC"; } else if (taxisType == ETaxisType.OrderByAddDate) { retval = "ORDER BY AddDate ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByAddDateDesc) { retval = "ORDER BY AddDate DESC, ID DESC"; } else if (taxisType == ETaxisType.OrderByTaxis) { retval = "ORDER BY Taxis ASC, ID DESC"; } else if (taxisType == ETaxisType.OrderByTaxisDesc) { retval = "ORDER BY Taxis DESC"; } else if (taxisType == ETaxisType.OrderByRandom) { retval = "ORDER BY NEWID() DESC"; } } return(retval); }
public static string GetOrderByString(ETableStyle tableStyle, ETaxisType taxisType) { return(GetOrderByString(tableStyle, taxisType, string.Empty, null)); }
public static string GetChannelOrderByString(ETaxisType taxisType) { return(GetOrderByString(ETableStyle.Channel, taxisType)); }
//public static int GetChannelIdByChannelIDOrChannelIndexOrChannelName(int siteID, int channelID, string channelIndex, string channelName) //{ // int retVal = channelID; // if (!string.IsNullOrEmpty(channelIndex)) // { // int theChannelId = DataProvider.NodeDAO.GetChannelIdByNodeIndexName(siteID, channelIndex); // if (theChannelId != 0) // { // retVal = theChannelId; // } // } // if (!string.IsNullOrEmpty(channelName)) // { // int theChannelId = DataProvider.NodeDAO.GetChannelIdByParentIDAndNodeName(retVal, channelName, true); // if (theChannelId == 0) // { // theChannelId = DataProvider.NodeDAO.GetChannelIdByParentIDAndNodeName(siteID, channelName, true); // } // if (theChannelId != 0) // { // retVal = theChannelId; // } // } // return retVal; //} public static ETaxisType GetETaxisTypeByOrder(string order, bool isChannel, ETaxisType defaultType) { var taxisType = defaultType; if (!string.IsNullOrEmpty(order)) { if (isChannel) { if (order.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (order.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (order.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (order.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (order.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } } else { if (order.ToLower().Equals(StlParserUtility.OrderDefault.ToLower())) { taxisType = ETaxisType.OrderByTaxisDesc; } else if (order.ToLower().Equals(StlParserUtility.OrderBack.ToLower())) { taxisType = ETaxisType.OrderByTaxis; } else if (order.ToLower().Equals(StlParserUtility.OrderAddDate.ToLower())) { taxisType = ETaxisType.OrderByAddDate; } else if (order.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByAddDateDesc; } else if (order.ToLower().Equals(StlParserUtility.OrderLastEditDate.ToLower())) { taxisType = ETaxisType.OrderByLastEditDate; } else if (order.ToLower().Equals(StlParserUtility.OrderAddDateBack.ToLower())) { taxisType = ETaxisType.OrderByLastEditDateDesc; } else if (order.ToLower().Equals(StlParserUtility.OrderHits.ToLower())) { taxisType = ETaxisType.OrderByHits; } else if (order.ToLower().Equals(StlParserUtility.OrderHitsByDay.ToLower())) { taxisType = ETaxisType.OrderByHitsByDay; } else if (order.ToLower().Equals(StlParserUtility.OrderHitsByWeek.ToLower())) { taxisType = ETaxisType.OrderByHitsByWeek; } else if (order.ToLower().Equals(StlParserUtility.OrderHitsByMonth.ToLower())) { taxisType = ETaxisType.OrderByHitsByMonth; } } } return taxisType; }
public static bool Equals(string typeStr, ETaxisType type) { return(Equals(type, typeStr)); }
public static string GetChannelOrderByString(ETaxisType taxisType, string orderByString, List <int> orderedContentIdList) { if (!string.IsNullOrEmpty(orderByString)) { if (orderByString.Trim().ToUpper().StartsWith("ORDER BY ")) { return(orderByString); } return("ORDER BY " + orderByString); } var retVal = string.Empty; if (taxisType == ETaxisType.OrderById) { retVal = $"ORDER BY {nameof(IChannelInfo.Id)} ASC"; } else if (taxisType == ETaxisType.OrderByIdDesc) { retVal = $"ORDER BY {nameof(IChannelInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByChannelId) { retVal = $"ORDER BY {nameof(IChannelInfo.Id)} ASC"; } else if (taxisType == ETaxisType.OrderByChannelIdDesc) { retVal = $"ORDER BY {nameof(IChannelInfo.Id)} DESC"; } else if (taxisType == ETaxisType.OrderByAddDate) { retVal = $"ORDER BY {nameof(IChannelInfo.AddDate)} ASC"; } else if (taxisType == ETaxisType.OrderByAddDateDesc) { retVal = $"ORDER BY {nameof(IChannelInfo.AddDate)} DESC"; } else if (taxisType == ETaxisType.OrderByLastEditDate) { retVal = $"ORDER BY {nameof(IChannelInfo.AddDate)} ASC"; } else if (taxisType == ETaxisType.OrderByLastEditDateDesc) { retVal = $"ORDER BY {nameof(IChannelInfo.AddDate)} DESC"; } else if (taxisType == ETaxisType.OrderByTaxis) { retVal = $"ORDER BY {nameof(IChannelInfo.Taxis)} ASC"; } else if (taxisType == ETaxisType.OrderByTaxisDesc) { retVal = $"ORDER BY {nameof(IChannelInfo.Taxis)} DESC"; } else if (taxisType == ETaxisType.OrderByHits) { if (orderedContentIdList != null && orderedContentIdList.Count > 0) { orderedContentIdList.Reverse(); retVal = $"ORDER BY CHARINDEX(CONVERT(VARCHAR, {nameof(IChannelInfo.Id)}), '{TranslateUtils.ObjectCollectionToString(orderedContentIdList)}') DESC, {nameof(IChannelInfo.Taxis)} ASC"; } else { retVal = $"ORDER BY {nameof(IChannelInfo.Taxis)} ASC"; } } else if (taxisType == ETaxisType.OrderByRandom) { retVal = SqlUtils.GetOrderByRandom(); } return(retVal); }
public static string GetChannelOrderByString(ETaxisType taxisType) { return(GetChannelOrderByString(taxisType, string.Empty, null)); }
public static string GetContentOrderByString(ETaxisType taxisType) { return(GetOrderByString(ETableStyle.BackgroundContent, taxisType)); }