/// <summary> /// Create a new instance. /// </summary> /// <param name="entryCriteria">The <see cref="EntryCriteria"/> used for the search.</param> /// <param name="resultOrder">The order of the results.</param> public EntrySearchCacheKey(EntryCriteria entryCriteria, ListOrder resultOrder) { Assert.ArgumentNotNull(entryCriteria, nameof(entryCriteria)); EntryCriteria = entryCriteria; ResultOrder = resultOrder; }
public async void GetLateHouse(bool Latehouse) { ListItemValLate = new List <ListOrder>(); popupPriviewsTickietView = false; var TransactionNumberVal = await new loginPageService().GetDetailByUrl(BetEntry.GetTrancationNumber + GlobalConstant.iPanelUserID); if (TransactionNumberVal.Status == 1) { LastTransactionNo = TransactionNumberVal.Response.ToString(); } SB = "S"; // var UserDetail = await new loginPageService().GetDetailByUrl(BetEntry.GetHouseDetail); var UserDetail = await new loginPageService().GetDetailByUrl((Latehouse == false ? BetEntry.GetEarlyHouseForTab : BetEntry.GetLateHouseForTab)); if (UserDetail.Status == 1) { var wrShiipinglistVal = JsonConvert.DeserializeObject <List <vw_HousesDetails> >(UserDetail.Response.ToString()); for (int i = 0; i < wrShiipinglistVal.Count; i++) { Model = new ListOrder(); try { Model.Late1 = wrShiipinglistVal[i].HouseName; Model.chkLate1 = false; Model.Late1Id = wrShiipinglistVal[i].HouseID; Model.Latehouse1 = Latehouse; i++; } catch { } try { Model.Late2 = wrShiipinglistVal[i].HouseName; Model.chkLate2 = false; Model.Late2Id = wrShiipinglistVal[i].HouseID; Model.Latehouse2 = true; i++; } catch { } try { Model.Late3 = wrShiipinglistVal[i].HouseName; Model.chkLate3 = false; Model.Late3Id = wrShiipinglistVal[i].HouseID; Model.Latehouse3 = true; i++; } catch { } try { Model.Late4 = wrShiipinglistVal[i].HouseName; Model.chkLate4 = false; Model.Late4Id = wrShiipinglistVal[i].HouseID; Model.Latehouse4 = true; } catch { } ListItemValLate.Add(Model); } } }
private void button1_Click(object sender, EventArgs e) { _orderList.Clear(); _orderList = ListOrder.ShowOrders(dateFrom.SelectionStart, dateTo.SelectionStart); OnRewriteListBox(); }
/// <summary> /// 将对象转换为其 XML 表示形式。 /// </summary> /// <param name="writer">对象要序列化为的 <see cref="T:System.Xml.XmlWriter" /> 流。</param> public void WriteXml(XmlWriter writer) { writer.WriteElementString("FileName", FileName); writer.WriteElementString("FullName", FullName); writer.WriteElementString("Name", Name); writer.WriteElementString("Title", Title); writer.WriteElementString("Description", Description); writer.WriteElementString("Version", Version == null ? string.Empty : Version.ToString()); writer.WriteElementString("IsExtend", IsExtend.ToString().ToLower()); writer.WriteElementString("DisableStopAndUninstalled", DisableStopAndUninstalled.ToString().ToLower()); writer.WriteElementString("ListOrder", ListOrder.ToString()); writer.WriteElementString("State", State.ToString()); writer.WriteStartElement("Reference"); if (Reference != null) { Reference.ForEach(reference => { writer.WriteElementString("Assembly", reference); }); } writer.WriteEndElement(); writer.WriteStartElement("AbstractModules"); if (AbstractModules != null) { AbstractModules.ForEach(module => { var namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); var xmlSerializer = new XmlSerializer(module.GetType()); xmlSerializer.Serialize(writer, module, namespaces); }); } writer.WriteEndElement(); }
/// <summary> /// Gets the list of entries for the specified <see cref="EntryCriteria"/>. /// </summary> /// <param name="criteria">The criteria used to search for the entries.</param> /// <param name="resultOrder">The ordering of the results.</param> /// <returns>The list of entries for the criteria, or null if the criteria has not been cached.</returns> public SearchResults <Entry> Get(EntryCriteria criteria, ListOrder resultOrder) { Assert.ArgumentNotNull(criteria, nameof(criteria)); var key = new EntrySearchCacheKey(criteria, resultOrder); return((SearchResults <Entry>)_cache.GetValue(key)); }
private async void DeleteOrder(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa hóa đơn này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (await oh_repo.Remove((int)obj)) { dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListOrder.Remove(ListOrder.SingleOrDefault(t => t.PurID == (int)obj)); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
/// <summary> /// Sets the list of entries for the specified <see cref="EntryCriteria"/>. /// </summary> /// <param name="criteria">The criteria used to search for the entries.</param> /// <param name="resultOrder">The ordering of the results.</param> /// <param name="entries">The entries for the search criteria.</param> public void Set(EntryCriteria criteria, ListOrder resultOrder, SearchResults <Entry> entries) { Assert.ArgumentNotNull(criteria, nameof(criteria)); Assert.ArgumentNotNull(entries, nameof(entries)); var key = new EntrySearchCacheKey(criteria, resultOrder); _cache.Add(key, entries); }
public List <Product> GetProductList(string currencyName, ListOrder order, bool desc) { if (CurrencyManager.Exchange(currencyName, 1.0d) == null) { // Currency is not exist return(null); } var query = lawnmowerRepo.GetAll().Select(x => new Product() { Id = x.Id, Price = (double)CurrencyManager.Exchange(currencyName, x.Price), Name = x.Name, Type = "Lawnmower" }) .Union( phonecaseRepo.GetAll().Select(x => new Product() { Id = x.Id, Price = (double)CurrencyManager.Exchange(currencyName, x.Price), Name = x.Name, Type = "Phone Case" })) .Union( tshirtRepo.GetAll().Select(x => new Product() { Id = x.Id, Price = (double)CurrencyManager.Exchange(currencyName, x.Price), Name = x.Name, Type = "T-Shirt" }) ); switch (order) { case ListOrder.Id: return(desc ? query.OrderByDescending(x => x.Id).ToList() : query.OrderBy(x => x.Id).ToList()); case ListOrder.Name: return(desc ? query.OrderByDescending(x => x.Name).ToList() : query.OrderBy(x => x.Name).ToList()); case ListOrder.Price: return(desc ? query.OrderByDescending(x => x.Price).ToList() : query.OrderBy(x => x.Price).ToList()); case ListOrder.Type: return(desc ? query.OrderByDescending(x => x.Type).ToList() : query.OrderBy(x => x.Type).ToList()); default: return(query.ToList()); } }
/// <summary> /// Create list create operation. /// Server creates list at given context level. The context is allowed to be beyond list /// boundaries only if pad is set to true. In that case, nil list entries will be inserted to /// satisfy the context position. /// </summary> public static Operation Create(string binName, ListOrder order, bool pad, params CTX[] ctx) { // If context not defined, the set order for top-level bin list. if (ctx == null || ctx.Length == 0) { return(SetOrder(binName, order)); } Packer packer = new Packer(); CDT.Init(packer, ctx, SET_TYPE, 1, CTX.GetFlag(order, pad)); packer.PackNumber((int)order); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
public String listAppointments(ListOrder order) { // call locally to show a list of all apointments String response = ""; int counter = 0; if (order == ListOrder.SEQUENCE) { response += "__________<< Sequential Order >>__________" + "\n"; foreach (Appointment appointment in appointmentsList) { response += appointment.ToString() + "\n"; response += "___________________________________________" + "\n"; counter++; } } else { List <Appointment> copyOfAppointmentsList = this.appointmentsList.GetRange(0, this.appointmentsList.Count); copyOfAppointmentsList.Sort( delegate(Appointment appointment1, Appointment appointment2) { return(appointment1.CompareTo(appointment2)); } ); response += "_____________<< Date Order >>_____________" + "\n"; int rowNum = 1; foreach (Appointment appointment in copyOfAppointmentsList) { response += appointment.toString(rowNum++) + "\n"; response += "___________________________________________" + "\n"; counter++; } } if (counter == 0) { response += "No appointment has been added to the system. " + "\n"; } else if (counter == 1) { response += " " + counter + " appointment has been listed in the above table. " + "\n"; } else { response += " " + counter + " appointments have been listed in the above table. " + "\n"; } return(response); }
void OnRewriteListBox() { button2.Enabled = false; listBox1.Items.Clear(); foreach (Order_v2 o in _orderList) { //string s = string.Format("{0}:{1}:{2} >{3}", o.date.ToString(), o.ID, o.number, o.estr); string s = string.Format("{0}:{1}:{2} >{3}", o.date.ToString(Form1.DATE_FORMAT), o.GiveOrder, o.ForePerson, o.estr); listBox1.Items.Add(s); } label6.Text = ListOrder.listOrder.Count.ToString(); label7.Text = _orderList.Count.ToString(); //int i=0; //foreach (Order_v2 o in ListOrder.listOrder) //if (o.number == 0) i++; label8.Text = ListOrder.NotVerifydOrderList().Count.ToString(); }
public ActionResult BulkOrder(int business_id, int personal_id, string time) { string myid = User.Identity.GetUserId(); ActiveProfile active = db.activeprofiles.ToList() .Where(x => x.ApplicationUserId == myid).FirstOrDefault(); PersonalAccount customer = db.personalaccounts.ToList().Where(x => x.ID == personal_id).FirstOrDefault(); ListOrder listorder = db.listorders.ToList() .Where(x => x.BusinessID == business_id && x.PersonalAccID == personal_id && x.Date.TimeOfDay.ToString().Substring(0, 5) == time) .FirstOrDefault(); List <ProductListOrder> productorder = db.productlistorders.ToList() .Where(x => x.ListOrderID == listorder.ID).ToList(); List <Order> orders = new List <Order>(); double total = 0; bool im_business = false; foreach (ProductListOrder p in productorder) { Order order = db.orders.ToList().Where(x => x.ID == p.OrderID).FirstOrDefault(); if (order != null) { orders.Add(order); total += order.Price * order.Qauntity; } } if (listorder.BusinessID == active.ActiveProfileID) { im_business = true; } if (listorder.BusinessID == active.ActiveProfileID && listorder.Status == "Pending") { listorder.Status = "Seen"; db.SaveChanges(); } ViewBag.ImBusiness = im_business; ViewBag.OrderID = listorder.ID; ViewBag.Status = listorder.Status; ViewBag.Total = total; ViewBag.PersonalID = personal_id; ViewBag.CustomerName = customer.Names + " " + customer.Surname; return(View(orders)); }
private async void Addsuccess(PurchasingHeader obj) { try { if (obj != null) { var newobj = await oh_repo.GetById(obj.PurID); ListOrder.Add(newobj); dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
public void UpdateOrders() { ListOrdersResponse listOrdersResponse = client.ListOrders(); if (listOrdersResponse.Result == 1 && listOrdersResponse.Orders.Count > 0) { List <Order> unshippedOrders = OrderService.GetOrders(StatusID: (int)Beasts.Model.Status.Processing).ToList(); foreach (Order order in unshippedOrders) { try { ListOrder listOrder = listOrdersResponse.Orders.Where(x => x.OrderId == order.PrintAuraID).FirstOrDefault(); if (listOrder != null) { if (listOrder.Status == Labs.PrintAura.Models.Status.Shipped) { var item = listOrder.Items.First(); Shipment shipment = new Shipment(); shipment.Tracking = item.Tracking; shipment.ShipDate = item.ShippedDate.ToDateTime(); shipment.Service = "USPS"; shipment.OrderID = order.OrderID; ShipmentService.CreateShipment(shipment); order.Status = Beasts.Model.Status.Shipped; OrderService.UpdateOrder(order); Email.SendTracking(OrderService.GetOrders(order.OrderID).FirstOrDefault()); } } } catch (Exception ex) { ExceptionService.CreateException(ex); } } } }
public static List <ListOrder> ServiceProvider(int Id) { List <ListOrder> listOrders = new List <ListOrder>(); ServicesContext db = new ServicesContext(); var SPId = db.ServiceProviders.Where(g => g.UserId == Id).Select(g => g.Id).FirstOrDefault(); var res = from a in db.Orders where SPId == a.ToFK select a; foreach (var b in res) { ListOrder OrderObj = new ListOrder { Id = b.Id, FromFK = b.FromFK, Status = b.Status, Date = b.Date, ScheduleDate = b.ScheduleDate }; listOrders.Add(OrderObj); } return(listOrders); }
private BindableCollection <Order> Get_AllOrder(int curr, int record1page) { ListOrder.Clear(); sql = $"SELECT * FROM ORDERS ORDER BY IDORDER OFFSET { curr} ROWS FETCH NEXT { record1page} ROWS ONLY"; DataTable dt = Connection.GetALL_Data(sql); foreach (DataRow row in dt.Rows) { Order order = new Order(); order.IdOrder = row["IDORDER"].ToString(); order.CustomerName = row["CUSTOMERNAME"].ToString(); order.Address = row["ADDRESS"].ToString(); order.Email = row["EMAIL"].ToString(); order.Note = row["NOTE"].ToString(); order.Total = row["TOTAL"].ToString(); order.Status = row["STATUS"].ToString(); order.Date = row["DATE"].ToString(); ListOrder.Add(order); } return(ListOrder); }
public static List <ListOrder> PreviousOrder(int orderId) { List <ListOrder> a = new List <ListOrder>(); ServicesContext db = new ServicesContext(); var res = from d in db.Orders where d.Id == orderId select d; foreach (var b in res) { ListOrder o = new ListOrder(); if (o.Status == "Completed") { o.Id = b.Id; o.FromFK = b.FromFK; o.Status = b.Status; o.Date = b.Date; o.ScheduleDate = b.ScheduleDate; a.Add(o); } } return(a); }
/// <summary> /// Gets blog entries for the given blog which meet the criteria. /// </summary> /// <param name="blogRootItem">The root item of the blog to retrieve the entries for.</param> /// <param name="criteria">The criteria the entries should meet.</param> /// <param name="resultOrder">The ordering of the results.</param> /// <returns>The entries matching the criteria.</returns> public virtual SearchResults <Entry> GetBlogEntries(Item blogRootItem, EntryCriteria criteria, ListOrder resultOrder) { if (blogRootItem == null || criteria == null || criteria.PageNumber <= 0 || criteria.PageSize <= 0) { return(SearchResults <Entry> .Empty); } var cachedEntries = EntryCache?.Get(criteria, resultOrder); if (cachedEntries != null) { return(cachedEntries); } var customBlogItem = (from templateId in Settings.BlogTemplateIds where TemplateManager.TemplateIsOrBasedOn(blogRootItem, templateId) select(BlogHomeItem) blogRootItem).FirstOrDefault(); if (customBlogItem == null) { customBlogItem = (from templateId in Settings.BlogTemplateIds let item = blogRootItem.FindAncestorByTemplate(templateId, TemplateManager) where item != null select(BlogHomeItem) item).FirstOrDefault(); } if (customBlogItem == null) { return(SearchResults <Entry> .Empty); } var blogSettings = BlogSettingsResolver.Resolve(customBlogItem); using (var context = CreateSearchContext(blogRootItem)) { var builder = PredicateBuilder.Create <EntryResultItem>(searchItem => searchItem.TemplateId == blogSettings.EntryTemplateID && searchItem.Paths.Contains(customBlogItem.ID) && searchItem.Language.Equals(customBlogItem.InnerItem.Language.Name, StringComparison.InvariantCulture) ); // Tag if (!string.IsNullOrEmpty(criteria.Tag)) { builder = builder.And(i => i.Tags.Contains(criteria.Tag)); } // Categories if (!string.IsNullOrEmpty(criteria.Category)) { var categoryItem = ManagerFactory.CategoryManagerInstance.GetCategory(customBlogItem, criteria.Category); // If the category is unknown, don't return any results. if (categoryItem == null) { return(SearchResults <Entry> .Empty); } builder = builder.And(i => i.Category.Contains(categoryItem.ID)); } if (criteria.MinimumDate != null) { builder = builder.And(i => i.EntryDate >= criteria.MinimumDate); } if (criteria.MaximumDate != null) { builder = builder.And(i => i.EntryDate <= criteria.MaximumDate); } var indexresults = context.GetQueryable <EntryResultItem>().Where(builder); if (resultOrder == ListOrder.Descending) { indexresults = indexresults.OrderByDescending(item => item.EntryDate) .ThenByDescending(item => item.CreatedDate) .ThenByDescending(item => item.Title); } else { indexresults = indexresults.OrderBy(item => item.EntryDate) .ThenBy(item => item.CreatedDate) .ThenBy(item => item.Title); } indexresults = indexresults.Skip(criteria.PageSize * (criteria.PageNumber - 1)) .Take(criteria.PageSize < int.MaxValue ? criteria.PageSize + 1 : criteria.PageSize); var entries = indexresults.Select(resultItem => // Keep field access inline so the query analyzer can see which fields will be used. new Entry { Uri = resultItem.Uri, Title = string.IsNullOrWhiteSpace(resultItem.Title) ? resultItem.Name : resultItem.Title, Tags = resultItem.Tags != null ? resultItem.Tags : Enumerable.Empty <string>(), EntryDate = resultItem.EntryDate } ).ToList(); var hasMore = entries.Count > criteria.PageSize; var entriesPage = entries.Take(criteria.PageSize).ToList(); var results = new SearchResults <Entry>(entriesPage, hasMore); EntryCache?.Set(criteria, resultOrder, results); return(results); } }
public void Remove(OrderItem item) { ListOrder.Remove(item); }
public void Add(OrderItem item) { ListOrder.Add(item); }
/// <summary> /// Lookup list by base list's index offset. If the list at index offset is not found, /// create it with the given sort order at that index offset. If pad is true and the /// index offset is greater than the bounds of the base list, nil entries will be /// inserted before the newly created list. /// </summary> public static CTX ListIndexCreate(int index, ListOrder order, bool pad) { return(new CTX(0x10 | GetFlag(order, pad), Value.Get(index))); }
internal static int GetFlag(ListOrder order, bool pad) { return((order == ListOrder.ORDERED) ? 0xc0 : pad ? 0x80 : 0x40); }
/// <summary> /// Create list with specified order when list does not exist. /// Use specified write flags when writing list items. /// </summary> public ListPolicy(ListOrder order, ListWriteFlags flags) { this.attributes = (int)order; this.flags = (int)flags; }
/// <summary> /// Create set list order operation. /// Server sets list order. Server returns null. /// </summary> public static Operation SetOrder(string binName, ListOrder order, params CTX[] ctx) { byte[] bytes = PackUtil.Pack(ListOperation.SET_TYPE, (int)order, ctx); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes))); }
/// <summary> /// Create set list order operation. /// Server sets list order. Server returns null. /// </summary> public static Operation SetOrder(string binName, ListOrder order, params CTX[] ctx) { return(CDT.CreateOperation(SET_TYPE, Operation.Type.CDT_MODIFY, binName, ctx, (int)order)); }
protected SearchResults <Model.Entry> GetEntriesCloseToEntry(EntryItem entry, ListOrder resultOrder, Action <EntryCriteria> mutator) { var blogHomeItem = BlogManager.GetCurrentBlog(entry); if (blogHomeItem == null) { return(null); } var pageSizes = new[] { 5, 50, 100, int.MaxValue }; foreach (var pageSize in pageSizes) { var criteria = new EntryCriteria { PageNumber = 1, PageSize = pageSize }; mutator.Invoke(criteria); var entries = EntryManager.GetBlogEntries(blogHomeItem, criteria, resultOrder); for (var i = 0; i < entries.Results.Count; i++) { if (entries.Results[i].Uri.ItemID == entry.ID && i < entries.Results.Count - 1) { return(entries); } } } return(null); }