public static void SetPageSpecificSettings(Excel.Worksheet sheet, Excel.PageSetup pageSetup) { string type = ListPage.GetDocumentType(sheet); switch (type) { case "Перечень элементов": pageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4; pageSetup.PrintArea = "A:Z"; break; case "Спецификация": pageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4; pageSetup.PrintArea = "A:Z"; break; case "Ведомость покупных изделий": pageSetup.PaperSize = Excel.XlPaperSize.xlPaperA3; pageSetup.Orientation = Excel.XlPageOrientation.xlLandscape; pageSetup.PrintArea = "A:AT"; break; default: break; } }
private void OnListPageParseDone(ListPage listPage) { if (ListPageParseDone != null) { ListPageParseDone(listPage); } }
private void Initialize() { sheet = (Excel.Worksheet)Globals.ThisAddIn.Application.ActiveSheet; string type = ListPage.GetDocumentType(sheet); switch (type) { case "Перечень элементов": firstPageRows = 23; secondPageRows = 29; columnsCount = 5; break; case "Спецификация": firstPageRows = 23; secondPageRows = 29; columnsCount = 7; break; case "Ведомость покупных изделий": firstPageRows = 24; secondPageRows = 28; columnsCount = 11; break; default: break; } }
public static void GenCode() { Console.WriteLine("请输入要生成的表名:"); string tableName = Console.ReadLine(); string databaseName = "zyGISDb"; ListPage page = new ListPage("", "", "");//GreateListPageFromUI(rows, tableName); List <KeyValuePair <string, object> > arg = new List <KeyValuePair <string, object> >(); arg.Add(new KeyValuePair <string, object>( "parameter1", new Parameter() { page = page, TableName = tableName, DatabaseName = databaseName, ProjName = Proj_Name } ) ); Console.WriteLine("正在生成Model文件..."); CreateModelFile(tableName, arg); Console.WriteLine("正在生成DTO文件..."); CreateDtoFile(tableName, arg); Console.WriteLine("正在生成Service文件..."); CreateServiceFile(tableName, arg); Console.WriteLine("正在替换dbset文件..."); ReplaceDbContext_AddDbSetForTable(SLN_Path + EF_Path + DBSET_Path, tableName); Console.WriteLine("正在执行批处理文件..."); //执行编译命令 Cmd cmd = new Cmd(); string output = cmd.RunCmd(SLN_Path + "1.bat"); Console.WriteLine(output); Console.WriteLine("按回车退出"); ConsoleKeyInfo kinfo = Console.ReadKey(); Environment.Exit(0); }
internal override ListPage add(int i, object obj) { int j; for (j = 0; i >= nChildren[j]; j++) { i -= nChildren[j]; } ListPage pg = (ListPage)items[j]; ListPage overflow = pg.add(i, obj); if (overflow != null) { countChildren(j, pg); overflow = base.add(j, overflow); } else { Modify(); if (nChildren[j] != int.MaxValue) { nChildren[j] += 1; } } return(overflow); }
/// <summary> /// 读取采集页数 /// </summary> /// <param name="listPage"></param> /// <returns></returns> public int GetSnifferPageCount(ListPage listPage) { ListPage firstPages = FindFirstPage(listPage); int index = this.AllFirstPages.IndexOf(firstPages); return(Convert.ToInt32(this.rootPageGridView.Rows[index].Cells[2].Value)); }
public virtual List <Mobile> GetOnlineList(ListPage listType) { List <Mobile> list = new List <Mobile>(); Action <Mobile> onlineCheck = delegate(Mobile m) { if (m != null && m.NetState != null) { list.Add(m); } }; switch (listType) { case ListPage.Buddy: { _buddyList.ForEach(onlineCheck); break; } case ListPage.Ignore: { _ignoreList.ForEach(onlineCheck); break; } } return(list); }
public async Task should_remove_all_distinct_promos( [Frozen] IOrderCloudClient oc, PromotionCommand sut, string orderID, Task <ListPage <Promotion> > promoList, ListPage <OrderPromotion> orderpromolist ) { // a line item promo may be applied multiple times on an order (once for each line item) // we only want to remove that promo once else we'll get 404's // https://four51.atlassian.net/browse/SEB-1825 // Arrange orderpromolist.Items = orderpromolist.Items.Select(p => { p.ID = "PROMO1"; p.Code = "PROMOCODE1"; return(p); }).ToList(); oc.Promotions.ListAsync() .ReturnsForAnyArgs(promoList); oc.Orders.ListPromotionsAsync(OrderDirection.Incoming, orderID, pageSize: 100) .Returns(orderpromolist.ToTask()); // Act await sut.AutoApplyPromotions(orderID); // Assert await oc.Orders.Received(1).RemovePromotionAsync(OrderDirection.Incoming, orderID, "PROMOCODE1"); }
public async Task Produces_200OK() { var pageFromManager = new Page <TemplateKindWithCount>(2, new List <TemplateKindWithCount> { new TemplateKindWithCount("tk1", 1), new TemplateKindWithCount("tk2", 4), }.AsReadOnly()); _templateKindManager.Setup(x => x.GetPage(1, 2, CancellationToken.None)) .ReturnsAsync(pageFromManager); var listFromMapper = new List <TemplateKindListItem> { new TemplateKindListItem { TemplateKindKey = "tk1", Uses = 1 }, new TemplateKindListItem { TemplateKindKey = "tk2", Uses = 4 }, }; _mapper.Setup(x => x.Map <List <TemplateKindListItem> >(pageFromManager.Entities)) .Returns(listFromMapper); var result = await _controller.GetTemplateKinds(1, 2, CancellationToken.None) as ObjectResult; var expectedPageList = new ListPage <TemplateKindListItem>(2, listFromMapper); result.Value.Should().BeEquivalentTo(expectedPageList); result.StatusCode.Should().Be(StatusCodes.Status200OK); _templateKindManager.Verify(x => x.GetPage(1, 2, CancellationToken.None), Times.Once); _mapper.Verify(x => x.Map <List <TemplateKindListItem> >(It.IsAny <IReadOnlyList <TemplateKindWithCount> >()), Times.Once); }
public virtual List<Mobile> GetOnlineList( ListPage listType ) { List<Mobile> list = new List<Mobile>(); Action<Mobile> onlineCheck = delegate( Mobile m ) { if( m != null && m.NetState != null ) list.Add( m ); }; switch( listType ) { case ListPage.Buddy: { _buddyList.ForEach( onlineCheck ); break; } case ListPage.Ignore: { _ignoreList.ForEach( onlineCheck ); break; } } return list; }
internal void countChildren(int i, ListPage pg) { if (nChildren[i] != int.MaxValue) { nChildren[i] = pg.size(); } }
private void OnFirstPageParseDone(ListPage firstPage) { if (FirstPageParseDone != null) { FirstPageParseDone(firstPage); } }
private async Task OpenExpensesListDialog(ExpenseCategory cat, DateTime?date) { selectedCategory = cat; selectedDate = date; var listPage = new ListPage(cat, date); listPage.HideTitleAndLabels(); var listFrame = new Frame(); listFrame.Navigate(listPage); var dialog = new ContentDialog { Title = "Lista wydatków", PrimaryButtonText = "Ok", Content = listFrame }; listPageElement = listPage; dialog.Closed += (sender, args) => { FillTable(); listPageElement = null; }; var result = await dialog.ShowAsync(); }
public void FillListPage() { Excel.Worksheet listSheet = ListPage.GetListPage(); int column = ListPage.GetDocumentColumnNumber(sheet.Name); if (column > 1) { foreach (KeyValuePair <int, string> entry in NamesList) { Excel.Range cells = (Excel.Range)listSheet.Cells[entry.Key, column]; cells.Value2 = entry.Value; } string name = NamesList[(int)Names.Designation]; if (!String.IsNullOrEmpty(name)) { NamesList[(int)Names.Sheet] = name; sheet.Name = name; } else { Excel.Range cells = (Excel.Range)listSheet.Cells[(int)Names.Sheet, column]; cells.Value2 = sheet.Name; } } }
public void Save() { var store = DynamicDataStoreFactory.Instance.CreateStore(typeof(DynamicComment)); store.Save(this); // Check PageID exist in ListPage if (ListPage == null) { ListPage.Add(DynamicComment.LastComment().PageID); } else { int testIdExitsInList = 0; foreach (int newID in ListPage) { if (newID == LastComment().PageID) { testIdExitsInList = 1; break; } } if (testIdExitsInList == 0) { ListPage.Add(LastComment().PageID); } } }
/// <summary> /// 账单明细 /// </summary> public void AccountDetail(int first, string accWays, DateTime?sd, DateTime?ed) { int rows = 10; int count = 0; PropertyBag["cur_page_account"] = true; U_UserInfo logonUser = base.GetUser(); Service.Bll.Order.AccountLogBLL abll = new TMM.Service.Bll.Order.AccountLogBLL(); PropertyBag["sumIncome"] = abll.SumIncome(logonUser.UserId); //可用余额 Service.Bll.User.MAccountBLL accBll = new TMM.Service.Bll.User.MAccountBLL(); PropertyBag["acc"] = accBll.GetByUserId(logonUser.UserId); int[] accountWays = null; if (accWays == "receipt") { accountWays = new int[] { (int)AmountWay.In, (int)AmountWay.INCOME, (int)AmountWay.MIn, (int)AmountWay.INCOME_TG }; } if (accWays == "payout") { accountWays = new int[] { (int)AmountWay.Out, (int)AmountWay.ROut }; } IList <AccountLog> list = abll.GetList(logonUser.UserId, accountWays, sd, ed, first, rows, out count); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; PropertyBag["sd"] = sd; PropertyBag["ed"] = ed; }
/// <summary> /// 我的收藏 /// </summary> public void MyFav(int first, int?favCataId) { int rows = 10; PropertyBag["cur_page_fav"] = true; UserService us = Context.GetService <UserService>(); U_UserInfo logonUser = base.GetUser(); int count = 0; IList <MFavorite> list = us.MFavoriteBll.GetListByUserId(first, rows, out count, logonUser.UserId, favCataId); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; //未分类文档总数 PropertyBag["unCatalogDocCount"] = us.MFavoriteBll.GetCataDocCount(logonUser.UserId, 0); //我的文件夹列表 PropertyBag["folders"] = us.MCatalogBll.GetListByUser(logonUser.UserId, 2); if (favCataId.HasValue) { if (favCataId.Value != 0) { MCatalog mc = us.MCatalogBll.Get(favCataId.Value); PropertyBag["mc"] = mc; } } }
public async Task Produces_200Ok() { var templateId = Guid.NewGuid(); var page = 1; var pageSize = 1; var ct = CancellationToken.None; var templateVersions = Builder <TemplateVersion> .CreateListOfSize(2).Build() as List <TemplateVersion>; var templateVersionListItems = Builder <TemplateVersionListItem> .CreateListOfSize(2).Build() as List <TemplateVersionListItem>; var templateVersionsPage = new Page <TemplateVersion>(2, templateVersions); var templateVersionListItemsPage = new ListPage <TemplateVersionListItem>(2, templateVersionListItems); _templateManager.Setup(x => x.GetTemplateVersionsPage(templateId, page, pageSize, ct)) .ReturnsAsync(templateVersionsPage) .Verifiable(); _mapper.Setup(x => x.Map <List <TemplateVersionListItem> >(templateVersions)) .Returns(templateVersionListItems) .Verifiable(); var result = await _controller.GetTemplateVersions(templateId, page, pageSize, ct) as OkObjectResult; result.Value.Should().BeEquivalentTo(templateVersionListItemsPage); _templateManager.Verify(); _mapper.Verify(); }
/// <summary> /// 我的文档 /// </summary> public void MyDoc(int first, string keyword, int?userCataId) { PropertyBag["cur_page_index"] = true; int rows = 10; PropertyBag["cur_page_index"] = true; UserService us = Context.GetService <UserService>(); U_UserInfo logonUser = base.GetUser(); int count = 0; IList <DDocInfo> list = us.DocInfoBll.GetListByUser(logonUser.UserId, out count, first, rows, keyword, userCataId, null); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; //总文档量 PropertyBag["allDocCount"] = count; //未分类文档总数 PropertyBag["unCatalogDocCount"] = us.DocInfoBll.GetCataDocCount(logonUser.UserId, 0); //总浏览量 PropertyBag["allViewCount"] = us.DocInfoBll.GetViewCount(logonUser.UserId); //我的文件夹列表 PropertyBag["folders"] = us.MCatalogBll.GetListByUser(logonUser.UserId, 1); if (userCataId.HasValue) { if (userCataId.Value != 0) { MCatalog mc = us.MCatalogBll.Get(userCataId.Value); PropertyBag["mc"] = mc; } } RenderView("mydoc"); }
public ListPage <OrderCloudIntegrationsConversionRate> Filter(ListArgs <OrderCloudIntegrationsConversionRate> rateArgs, OrderCloudIntegrationsExchangeRate rates) { if (rateArgs.Filters?.Any(filter => filter.PropertyName == "Symbol") ?? false) { rates.Rates = ( from rate in rates.Rates from s in rateArgs.Filters.FirstOrDefault(r => r.PropertyName == "Symbol")?.FilterValues where rate.Currency == s.Term.To <CurrencySymbol>() select rate).ToList(); } var list = new ListPage <OrderCloudIntegrationsConversionRate>() { Meta = new ListPageMeta() { Page = 1, PageSize = 1, TotalCount = rates.Rates.Count, ItemRange = new[] { 1, rates.Rates.Count } }, Items = rates.Rates }; return(list); }
public void HomePage(int userId, int first, int?cateId) { CancelLayout(); int rows = 10; try { UserService us = Context.GetService <UserService>(); PropertyBag["homeUser"] = us.UserInfoBll.Get(userId); //个人文件夹 PropertyBag["folders"] = us.MCatalogBll.GetListByUser(userId, 1); //文档总数 int docCount = 0; //文档列表 IList <DDocInfo> docList = us.DocInfoBll.GetListByUser(userId, out docCount, first, rows, null, cateId, true); ListPage lp = new ListPage((IList)docList, first, rows, docCount); PropertyBag["docList"] = lp; PropertyBag["allDocCount"] = docCount; //总浏览量 PropertyBag["allViewCount"] = us.DocInfoBll.GetViewCount(userId); //收藏文档列表 int favCount = 0; PropertyBag["favList"] = us.MFavoriteBll.GetListByUserId(0, 10, out favCount, userId, null); PropertyBag["favCount"] = favCount; } catch (Exception ex) { Utils.Log4Net.Error(ex); } }
private void OnCategoryParseDone(ListPage listPage) { if (CategoryParseDone != null) { CategoryParseDone(listPage); } }
private void Execute(PageBase page) { //标记为采集中 page.SnifferState = SnifferState.Working; //Console.WriteLine("开始处理\t" + page.Config.Url); if (page.IsListPage) { ListPage listPage = page as ListPage; ExecuteListPage(listPage); } else { #region 详细页处理逻辑 DetailPage detailPage = page as DetailPage; //详细页处理 ExcuteDetailPage(detailPage); #endregion } OnPageDoneEventHandler?.Invoke(page, Context); if (page.Config.Plug != null) { page.Config.Plug.OnPageDoneEventHandler(page, Context); } }
public JsonResult SeachList(string name, int page, int pageSize) { //string name = Request.Form["name"]; ListPage lp = new ListPage(); UserInfoBll uBll = new UserInfoBll(); page = page <= 0 ? 1 : page; //索引页 int iPageIndex = page - 1; //总记录数量 int count = 0; var list = uBll.SearchByList(name.Trim(), ref count).Skip(iPageIndex * pageSize).Take(pageSize).ToList(); pageSize = pageSize == 0 ? count : pageSize; int pageCount = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; //lp.PageSize = pageSize; lp.CurrentPage = page; lp.TotalRecord = count; lp.PageCount = pageCount; lp.Data = list; return(Json(lp)); }
static void Main(string[] args) { Console.WriteLine("商铺采集小程序,管理员QQ 592955699!"); var shopConfig = ShopConfig.LoadConfig(); Console.WriteLine($"商铺账号:{shopConfig.Account}"); Console.WriteLine($"文件地址:{shopConfig.SavePath}"); //注册编码(放在将要指定编码,进行文件解析前) Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); SnifferContext snifferContext = new SnifferContext(); PageConfigManager pageConfigManager = new PageConfigManager(); String path = AppContext.BaseDirectory + "PageConfigs\\ShopConfig.xml"; var configs = pageConfigManager.LoadConfig(path); foreach (var item in configs) { Console.WriteLine($"商铺地址:{item.Url}"); if (item.PageType == PageType.DetailPage) { DetailPage rootDetailPage = new DetailPage(null, item); snifferContext.AddToWaitPages(rootDetailPage); } else { ListPage rootListPage = new ListPage(null, item); snifferContext.AddToWaitPages(rootListPage); Console.WriteLine($"采集页数:{rootListPage.ListPageConfig.MaxPage}"); } } SnifferManager sniffer = new SnifferManager(snifferContext); sniffer.OnPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnPageDoneEventHandler\t\t{page.Url}"); Console.WriteLine($"待处理页面 {context.GetWaitPageCount()} 个"); }; sniffer.OnRootPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnRootPageDoneEventHandler\t{page.Url}"); }; sniffer.OnListUrlPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnListUrlPageDoneEventHandler\t{page.Url}"); }; sniffer.OnListPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnListPageDoneEventHandler\t{page.Url}"); }; //详细页采集完毕,组合生成url待下载 sniffer.OnDetailPageDoneEventHandler = (page, context) => { //Console.WriteLine($"OnDetailPageDoneEventHandler\t{page.Url}"); }; sniffer.Execute(); }
public static PromotionData BuildPromoFields(ListPage <OrderPromotion> promotions, ReportTypeEnum reportType, string supplierID = null, List <HSLineItem> discountedLineItems = null) { var uniquePromotions = promotions.Items.GroupBy(promotion => promotion.Code).Select(promo => promo.First()); if (reportType == ReportTypeEnum.PurchaseOrderDetail) { var supplierRelatedPromotions = new List <OrderPromotion>(); foreach (var promo in uniquePromotions) { if (!promo.LineItemLevel) { supplierRelatedPromotions.Add(promo); continue; } if (promo.xp?.Supplier == supplierID) { supplierRelatedPromotions.Add(promo); continue; } foreach (var sku in promo.xp?.SKUs) { if (discountedLineItems.Any(line => line.ProductID == sku && line.SupplierID == supplierID)) { supplierRelatedPromotions.Add(promo); } } } uniquePromotions = supplierRelatedPromotions; } var reportFormattedPromoData = new PromotionData(); foreach (var promo in uniquePromotions) { var delimiter = ""; if (reportFormattedPromoData.PromoCode != null) { delimiter = " | "; } // Promotions always have values for these fields reportFormattedPromoData.PromoCode += delimiter + promo.Code; reportFormattedPromoData.SupplierSpecific += delimiter + promo.xp?.ScopeToSupplier.ToString().ToLower(); reportFormattedPromoData.OrderLevelPromo += delimiter + (!promo.LineItemLevel).ToString().ToLower(); reportFormattedPromoData.LineItemLevelPromo += delimiter + promo.LineItemLevel.ToString().ToLower(); if (reportFormattedPromoData.PromoSupplierName == null) { delimiter = ""; } // Field could be null reportFormattedPromoData.PromoSupplierName += delimiter + promo.xp?.Supplier; } return(reportFormattedPromoData); }
// get list page public static List <int> ListPageInData() { if (ListPage == null) { return(new List <int>()); } return(ListPage.ToList()); }
public override void Clear() { modCount += 1; root.prune(); root = new ListPage(Storage); nElems = 0; Modify(); }
public static List <string> GetSupplierInfo(ListPage <HSLineItem> lineItems) { var supplierList = lineItems?.Items?.Select(item => item.SupplierID) .Distinct() .ToList(); return(supplierList); }
public ListGump10(Mobile m, int page) : base(m, 100, 100) { c_ListPage = (ListPage)page; m.CloseGump(typeof(ListGump10)); Override = true; }
public ListGump20(Mobile m, int page) : base(m, 100, 100) { c_ListPage = (ListPage)page; m.CloseGump(typeof(ListGump20)); Override = true; }
public void CheckAllBlocks( [ValueSource(typeof(MibBrowserDataSource), MibBrowserDataSource.ALL_BROWSER)] BrowserName browser, [Values(MibUserType.Administrators, MibUserType.OBAdministrator, MibUserType.AdministratorsReadOnly, MibUserType.OBAdministratorReadOnly, MibUserType.LiveTVReadOnly)] MibUserType userType) { ListPage.NavigateByMenu(); ListPage.SelectRowInListPage(); _editPage = new ChannelMaps1EditPage(ListPage); CheckPageBlocks(_allBlocksList, _editPage); }
public ChatListGump( byte page, ListPage pageType, Mobile client ) : base( 10, 10 ) { _currentPage = Math.Max( page, (byte)1 ); _pageType = pageType; _client = client; ChatInfo info = ChatManager.GetInfo( client ); bool hasNextPage = false; List<Mobile> userList = ChatManager.GatherUsers( _currentPage, pageType, client, out hasNextPage ); int backSize = ((userList.Count > 0 ? 55 : 50) + (21 * userList.Count)); uint onlineCount = 0; for( int i = 0; i < NetState.Instances.Count; i++ ) { if( NetState.Instances[i] != null && NetState.Instances[i].Running && NetState.Instances[i].Mobile != null ) onlineCount++; } AddPage( 1 ); AddBackground( 0, 0, 265, backSize, 9250 ); AddAlphaRegion( 15, 15, 234, 20 ); AddHtml( 15, 15, 234, 20, String.Format( "<basefont color='white'><center>{0} List - Online: {1}</center></basefont>", (pageType == ListPage.Everyone ? "User" : (pageType == ListPage.Buddy ? "Buddy" : "Ignore")), onlineCount ), false, false ); if( _currentPage > 1 ) AddButton( 215, 18, 9706, 9707, ChatManager.GetButtonId( 5, 0 ), GumpButtonType.Reply, 0 ); if( hasNextPage ) AddButton( 235, 18, 9702, 9703, ChatManager.GetButtonId( 5, 1 ), GumpButtonType.Reply, 0 ); for( int i = 0, y = 40; i < userList.Count; i++, y += 22 ) { AddAlphaRegion( 15, y, 234, 20 ); AddLabelCropped( 20, y, 200, 20, ChatManager.GetGumpNameColor( _client, userList[i] ), userList[i].RawName ); AddButton( 220, y, (info.IgnoreList.Contains( userList[i] ) ? 4002 : 4011), (info.IgnoreList.Contains( userList[i] ) ? 4004 : 4013), ChatManager.GetButtonId( 0, i ), GumpButtonType.Reply, 0 ); } AddButton( 15, (backSize + 3), 4008, 4010, ChatManager.GetButtonId( (int)ListPage.Buddy, 0 ), GumpButtonType.Reply, 0 ); AddLabel( 50, (backSize + 3), ChatManager.GumpLabelHue, String.Format( "{0} List", (pageType == ListPage.Buddy ? "User" : "Buddy") ) ); AddButton( 225, (backSize + 3), (info.Visible ? 4017 : 4005), (info.Visible ? 4019 : 4007), ChatManager.GetButtonId( (int)ListPage.Everyone, 1 ), GumpButtonType.Reply, 0 ); AddLabel( (info.Visible ? 180 : 175), (backSize + 3), (info.Visible ? ChatManager.GumpVisibleLabelHue : ChatManager.GumpInvisibleLabelHue), (info.Visible ? "Visible" : "Invisible") ); AddButton( 15, (backSize + 28), 4029, 4031, ChatManager.GetButtonId( (int)ListPage.Everyone, 2 ), GumpButtonType.Reply, 0 ); AddLabel( 50, (backSize + 28), ChatManager.GumpLabelHue, "Guild Message" ); AddButton( 225, (backSize + 28), 4002, 4004, ChatManager.GetButtonId( (int)ListPage.Ignore, 0 ), GumpButtonType.Reply, 0 ); AddLabel( 152, (backSize + 28), ChatManager.GumpLabelHue, String.Format( "{0} List", (pageType == ListPage.Ignore ? "User" : "Ignore") ) ); }
public static List<ActivityOperation> List(string select, bool IsAdministrator) { using (BaseDbContext db = new BaseDbContext()) { try { int pageSize = 5; int page = 0; IQueryable<ActivityOperation> Activity = db.ActivityOperations.Where(a => a.Enabled != false); if (IsAdministrator) { var user = db.Users.Find(HttpContext.Current.User.Identity.GetUserId()); if (select == null | select == "") { Activity = (from a in db.ActivityOperations where a.Creator.Id == user.Id orderby a.Name select a).AsQueryable(); } else { Activity = (from a in db.ActivityOperations where a.Creator.Id == user.Id && a.Name == @select orderby a.Name select a).AsQueryable(); } } else { if (select == null) { Activity = (from a in db.ActivityOperations where a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } else { Activity = (from a in db.ActivityOperations where a.Name == @select && a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } } var paginatedNews = new ListPage<ActivityOperation>(Activity, page, pageSize); return paginatedNews; } catch { return db.ActivityOperations.ToList(); } } }
public ActionResult Download(MaterialType type = MaterialType.Download, int page = 0) { int pageSize = 20; switch (type) { case MaterialType.Download: ViewBag.Title = "模板文件"; break; case MaterialType.Activity: ViewBag.Title = "活动资料"; break; default: ViewBag.Title = "模板文件"; type = MaterialType.Download; break; } var materials = new ListPage<Material>(db.Materials.Where(m => m.Type == type), page, pageSize); return View(materials); }
public HttpResponseMessage Conflicts() { ListPage<ConflictItem> page = null; Storage.Batch(accessor => { var conflicts = accessor.GetConfigurationValuesStartWithPrefix<ConflictItem>( RavenFileNameHelper.ConflictConfigNamePrefix, Paging.PageSize * Paging.Start, Paging.PageSize).ToList(); page = new ListPage<ConflictItem>(conflicts, conflicts.Count); }); return this.GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache(); }
public HttpResponseMessage Pending() { var result = new ListPage<SynchronizationDetails>(SynchronizationTask.Queue.Pending .Skip(Paging.Start) .Take(Paging.PageSize), SynchronizationTask.Queue.GetTotalPendingTasks()); return this.GetMessageWithObject(result, HttpStatusCode.OK) .WithNoCache(); }
public HttpResponseMessage Finished() { ListPage<SynchronizationReport> page = null; Storage.Batch(accessor => { var configs = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.Start, Paging.PageSize); int totalCount = 0; accessor.GetConfigNamesStartingWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.Start, Paging.PageSize, out totalCount); var reports = configs.Select(config => config.JsonDeserialization<SynchronizationReport>()).ToList(); page = new ListPage<SynchronizationReport>(reports, totalCount); }); return this.GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache(); }
public ActionResult List(ArticleClass articleClass=ArticleClass.News,int pageSize=10,int page=0) { var model = new ListPage<Article>(db.Articles.Where(a => a.Class == articleClass), page, pageSize); return View(model); }
public ActionResult VoiceNews(int page=0) { int pageSize = 20; var articles = new ListPage<Article>(db.Articles, page, pageSize); return View(articles); }
protected void Page(object o) { if (!(o is ListPage)) return; c_ListPage = (ListPage)o; NewGump(); }
protected override void BuildGump() { if (c_ListPage == ListPage.Channel && Data.GetData(Current).CurrentChannel == null) c_ListPage = ListPage.All; int width = Data.GetData(Current).QuickBar ? 250 : 200; int y = 10; int perpage = 10; int bar = width - 18; if (c_ListPage == ListPage.Mail || (c_ListPage == ListPage.Channel && (Data.GetData(Current).CurrentChannel is Guild || Data.GetData(Current).CurrentChannel is Faction))) perpage /= 2; if (c_Search) ShowSearch(width); ArrayList list = GetList(); SearchFilter(list); list.Sort(new InternalSort(this)); if (c_Page != 0) AddButton(width / 2 - 10, y - 5, 0x15E0, 0x15E4, "Page Down", new GumpCallback(PageDown)); if (c_Target != null) { AddHtml(0, y += 25, width, "<CENTER>" + General.Local(224) + " " + c_Target.RawName); AddButton(width / 2 - 80, y, 0x5686, "Clear Viewing", new GumpCallback(ClearViewing)); AddButton(width / 2 + 65, y, 0x5686, "Clear Viewing", new GumpCallback(ClearViewing)); } y += 5; for (int i = c_Page * perpage; i < (c_Page + 1) * perpage && i < list.Count; ++i) { if (list[i] is string) { if (list[i].ToString().IndexOf("@") == 0) list[i] = list[i].ToString().Substring(1, list[i].ToString().Length - 1); AddHtml(35, y += 20, width - 35, list[i].ToString()); AddButton(width - 40, y, Data.GetData(Current).IrcIgnores.Contains(list[i].ToString()) ? 0x5687 : 0x5686, "Ignore IRC", new GumpStateCallback(IgnoreIrc), list[i]); } else if(list[i] is Mobile) { AddHtml(35, y += 20, width - 35, ColorFor((Mobile)list[i]) + ((Mobile)list[i]).RawName + StatusFor((Mobile)list[i])); if(Current == Owner && Data.GetData(Owner).NewMsgFrom((Mobile)list[i])) AddButton(20, y, 0x1523, "Check Msg", new GumpStateCallback(CheckMsg), (Mobile)list[i]); else AddButton(20, y + 3, 0x2716, "Profile", new GumpStateCallback(Profile), (Mobile)list[i]); if (c_ListPage == ListPage.Channel && Data.GetData(Current).CurrentChannel is Guild) AddHtml(35, y += 20, width - 35, ((Mobile)list[i]).GuildTitle); else if (c_ListPage == ListPage.Channel && Data.GetData(Current).CurrentChannel is Faction) AddHtml(35, y += 20, width - 35, General.FactionTitle((Mobile)list[i])); if (list[i] != Current && Data.GetData(Current).QuickBar) { bar = width - 18; if (Current.AccessLevel > ((Mobile)list[i]).AccessLevel) { if (Data.GetData(Current).GlobalAccess) { if (Data.GetData(Current).Global) { AddButton(bar -= 12, y + 3, 0x13A8, "Mini Ignore", new GumpStateCallback(GIgnore), list[i]); AddLabel(bar + 4, y, Data.GetData(Current).GIgnores.Contains(list[i]) ? 0x44 : 0x26, "I"); } else { AddButton(bar -= 12, y + 3, 0x13A8, "Mini Listen", new GumpStateCallback(GListen), list[i]); AddLabel(bar + 4, y, Data.GetData(Current).GListens.Contains(list[i]) ? 0x44 : 0x26, "L"); } } AddButton(bar -= 12, y + 3, 0x13A8, "Mini Ban", new GumpStateCallback(Ban), list[i]); AddLabel(bar + 4, y, Data.GetData((Mobile)list[i]).Banned ? 0x44 : 0x26, "b"); } if (Current.AccessLevel >= AccessLevel.GameMaster && ((Mobile)list[i]).NetState != null) { AddButton(bar -= 12, y + 3, 0x13A8, "Mini Goto", new GumpStateCallback(Goto), list[i]); AddLabel(bar + 3, y - 2, 0x47E, "g"); AddButton(bar -= 12, y + 3, 0x13A8, "Mini Client", new GumpStateCallback(Client), list[i]); AddLabel(bar + 3, y - 2, 0x47E, "c"); } if (Chat3.Message.CanMessage(Current, (Mobile)list[i])) { AddButton(bar -= 12, y + 3, 0x13A8, "Mini Message", new GumpStateCallback(Message), list[i]); AddLabel(bar + 3, y - 2, 0x47E, "m"); } AddButton(bar -= 12, y + 3, 0x13A8, "Mini Ignore", new GumpStateCallback(Ignore), list[i]); AddLabel(bar + 5, y - 1, Data.GetData(Current).Ignores.Contains(list[i]) ? 0x44 : 0x26, "i"); AddButton(bar -= 12, y + 3, 0x13A8, "Mini Friend", new GumpStateCallback(Friend), list[i]); AddLabel(bar + 3, y, Data.GetData(Current).Friends.Contains(list[i]) ? 0x44 : 0x26, "f"); } } else if (list[i] is Message) { Message msg = (Message)list[i]; AddHtml(45, y += 20, width-85, ColorFor(msg) + (msg.Read ? "" : "<B>") + msg.Subject, false); AddHtml(45, y += 16, width-85, General.Local(60) + " " + msg.From.RawName); AddButton(20, y - 10, 0x2716, "Open", new GumpStateCallback(Open), (Message)list[i]); AddButton(width - 40, y - 10, 0x5686, 0x5687, "Delete", new GumpStateCallback(Delete), (Message)list[i]); } else if (list[i] is Notification) { Notification not = (Notification)list[i]; AddHtml(45, y += 20, width-85, ColorFor(not) + not.Name); AddButton(20, y + 3, 0x2716, "Edit Notif", new GumpStateCallback(EditNotif), (Notification)list[i]); AddButton(width - 40, y + 3, 0x5686, 0x5687, "Delete", new GumpStateCallback(Delete), (Notification)list[i]); } if (i + 1 < list.Count && i + 1 < (c_Page+1)*perpage) AddBackground(50, y + 18, width - 100, 3, 0x13BE); } if (c_ListPage == ListPage.Mail && Current.AccessLevel >= AccessLevel.GameMaster) { AddHtml(0, y += 25, width, "<CENTER>" + General.Local(95), false); AddButton(width / 2 - 50, y + 3, 0x2716, "Broadcast", new GumpCallback(Broadcast)); AddButton(width / 2 + 40, y + 3, 0x2716, "Broadcast", new GumpCallback(Broadcast)); AddHtml(0, y += 20, width, "<CENTER>" + General.Local(257), false); AddButton(width / 2 - 50, y + 3, 0x2716, "Staff", new GumpCallback(BroadcastStaff)); AddButton(width / 2 + 40, y + 3, 0x2716, "Staff", new GumpCallback(BroadcastStaff)); } else if (c_ListPage == ListPage.Notifications) { AddHtml(0, y += 25, width, "<CENTER>" + General.Local(270), false); AddButton(width / 2 - 70, y + 3, 0x2716, "New Notif", new GumpCallback(NewNotif)); AddButton(width / 2 + 60, y + 3, 0x2716, "New Notif", new GumpCallback(NewNotif)); } if (perpage * (c_Page + 1) < list.Count) AddButton(width / 2 - 10, y+=25, 0x15E2, 0x15E6, "Page Up", new GumpCallback(PageUp)); if (c_ListPage == ListPage.Mail) AddHtml(0, y += 20, width, "<CENTER>" + Data.GetData(Owner).Messages.Count + " / " + Data.MaxMsgs); else if(c_ListPage != ListPage.Notifications) { ArrayList states = new ArrayList(Server.Network.NetState.Instances); foreach (Server.Network.NetState state in Server.Network.NetState.Instances) if (state.Mobile != null && state.Mobile.AccessLevel != AccessLevel.Player) states.Remove(state); AddHtml(0, y += 20, width, "<CENTER>" + states.Count + " " + General.Local(19)); } if (c_Menu) y = ShowFullMenu(y, width); else { AddButton(33+(50/2), (y += 25)+3, 0x29F6, "Full List", new GumpCallback(FullList)); AddHtml(40, y, 50, "<CENTER>" + GetTitle()); AddButton(10, y, c_Menu ? 0x15E0 : 0x15E2, c_Menu ? 0x15E4 : 0x15E6, "Menu", new GumpCallback(Menu)); } AddButton(width- 110, y, 0x5689, "Help", new GumpCallback(Help)); AddButton(width - 95, y, 0x5689, "Profile", new GumpStateCallback(Profile), Current); AddLabel(width - 92, y-1, 0x47E, "P"); AddButton(width - 80, y, 0x5689, "Options", new GumpCallback(Options)); AddLabel(width - 77, y-1, 0x47E, "O"); AddButton(width - 65, y, 0x5689, "Status", new GumpCallback(Status)); AddLabel(width - 62, y-1, Data.GetData(Current).Status == OnlineStatus.Online ? 0x47E : 0x34, "A"); AddButton(width - 50, y, 0x5689, "QuickBar", new GumpCallback(QuickBar)); AddLabel(width - 47, y-1, Data.GetData(Current).QuickBar ? 0x34 : 0x47E, "Q"); AddButton(width - 35, y, 0x5689, "Search", new GumpCallback(Search)); AddLabel(width - 32, y-1, c_Search ? 0x34 : 0x47E, "S"); AddBackgroundZero(0, 0, width, y + 20, Data.GetData(Current).DefaultBack); }
public ActionResult VoiceNews(int page = 0) { int pageSize = 20; var news = db.Articles.Where(a => a.Status == ArticleStatus.Enabled && a.Class == ArticleClass.News).OrderByDescending(a => a.Time); var articles = new ListPage<Article>(news, page, pageSize); return View(articles); }
public ActionResult CompanyIdentityRecords(int page = 0) { var company = new ListPage<Company>(db.Companys.Where(i => i.Status == CompanyStatus.ToApprove), page, pageSize); return View(company); }
public ActionResult ProjectIdentityRecords(int page = 0) { var project = new ListPage<Project>(db.Projects.Where(i => i.Status == ProjectStatus.ToApprove), page, pageSize); return View(project); }
public ActionResult IdentityRecords(int page = 0) { var user = new ListPage<IdentityRecord>(db.IdentityRecords.Where(i => i.Status == IdentityStatus.ToApprove), page, pageSize); return View("IdentityRecords", user); }
//5 Views #region 上传文件模块 // GET: Materials public ActionResult Materials(int page = 0) { IListPage test = new Material(); var model = new ListPage<Material>(db.Materials.Where(m => m.Type == MaterialType.Activity || m.Type == MaterialType.Download || m.Type == MaterialType.Slider), page, pageSize); //实现分页功能 return View(model); }
public ActionResult TeamMember(int page = 0) { if (Extensions.GetContextUser(db).TeamRecord == null) return RedirectToAction("Index", new { Message = ManageMessageId.AcessDenied }); Team team = db.Users.Find(Extensions.GetUserId()).TeamRecord.Team; if (team == null) return RedirectToAction("Index", new { Message = ManageMessageId.AcessDenied }); int pageSize = 10; var teamMember = team.Member.Where(m => m.Status == TeamMemberStatus.Normal | m.Status == TeamMemberStatus.Admin); var list = new ListPage<TeamRecord>(teamMember, page, pageSize); return View(list); }
public static List<RoomOperation> List(string select, bool IsTeacher) { using (BaseDbContext db = new BaseDbContext()) { try { //模拟触发器 foreach (RoomOperation roomOperation in db.RoomOperations) { if (DateTime.Now > roomOperation.EndTime) { roomOperation.StartTime.AddDays(7.0); roomOperation.EndTime.AddDays(7.0); roomOperation.Usable = true; } } db.SaveChanges(); int pageSize = 5; int page = 0; IQueryable<RoomOperation> Room = db.RoomOperations.Where(a => a.Enabled != false); if (IsTeacher) { var user = db.Users.Find(HttpContext.Current.User.Identity.GetUserId()); if (select == null | select == "") { Room = (from a in db.RoomOperations where a.Creator.Id == user.Id orderby a.Name select a).AsQueryable(); } else { Room = (from a in db.RoomOperations where a.Creator.Id == user.Id && a.Name == @select orderby a.Name select a).AsQueryable(); } } else { if (select == null) { Room = (from a in db.RoomOperations where a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } else { Room = (from a in db.RoomOperations where a.Name == @select && a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } } var paginatedNews = new ListPage<RoomOperation>(Room, page, pageSize); return paginatedNews; } catch { return db.RoomOperations.ToList(); } } }
private void Page(object obj) { c_ListPage = (ListPage)obj; NewGump(); }
protected void ViewChannel(object o) { if (!(o is Channel)) return; Data.GetData(Current).CurrentChannel = (Channel)o; c_ListPage = ListPage.Channel; NewGump(); }
public HttpResponseMessage Conflicts() { ListPage<ConflictItem> page = null; Storage.Batch(accessor => { var conflicts = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.ConflictConfigNamePrefix, Paging.PageSize*Paging.Start, Paging.PageSize) .Select(config => config.AsObject<ConflictItem>()) .ToList(); page = new ListPage<ConflictItem>(conflicts, conflicts.Count); }); return Request.CreateResponse(HttpStatusCode.OK, page); }
public void Given_no_elements_exist_on_the_page_that_match_the_search() { Page = Host.Instance.NavigateToInitialPage<HomePage>() .GoToListPage(); }
public ActionResult TeamAccess(int page = 0) { if (IllegalIdentity()) return RedirectToAction("Index", new { Message = ManageMessageId.AcessDenied }); int pageSize = 10; var list = new ListPage<User>((from u in db.TeamRecords where u.Team.Admin.Id == Extensions.GetContextUser(db).Id && //团队管理为该用户的团队 u.Status == TeamMemberStatus.Apply //状态为申请 select u.Receiver), page, pageSize); return View(list); }
public ChatListGump( ListPage pageType, Mobile user ) : this( 1, pageType, user ) { }
public static List<CourseOperation> List(string select, bool IsTeacher,User user) { using (BaseDbContext db = new BaseDbContext()) { try { int pageSize = 5; int page = 0; IQueryable<CourseOperation> Course = db.CourseOperations.Where(a => a.Enabled != false); if (IsTeacher) { user = db.Users.Find(user.Id); if (select == null | select == "") { Course = (from a in db.CourseOperations where a.Creator.Id == user.Id orderby a.Name select a).AsQueryable(); } else { Course = (from a in db.CourseOperations where a.Creator.Id == user.Id && a.Name == @select orderby a.Name select a).AsQueryable(); } } else { if (select == null) { Course = (from a in db.CourseOperations where a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } else { Course = (from a in db.CourseOperations where a.Name == @select && a.StartTime > DateTime.Now orderby a.Time select a).AsQueryable(); } } var paginatedNews = new ListPage<CourseOperation>(Course, page, pageSize); return paginatedNews; } catch { return null; } } }
public HttpResponseMessage Finished() { ListPage<SynchronizationReport> page = null; Storage.Batch(accessor => { var configs = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.PageSize*Paging.Start, Paging.PageSize); var reports = configs.Select(config => config.AsObject<SynchronizationReport>()).ToList(); page = new ListPage<SynchronizationReport>(reports, reports.Count); }); return Request.CreateResponse(HttpStatusCode.OK, page); }
public ActionResult TeamApply(int page = 0) { if (Extensions.GetContextUser(ref db).TeamRecord != null) return RedirectToAction("Index", new { Message = ManageMessageId.AcessDenied }); int pageSize = 10; var list = new ListPage<Team>(db.Teams.Where(u => u.Searchable == true), page, pageSize); return View(list); }
public ActionResult TeamRecruit(int page = 0) { if (!IsTeamAdmin()) return RedirectToAction("Index", new { Message = ManageMessageId.AcessDenied }); int pageSize = 10; var list = new ListPage<User>(db.Users.Where(u => u.Profile.Searchable == true), page, pageSize); return View(list); }
//5 Views #region 上传文件模块 // GET: Materials public ActionResult Materials(int page = 0) { IListPage test = new Material(); var model = new ListPage<Material>(db.Materials, page, pageSize); //实现分页功能 return View(model); }