Esempio n. 1
0
        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<BonusDetailEntity> GetBonusDetailList(string gameName, string issueNumber)
 {
     Criteria cri = new Criteria();
     cri.Add(Expression.Equal("GameName", gameName));
     cri.Add(Expression.Equal("IssueNumber", issueNumber));
     return persistence.GetList<BonusDetailEntity>(cri, new SortInfo("TicketId"), new SortInfo("BonusLevel"));
 }
Esempio n. 3
0
 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<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<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"));
 }
Esempio n. 6
0
 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"));
     }
 }
Esempio n. 7
0
 public LoginEntity Authenticate(string userId, string password)
 {
     password = EncryptTool.MD5(password);
     Criteria cri = new Criteria();
     cri.Add(
         Expression.And(
             Expression.Equal("UserId", userId)
             , Expression.Equal("Password", password)
         ));
     IList<UserPassowrdEntity> users = persistence.GetList<UserPassowrdEntity>(cri);
     if (users.Count > 0)
     {
         if (users[0].IsCanLogin)
         {
             return users[0];
         }
         throw new LoginException(LoginErrorType.UserCannotLogin);
     }
     throw new LoginException(LoginErrorType.UserIdOrPasswordError);
 }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
 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);
     }
 }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
 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);
     }
 }
Esempio n. 12
0
 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);
     }
 }
Esempio n. 13
0
 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);
     }
 }