📄 special.cs
字号:
}
public static SpecialCategoryInfo GetSpecialCategoryInfoById(int specialCategoryId)
{
return GetSpecialCategoryInfoById(specialCategoryId, true);
}
public static SpecialCategoryInfo GetSpecialCategoryInfoById(int specialCategoryId, bool isDecode)
{
SpecialCategoryInfo specialCategoryInfoById = dal.GetSpecialCategoryInfoById(specialCategoryId);
if (isDecode)
{
DecodeSpecialCategoryInfo(specialCategoryInfoById);
}
return specialCategoryInfoById;
}
public static IList<SpecialCategoryInfo> GetSpecialCategoryList()
{
return dal.GetSpecialCategoryList();
}
public static IList<SpecialCategoryInfo> GetSpecialCategoryList(string specialCategoryId)
{
if (!DataValidator.IsValidId(specialCategoryId))
{
return new List<SpecialCategoryInfo>();
}
return dal.GetSpecialCategoryList(specialCategoryId);
}
public static SpecialInfo GetSpecialInfoById(int specialId)
{
return dal.GetSpecialInfoById(specialId);
}
public static SpecialInfo GetSpecialInfoById(int specialId, bool isDecode)
{
SpecialInfo specialInfoById = dal.GetSpecialInfoById(specialId);
if (isDecode)
{
DecodeSpecialInfo(specialInfoById);
}
return specialInfoById;
}
public static string GetSpecialInfoIds(int generalId)
{
return dal.GetSpecialInfoIds(generalId);
}
public static IList<SpecialInfo> GetSpecialList()
{
return dal.GetSpecialList();
}
public static IList<SpecialInfo> GetSpecialList(int specialCategoryId)
{
return dal.GetSpecialList(specialCategoryId);
}
public static IList<SpecialInfo> GetSpecialList(string specialId)
{
if (!DataValidator.IsValidId(specialId))
{
return new List<SpecialInfo>();
}
return dal.GetSpecialList(specialId);
}
public static IList<SpecialInfo> GetSpecialList(int startRowIndexId, int maxNumberRows, int specialCategoryId, int listType)
{
return dal.GetSpecialList(startRowIndexId, maxNumberRows, specialCategoryId, listType);
}
public static IList<SpecialTree> GetSpecialTree()
{
IList<SpecialCategoryInfo> specialCategoryList = GetSpecialCategoryList();
IList<SpecialTree> list2 = new List<SpecialTree>();
foreach (SpecialCategoryInfo info in specialCategoryList)
{
IList<SpecialInfo> specialList = GetSpecialList(info.SpecialCategoryId);
SpecialTree tree = new SpecialTree();
tree.Id = info.SpecialCategoryId;
tree.Name = info.SpecialCategoryName;
if (specialList.Count > 0)
{
tree.TreeLineType = 5;
}
else
{
tree.TreeLineType = 4;
}
tree.IsSpecialCategory = true;
int num = 0;
list2.Add(tree);
foreach (SpecialInfo info2 in specialList)
{
SpecialTree tree2 = new SpecialTree();
tree2.Id = info2.SpecialId;
tree2.Name = info2.SpecialName;
if (num >= 0)
{
tree2.TreeLineType = 6;
}
num++;
if (num == specialList.Count)
{
tree2.TreeLineType = 7;
}
tree2.IsSpecialCategory = false;
list2.Add(tree2);
}
}
SpecialTree item = new SpecialTree();
item.Name = "<span style='color:red'>所有专题</span>";
item.Id = -1;
item.IsSpecialCategory = false;
item.TreeLineType = 0;
list2.Insert(0, item);
return list2;
}
public static int GetTotalOfSpecial(int specialCategoryId, int listType)
{
return dal.GetTotalOfSpecial();
}
public static void MoveSpecialInfoBySpecialId(string sourceSpecialId, int targetSpecialId)
{
if (!DataValidator.IsValidId(sourceSpecialId))
{
throw new CustomException("错误的SourceSpecialID!");
}
dal.MoveSpecialInfoBySpecialId(sourceSpecialId, targetSpecialId);
}
public static void OrderSpecial(IList<SpecialInfo> list)
{
List<SpecialInfo> list2 = (List<SpecialInfo>) list;
list2.Sort();
foreach (SpecialInfo info in list2)
{
UpdateSpecial(info);
}
}
public static void OrderSpecialCategory(IList<SpecialCategoryInfo> list)
{
List<SpecialCategoryInfo> list2 = (List<SpecialCategoryInfo>) list;
list2.Sort();
foreach (SpecialCategoryInfo info in list2)
{
UpdateSpecialCategory(info);
}
}
public static bool SpecialBatchSet(SpecialInfo specialInfo, string specialIds, Dictionary<string, bool> checkItem)
{
if (!DataValidator.IsValidId(specialIds))
{
return false;
}
if (!checkItem.ContainsValue(true))
{
throw new CustomException("没有选择需要批量设置的选项!");
}
return dal.SpecialBatchSet(specialInfo, specialIds, checkItem);
}
public static string TreeLine(int type)
{
string str = "";
str = HttpContext.Current.Request.ApplicationPath.Equals("/") ? string.Empty : HttpContext.Current.Request.ApplicationPath;
str = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + str;
string str2 = "<img src='" + str + "/Admin/images/Node/tree_line1.gif' width='17' height='16' valign='abvmiddle'>";
string str3 = "<img src='" + str + "/Admin/images/Node/tree_line2.gif' width='17' height='16' valign='abvmiddle'>";
string str4 = "<img src='" + str + "/Admin/images/Node/tree_line3.gif' width='17' height='16' valign='abvmiddle'>";
string str5 = "<img src='" + str + "/Admin/images/Node/tree_folder3.gif' width='15' height='15' valign='abvmiddle'>";
string str6 = "<img src='" + str + "/Admin/images/Node/tree_folder4.gif' width='15' height='15' valign='abvmiddle'>";
string str7 = string.Empty;
switch (type)
{
case 1:
return (str2 + " " + str6);
case 2:
return str3;
case 3:
return str4;
case 4:
return str5;
case 5:
return str6;
case 6:
return (str2 + " " + str5);
case 7:
return (str3 + " " + str5);
}
return str7;
}
public static int UniteSpecial(int specialId, int targetSpecialId)
{
int num = 0;
if (specialId <= 0)
{
return 1;
}
if (targetSpecialId <= 0)
{
return 2;
}
if (specialId == targetSpecialId)
{
return 3;
}
string[] strArray = GetGeneralIdBySpecialId(specialId.ToString()).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
int generalId = DataConverter.CLng(strArray[i]);
if (!ExistInSpecialInfos(targetSpecialId, generalId))
{
dal.AddToSpecialInfos(targetSpecialId, generalId);
}
}
if (!DeleteSpecialById(specialId))
{
num = 5;
}
return num;
}
public static bool UpdateSpecial(SpecialInfo specialInfo)
{
EncodeSpecialInfo(specialInfo);
return dal.UpdateSpecial(specialInfo);
}
public static bool UpdateSpecialCategory(SpecialCategoryInfo specialCategoryInfo)
{
EncodeSpecialCategoryInfo(specialCategoryInfo);
return dal.UpdateSpecialCategory(specialCategoryInfo);
}
public static void UpdateSpecialIdByGeneralId(int specialId, int sourceSpecialId, string generalId)
{
if (!DataValidator.IsValidId(generalId))
{
throw new CustomException("错误的generalId!");
}
dal.UpdateSpecialIdByGeneralId(specialId, sourceSpecialId, generalId);
}
public static bool UpdateSpecialInfos(string specialIds, int generalId)
{
bool flag = true;
if (!ExistInSpecialInfos(generalId))
{
return flag;
}
if (DeleteSpecialInfos(generalId))
{
if (!string.IsNullOrEmpty(specialIds))
{
flag = AddToSpecialInfos(specialIds, generalId);
}
return flag;
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -