public T GetLotteryInfoById <T>(int lotteryId) where T : LotteryInfoBase, new() { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <T>(lotteryId)); }
public void AddList(ListItemInfo list) { try { list.Name = list.Name.Trim(); ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Name", list.Name)); if (!string.IsNullOrEmpty(list.Id)) { cri.Add(Expression.NotEqual("Id", list.Id)); } IList<ListItemInfo> tmpList = persistence.GetList<ListItemInfo>(cri); if (tmpList.Count > 0) { throw new FacadeException("列表名称已经存在,请重新输入!"); } ListItemEntity entity = new ListItemEntity(); entity.Name = list.Name; PageManager manager = new PageManager(DbAccess); manager.AddEntity<ListItemEntity>(entity); list.Id = entity.Id; } catch (Exception ex) { throw HandleException("Page", "AddList - " + list.Name, ex); } }
public IList<PageBlockInfo> GetRowBlockList(int yIndex) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("YIndex", yIndex)); return persistence.GetList<PageBlockInfo>(cri, new SortInfo("XIndex")); }
public void ModifyListName(string listId, string newName) { try { newName = newName.Trim(); ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Name", newName)); cri.Add(Expression.NotEqual("Id", listId)); IList <ListItemInfo> tmpList = persistence.GetList <ListItemInfo>(cri); if (tmpList.Count > 0) { throw new FacadeException("列表名称已经存在,请重新输入!"); } ListItemEntity entity = new ListItemEntity(); entity.Id = listId; entity.Name = newName; PageManager manager = new PageManager(DbAccess); manager.ModifyEntity <ListItemEntity>(entity); } catch (Exception ex) { throw HandleException("Page", "ModifyListName - " + listId + " : " + newName, ex); } }
public void AddList(ListItemInfo list) { try { list.Name = list.Name.Trim(); ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Name", list.Name)); if (!string.IsNullOrEmpty(list.Id)) { cri.Add(Expression.NotEqual("Id", list.Id)); } IList <ListItemInfo> tmpList = persistence.GetList <ListItemInfo>(cri); if (tmpList.Count > 0) { throw new FacadeException("列表名称已经存在,请重新输入!"); } ListItemEntity entity = new ListItemEntity(); entity.Name = list.Name; PageManager manager = new PageManager(DbAccess); manager.AddEntity <ListItemEntity>(entity); list.Id = entity.Id; } catch (Exception ex) { throw HandleException("Page", "AddList - " + list.Name, ex); } }
public mindrControl() { InitializeComponent(); _viewmodel = (Presenter)DataContext; _viewmodel.Reminders = ObjectPersistence.LoadReminders(); //todo set timer for remindres }
public UserInfo Login(string userId, string password) { try { UserManager manager = new UserManager(DbAccess); password = EncryptTool.MD5(password); LoginEntity entity = manager.Authenticate(userId, password); ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <UserInfo>(userId)); } catch (LoginException ex) { string errMsg = "登录失败"; switch (ex.LoginErrorType) { case LoginErrorType.UserIdOrPasswordError: errMsg += " - 输入的用户名或密码错误!"; break; case LoginErrorType.UserCannotLogin: errMsg += " - 用户被限制登录,请联系系统管理员!"; break; } throw HandleException(LogCategory.Login, errMsg, ex); } catch (Exception ex) { string errMsg = "登录失败 - 系统异常,请联系系统管理员!"; throw HandleException(LogCategory.Login, errMsg, ex); } }
public IList<MenuInfo> GetRootMenuList() { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.IsNull("ParentId")); return persistence.GetList<MenuInfo>(cri, new SortInfo("Index")); }
public IList <MenuInfo> GetRootMenuList() { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.IsNull("ParentId")); return(persistence.GetList <MenuInfo>(cri, new SortInfo("Index"))); }
public IList <PageBlockInfo> GetRowBlockList(int yIndex) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("YIndex", yIndex)); return(persistence.GetList <PageBlockInfo>(cri, new SortInfo("XIndex"))); }
public void UpdateItem(ItemDetailInfo item) { item.LastUpdateDate = DateTime.Now; ObjectPersistence persistence = new ObjectPersistence(DbAccess); persistence.Modify(item); }
public IList <ItemDetailInfo> GetChildrenItemList(Guid collectionId, int pageIndex, int pageSize, out int totalCount, string orderBy, SortDirection direction) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ItsCollectionId", collectionId)); return(persistence.GetList <ItemDetailInfo>(cri, pageIndex, pageSize, out totalCount, new SortInfo(orderBy, direction))); }
public void AddItem(ItemDetailInfo item) { item.PublishDate = DateTime.Now; item.LastUpdateDate = DateTime.Now; ObjectPersistence persistence = new ObjectPersistence(DbAccess); persistence.Add(item); }
public void LoadChildrenMenuList(MenuInfo menu, bool isEnforce) { if (menu.Children == null || isEnforce) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ParentId", menu.Id)); menu.Children = persistence.GetList<MenuInfo>(cri, new SortInfo("Index")); } }
public void LoadChildrenMenuList(MenuInfo menu, bool isEnforce) { if (menu.Children == null || isEnforce) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ParentId", menu.Id)); menu.Children = persistence.GetList <MenuInfo>(cri, new SortInfo("Index")); } }
public void LoadParentMenu(MenuInfo menu, bool isEnforce) { if (menu.Parent == null || isEnforce) { if (menu.ParentId != null) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); menu.Parent = persistence.GetByKey <MenuInfo>(menu.ParentId); } } }
public void LoadParentMenu(MenuInfo menu, bool isEnforce) { if (menu.Parent == null || isEnforce) { if (menu.ParentId != null) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); menu.Parent = persistence.GetByKey<MenuInfo>(menu.ParentId); } } }
public IList <NoticeInfo> GetAllNoticeList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetAll <NoticeInfo>(new SortInfo("UpdateTime", SortDirection.Desc))); } catch (Exception ex) { throw HandleException("Notice", "GetAllNoticeList", ex); } }
public IList<NoticeInfo> GetAllNoticeList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetAll<NoticeInfo>(new SortInfo("UpdateTime", SortDirection.Desc)); } catch (Exception ex) { throw HandleException("Notice", "GetAllNoticeList", ex); } }
public ParamInfo GetParam(string key) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <ParamInfo>(key)); } catch (Exception ex) { throw HandleException("Param", "Get parameter by key error. - " + key, ex); } }
public HtmlItemFullInfo GetHtmlItemById(string htmlId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <HtmlItemFullInfo>(htmlId)); } catch (Exception ex) { throw HandleException("Page", "GetHtmlItemById - " + htmlId, ex); } }
public ParamInfo GetParam(string key) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<ParamInfo>(key); } catch (Exception ex) { throw HandleException("Param", "Get parameter by key error. - " + key, ex); } }
public MenuItemInfo GetMenuById(string menuId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <MenuItemInfo>(menuId)); } catch (Exception ex) { throw HandleException("Page", "GetMenuById - " + menuId, ex); } }
public ListItemInfo GetListItemById(string id) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <ListItemInfo>(id)); } catch (Exception ex) { throw HandleException("Page", "GetListItemById - " + id, ex); } }
public RequestGetMoneyInfo GetRequestMoneyInfo(long id) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<RequestGetMoneyInfo>(id); } catch (Exception ex) { string errMsg = "获取用户请求提款失败!"; throw HandleException(LogCategory.Money, errMsg, ex); } }
public UserInfo GetUserInfo(string userId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <UserInfo>(userId)); } catch (Exception ex) { string errMsg = "获取用户信息失败!"; throw HandleException(LogCategory.SearchUser, errMsg, ex); } }
public RequestGetMoneyInfo GetRequestMoneyInfo(long id) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return(persistence.GetByKey <RequestGetMoneyInfo>(id)); } catch (Exception ex) { string errMsg = "获取用户请求提款失败!"; throw HandleException(LogCategory.Money, errMsg, ex); } }
public IList <MenuItemInfo> GetChildrenMenuList(string parentId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ParentId", parentId)); return(persistence.GetList <MenuItemInfo>(cri, new SortInfo("Index"))); } catch (Exception ex) { throw HandleException("Page", "GetChildrenMenuList - " + parentId, ex); } }
public bool CheckUserIdCanRegister(string userId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); LoginEntity user = persistence.GetByKey <LoginEntity>(userId); return(user == null); } catch (Exception ex) { string errMsg = "检查用户ID失败!"; throw HandleException(LogCategory.SearchUser, errMsg, ex); } }
public bool CheckUserIdCanRegister(string userId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); LoginEntity user = persistence.GetByKey<LoginEntity>(userId); return (user == null); } catch (Exception ex) { string errMsg = "检查用户ID失败!"; throw HandleException(LogCategory.SearchUser, errMsg, ex); } }
public NoticeInfo GetNoticeMessage(string noticeId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); NoticeInfo notice = persistence.GetByKey <NoticeInfo>(noticeId); string sql = "SELECT [Message] FROM [T_Notice_List] WHERE [Id] = {0}"; notice.Message = (string)DbAccess.GetRC1BySQL(sql, noticeId); return(notice); } catch (Exception ex) { throw HandleException("Notice", "GetNoticeMessage", ex); } }
public T GetLotteryInfoByCode <T>(string code) where T : LotteryInfoBase, new() { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Code", code)); IList <T> list = persistence.GetList <T>(cri); if (list.Count > 0) { return(list[0]); } return(null); }
public IList <RequestGetMoneyInfo> GetUnhandleRequestMoneyList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Status", MoneyGetStatus.Requesting)); return(persistence.GetList <RequestGetMoneyInfo>(cri, new SortInfo("RequestTime", SortDirection.Desc))); } catch (Exception ex) { string errMsg = "获取用户请求提款失败!"; throw HandleException(LogCategory.Money, errMsg, ex); } }
public IList<NoticeInfo> GetCurrentNoticeList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("IsEnd", false)); cri.Add(Expression.GreaterThanEqual("EndTime", DateTime.Now)); cri.Add(Expression.LessThanEqual("StartTime", DateTime.Now)); return persistence.GetList<NoticeInfo>(cri, new SortInfo("UpdateTime", SortDirection.Desc)); } catch (Exception ex) { throw HandleException("Notice", "GetCurrentNoticeList", ex); } }
public IList <NoticeInfo> GetCurrentNoticeList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("IsEnd", false)); cri.Add(Expression.GreaterThanEqual("EndTime", DateTime.Now)); cri.Add(Expression.LessThanEqual("StartTime", DateTime.Now)); return(persistence.GetList <NoticeInfo>(cri, new SortInfo("UpdateTime", SortDirection.Desc))); } catch (Exception ex) { throw HandleException("Notice", "GetCurrentNoticeList", ex); } }
public IList <MenuItemInfo> GetTopMenuList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Or( Expression.IsNull("ParentId"), Expression.Equal("ParentId", ""))); return(persistence.GetList <MenuItemInfo>(cri, new SortInfo("Index"))); } catch (Exception ex) { throw HandleException("Page", "GetTopMenuList", ex); } }
public IssuseInfo GetPrevIsuse(string gameName) { Criteria cri = new Criteria(); cri.Add(Expression.Equal("GameName", gameName)); cri.Add(Expression.GreaterThanEqual("Status", IssueStatus.Finished)); ObjectPersistence persistence = new ObjectPersistence(DbAccess); int totalCount; IList <IssuseInfo> list = persistence.GetList <IssuseInfo>(cri, 0, 1, out totalCount, new SortInfo("StopTime", SortDirection.Desc)); if (list.Count > 0) { return(list[0]); } return(null); }
public IssuseInfo GetCurrentIsuse(string gameName) { Criteria cri = new Criteria(); cri.Add(Expression.Equal("GameName", gameName)); cri.Add(Expression.Equal("Status", IssueStatus.Started)); cri.Add(Expression.GreaterThan("StopTime", DateTime.Now)); ObjectPersistence persistence = new ObjectPersistence(DbAccess); IList <IssuseInfo> list = persistence.GetList <IssuseInfo>(cri, new SortInfo("StopTime", SortDirection.Desc)); if (list.Count > 0) { return(list[0]); } return(null); }
public void GetBlockContent(PageBlockInfo blockInfo) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); ItemInfo item = persistence.GetByKey<ItemInfo>(blockInfo.ContentId); switch (item.TypeCode) { case 0: // HTML页面 blockInfo.ContentItem = new ItemHtmlFacade().GetItemById(blockInfo.ContentId); break; case 1: // 列表 blockInfo.ContentItem = new ItemCollectionFacade().GetItemById(blockInfo.ContentId); break; case 2: // 子页面 blockInfo.ContentItem = new ItemDetailFacade().GetItemById(blockInfo.ContentId); break; default: throw new ArgumentOutOfRangeException("\"" + item.ItemName + "\"的类型不支持:" + item.TypeCode + "" + item.TypeName); } }
public IList <ListItemInfo> GetListItems() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); IList <ListItemInfo> list = persistence.GetAll <ListItemInfo>(new SortInfo("CreateTime", SortDirection.Desc)); ListItemInfo other = new ListItemInfo(); other.Id = Guid.Empty.ToString("N"); other.Name = "<其他>"; other.CreateTime = DateTime.Now; other.LastUpdateTime = DateTime.Now; list.Insert(0, other); return(list); } catch (Exception ex) { throw HandleException("Page", "GetListItems", ex); } }
public IList <HtmlItemInfo> GetHtmlItemsByParent(string listId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); if (string.IsNullOrEmpty(listId) || listId == Guid.Empty.ToString("N")) { cri.Add(Expression.Or( Expression.IsNull("ItsListId"), Expression.Equal("ItsListId", ""))); } else { cri.Add(Expression.Equal("ItsListId", listId)); } return(persistence.GetList <HtmlItemInfo>(cri, new SortInfo("LastUpdateTime", SortDirection.Desc))); } catch (Exception ex) { throw HandleException("Page", "GetHtmlItemsByParent - " + listId, ex); } }
public ListItemInfo GetListItemById(string id) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<ListItemInfo>(id); } catch (Exception ex) { throw HandleException("Page", "GetListItemById - " + id, ex); } }
public IList<ListItemInfo> GetListItems() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); IList<ListItemInfo> list = persistence.GetAll<ListItemInfo>(new SortInfo("CreateTime", SortDirection.Desc)); ListItemInfo other = new ListItemInfo(); other.Id = Guid.Empty.ToString("N"); other.Name = "<其他>"; other.CreateTime = DateTime.Now; other.LastUpdateTime = DateTime.Now; list.Insert(0, other); return list; } catch (Exception ex) { throw HandleException("Page", "GetListItems", ex); } }
public MenuItemInfo GetMenuById(string menuId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<MenuItemInfo>(menuId); } catch (Exception ex) { throw HandleException("Page", "GetMenuById - " + menuId, ex); } }
public IList<MenuItemInfo> GetTopMenuList() { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Or( Expression.IsNull("ParentId"), Expression.Equal("ParentId", ""))); return persistence.GetList<MenuItemInfo>(cri, new SortInfo("Index")); } catch (Exception ex) { throw HandleException("Page", "GetTopMenuList", ex); } }
public MenuInfo GetMenuById(Guid id) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<MenuInfo>(id); }
public MenuManager(IDBAccess dbAccess) { persistence = new ObjectPersistence(dbAccess); }
public PageBlockManager(IDBAccess dbAccess) { persistence = new ObjectPersistence(dbAccess); }
public IList<RequestGetMoneyInfo> GetRequestMoneyList(string userId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("UserId", userId)); return persistence.GetList<RequestGetMoneyInfo>(cri, new SortInfo("Status"), new SortInfo("RequestTime", SortDirection.Desc)); } catch (Exception ex) { string errMsg = "获取用户请求提款失败!"; throw HandleException(LogCategory.Money, errMsg, ex); } }
public NoticeManager(IDBAccess dbAccess) { persistence = new ObjectPersistence(dbAccess); }
public UserInfo GetUserInfo(string userId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<UserInfo>(userId); } catch (Exception ex) { string errMsg = "获取用户信息失败!"; throw HandleException(LogCategory.SearchUser, errMsg, ex); } }
public UserInfo Login(string userId, string password) { try { UserManager manager = new UserManager(DbAccess); password = EncryptTool.MD5(password); LoginEntity entity = manager.Authenticate(userId, password); ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<UserInfo>(userId); } catch (LoginException ex) { string errMsg = "登录失败"; switch (ex.LoginErrorType) { case LoginErrorType.UserIdOrPasswordError: errMsg += " - 输入的用户名或密码错误!"; break; case LoginErrorType.UserCannotLogin: errMsg += " - 用户被限制登录,请联系系统管理员!"; break; } throw HandleException(LogCategory.Login, errMsg, ex); } catch (Exception ex) { string errMsg = "登录失败 - 系统异常,请联系系统管理员!"; throw HandleException(LogCategory.Login, errMsg, ex); } }
public IList<HtmlItemInfo> GetHtmlItemsByParent(string listId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); if (string.IsNullOrEmpty(listId) || listId == Guid.Empty.ToString("N")) { cri.Add(Expression.Or( Expression.IsNull("ItsListId"), Expression.Equal("ItsListId", ""))); } else { cri.Add(Expression.Equal("ItsListId", listId)); } return persistence.GetList<HtmlItemInfo>(cri, new SortInfo("LastUpdateTime", SortDirection.Desc)); } catch (Exception ex) { throw HandleException("Page", "GetHtmlItemsByParent - " + listId, ex); } }
public NoticeInfo GetNoticeMessage(string noticeId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); NoticeInfo notice = persistence.GetByKey<NoticeInfo>(noticeId); string sql = "SELECT [Message] FROM [T_Notice_List] WHERE [Id] = {0}"; notice.Message = (string)DbAccess.GetRC1BySQL(sql, noticeId); return notice; } catch (Exception ex) { throw HandleException("Notice", "GetNoticeMessage", ex); } }
public HtmlItemFullInfo GetHtmlItemById(string htmlId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); return persistence.GetByKey<HtmlItemFullInfo>(htmlId); } catch (Exception ex) { throw HandleException("Page", "GetHtmlItemById - " + htmlId, ex); } }
public void ModifyListName(string listId, string newName) { try { newName = newName.Trim(); ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("Name", newName)); cri.Add(Expression.NotEqual("Id", listId)); IList<ListItemInfo> tmpList = persistence.GetList<ListItemInfo>(cri); if (tmpList.Count > 0) { throw new FacadeException("列表名称已经存在,请重新输入!"); } ListItemEntity entity = new ListItemEntity(); entity.Id = listId; entity.Name = newName; PageManager manager = new PageManager(DbAccess); manager.ModifyEntity<ListItemEntity>(entity); } catch (Exception ex) { throw HandleException("Page", "ModifyListName - " + listId + " : " + newName, ex); } }
public void DeleteList(string listId) { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ItsListId", listId)); IList<HtmlItemInfo> list = persistence.GetList<HtmlItemInfo>(cri); if (list.Count > 0) { throw new FacadeException("此列表包含有子页面,请先删除列表下的全部子页面。"); } try { ListItemEntity entity = new ListItemEntity(); entity.Id = listId; PageManager manager = new PageManager(DbAccess); manager.DeleteEntity<ListItemEntity>(entity); } catch (Exception ex) { throw HandleException("Page", "DeleteList - " + listId, ex); } }
public IList<MenuItemInfo> GetChildrenMenuList(string parentId) { try { ObjectPersistence persistence = new ObjectPersistence(DbAccess); Criteria cri = new Criteria(); cri.Add(Expression.Equal("ParentId", parentId)); return persistence.GetList<MenuItemInfo>(cri, new SortInfo("Index")); } catch (Exception ex) { throw HandleException("Page", "GetChildrenMenuList - " + parentId, ex); } }