📄 author.cs
字号:
namespace PowerEasy.Accessories
{
using PowerEasy.Common;
using PowerEasy.IDal.Accessories;
using PowerEasy.IDal.UserManage;
using PowerEasy.Model.Accessories;
using System;
using System.Collections.Generic;
public sealed class Author
{
private static readonly IAuthor dal = DataAccess.CreateAuthorInfo();
private static readonly IUsers userDal = DataAccess.CreateUsers();
private Author()
{
}
public static bool Add(AuthorInfo ainfo)
{
if (dal.Exists(DataSecurity.FilterBadChar(ainfo.Name)))
{
return false;
}
return dal.Add(ainfo);
}
public static bool Delete(string authorId)
{
return (DataValidator.IsValidId(authorId) && dal.Delete(authorId));
}
public static bool ExistsPassedAuthor(string authorName)
{
bool flag = false;
if (dal.ExistsPassedAuthor(authorName))
{
flag = true;
}
return flag;
}
public static AuthorInfo GetAuthorInfoById(int id)
{
return dal.GetAuthorInfoById(id);
}
public static AuthorInfo GetAuthorInfoByUserId(int userId)
{
return dal.GetAuthorInfoByUserId(userId);
}
public static IList<AuthorInfo> GetAuthorList(int startRowIndexId, int maxNumberRows, int listType, string searchType, string keyword)
{
return dal.GetAuthorList(startRowIndexId, maxNumberRows, listType, searchType, keyword, false);
}
public static IList<AuthorInfo> GetAuthorList(int startRowIndexId, int maxNumberRows, int listType, string searchType, string keyword, bool isDisable)
{
return dal.GetAuthorList(startRowIndexId, maxNumberRows, listType, searchType, keyword, isDisable);
}
public static int GetTotalOfAuthor(int listType, string searchType, string keyword)
{
return dal.GetTotalOfAuthor();
}
public static int GetUserId(string username)
{
return userDal.GetUsersByUserName(username).UserId;
}
public static string GetUserName(int userId)
{
return userDal.GetUserById(userId).UserName;
}
public static bool Update(AuthorInfo ainfo)
{
if (string.IsNullOrEmpty(ainfo.Name))
{
return false;
}
return dal.Update(ainfo);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -