private void DisplayTableInfo(TableD table) { pnInfoTable.Tag = table.IdTableD; lbNameTb.Text = "No. " + table.NameTable; if (table.Status == 0) { lbTime.Text = "Không xác định"; lbPeople.Text = "Chưa có người"; lbMoney.Text = "0 VNĐ"; } else if (table.Status == 1) { int[] bill = TableDDAO.Instance.HowManyPeople(table.IdTableD); lbPeople.Text = bill[0].ToString(); lbMoney.Text = BillDAO.Instance.GetTotalPriceByIdBill(bill[1]).ToString() + " VNĐ"; DateTime?time = BillDAO.Instance.GetTimeByidBill(bill[1]); if (time == null) { return; } else { if (time.Value.Hour < 12) { lbTime.Text = time.Value.Hour.ToString() + ":" + time.Value.Minute.ToString() + " AM"; } else { lbTime.Text = (time.Value.Hour - 12).ToString() + ":" + time.Value.Minute.ToString() + " PM"; } } } //Hien thi so nguoi , thanh toan }
public void CanFetchNestedNavPropertiesBidirectional() { var options = BuildOptions(ContextProviderType.InMemory); var factory = new RepositoryFactory(options); var repoA = factory.Create <TableA>(); var a = new TableA { Id = 99 }; repoA.Add(a); repoA.Add(new TableA { Id = 2333 }); repoA.Add(new TableA { Id = 9 }); var repoB = factory.Create <TableB>(); var b = new TableB { Id = 10, TableAId = a.Id }; repoB.Add(b); var repoC = factory.Create <TableC>(); var c = new TableC { Id = 10, TableBId = b.Id }; repoC.Add(c); var repoD = factory.Create <TableD>(); var d = new TableD { Id = 500, TableCId = c.Id }; repoD.Add(d); var queryOptions = new QueryOptions <TableA>() .WithFetch(x => x.TableB) .WithFetch(x => x.TableB.TableC) .WithFetch(x => x.TableB.TableC.TableD) .WithFilter(x => x.Id == a.Id); var result = repoA.Find(queryOptions); Assert.NotNull(result.TableB); Assert.NotNull(result.TableB.TableA); Assert.Equal(b.Id, result.TableB.Id); Assert.NotNull(result.TableB.TableC); Assert.NotNull(result.TableB.TableC.TableB); Assert.Equal(c.Id, result.TableB.TableC.Id); Assert.NotNull(result.TableB.TableC.TableD); Assert.NotNull(result.TableB.TableC.TableD.TableC); Assert.Equal(d.Id, result.TableB.TableC.TableD.Id); }
private void btnTable_Click(object sender, EventArgs e) { Button button = sender as Button; TableD table = button.Tag as TableD; // //Hiện table info // DisplayTableInfo(table); if (table.Status == 0) { ContextMenu cm = new ContextMenu(); cm.MenuItems.Add("Tạo Hóa Đơn", new EventHandler(CreateBill)); cm.Show(button, button.PointToClient(Cursor.Position)); } else { ContextMenu cm = new ContextMenu(); cm.MenuItems.Add("Xem hóa đơn", new EventHandler(SeeBill)); cm.Show(button, button.PointToClient(Cursor.Position)); } }
public void TableDInsertStatement_ShouldIncludeIdentity() { var tableD = new TableD() { FieldOne = "whatever", Id = 0 }; var db = new PostulateDb(); using (var cn = db.GetConnection()) { if (!db.Syntax.TableExists(cn, typeof(TableD))) { var ct = new CreateTable(db.Syntax, new TableInfo("TableD", "dbo", typeof(TableD))); foreach (var cmd in ct.SqlCommands(cn)) { cn.Execute(cmd); } } db.TraceCallback = (cn1, qt) => { Assert.IsTrue(qt.Sql.Equals("hello")); }; db.Save(tableD); } }