public void AddTable(int numOfTable) { double width = this.RenderSize.Width; double height = this.RenderSize.Height; double pading = 10; double padingTop = height > 0 ? pading / height : 0; double padingLeft = width > 0 ? pading / width : 0; double x = padingLeft; double y = padingTop; double dCol = Math.Sqrt(numOfTable); int column = (int)dCol; if (dCol > column) { column++; } double dRow = (double)numOfTable / column; int row = (int)dRow; if (dRow > row) { row++; } int total = 0; int itemRow = 0; double itemWidth = column > 0 ? (1 - (column + 1) * padingLeft) / column : 0; double itemHeight = row > 0 ? (1 - (row + 1) * padingTop) / row : 0; for (int i = 0; i < row; i++) { itemRow = numOfTable - total; if (itemRow > column) { itemRow = column; } total += itemRow; x = (1 - itemWidth * itemRow - padingLeft * (itemRow + 1)) / 2; x += padingLeft; for (int j = 0; j < itemRow; j++) { Data.BAN ban = new Data.BAN(); ban.BanID = 0; ban.TenBan = String.Format("{0}", i * column + j + 1); ban.KhuID = _Khu.KhuID; ban.LocationX = (decimal)x; ban.LocationY = (decimal)y; ban.Width = (decimal)itemWidth; ban.Height = (decimal)itemHeight; ban.Visual = true; ban.Deleted = false; ban.Hinh = null; this.AddTable(ban); x += itemWidth + padingLeft; } y += itemHeight + padingTop; } }
public void AddTable(Data.BAN ban) { POSButtonTable tbl = new POSButtonTable(ban, gridFloorPlan);; tbl.IsEnabled = true; tbl._IsEdit = this._IsEdit; tbl.TableDraw(mBOBan._CAIDATBAN); tbl.Click += new RoutedEventHandler(tbl_Click); gridFloorPlan.Children.Add(tbl); }
private void cboBan1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboBan1.SelectedItem != null) { Data.BAN ban = (Data.BAN)cboBan1.SelectedItem; mBOChuyenBan.LoadBanHang(ban); lvData.ItemsSource = mBOChuyenBan._BanHang._ListChiTietBanHang; } else { lvData.ItemsSource = null; } }
private void cboBan1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboBan1.SelectedItem != null) { Data.BAN ban = (Data.BAN)cboBan1.SelectedItem; Data.BOBanHang banhang = mBOGopBan.GetBanHang(ban); lvData1.ItemsSource = banhang._ListChiTietBanHang; lvData1.Tag = banhang; } else { lvData1.ItemsSource = null; } }
private void btnThemMoi_Click(object sender, RoutedEventArgs e) { if (cboKhuVuc.SelectedIndex >= 0) { Data.BAN ban = new Data.BAN(); ban.BanID = 0; ban.TenBan = "Ban Moi"; ban.KhuID = (int)cboKhuVuc.SelectedValue; ban.LocationX = 0; ban.LocationY = 0; ban.Width = uCFloorPlan1._CAIDATBAN.TableWidth; ban.Height = uCFloorPlan1._CAIDATBAN.TableHeight; ban.Visual = true; ban.Deleted = false; ban.Hinh = null; uCFloorPlan1.AddTable(ban); } }
private void btnDongY_Click(object sender, RoutedEventArgs e) { if (cboBan1.SelectedItem == null) { UserControlLibrary.WindowMessageBox.ShowDialog("Vui lòng chọn bàn cần chuyển"); return; } if (cboBan2.SelectedItem == null) { UserControlLibrary.WindowMessageBox.ShowDialog("Vui lòng chọn bàn chuyển đến"); return; } if (cboBan1.SelectedItem != null && cboBan2.SelectedItem != null) { Data.BAN ban = (Data.BAN)cboBan2.SelectedItem; mBOChuyenBan.ChuyenBan(ban); LoadKhu(); mUCFloorPlan.LoadAlllStatus(); UserControlLibrary.WindowMessageBox.ShowDialog("Đã chuyển thành công !"); } }
public POSButtonTable(Data.BAN ban, Grid parent) { _ButtonTableStatus = POSButtonTableStatus.None; mBan = ban; mGrid = parent; }
public void AddTable(int numOfTable) { double width = this.RenderSize.Width; double height = this.RenderSize.Height; double pading = 10; double padingTop = height > 0 ? pading / height : 0; double padingLeft = width > 0 ? pading / width : 0; double x = padingLeft; double y = padingTop; double dCol = Math.Sqrt(numOfTable); int column = (int)dCol; if (dCol > column) column++; double dRow = (double)numOfTable / column; int row = (int)dRow; if (dRow > row) row++; int total = 0; int itemRow = 0; double itemWidth = column > 0 ? (1 - (column + 1) * padingLeft) / column : 0; double itemHeight = row > 0 ? (1 - (row + 1) * padingTop) / row : 0; for (int i = 0; i < row; i++) { itemRow = numOfTable - total; if (itemRow>column) itemRow = column; total += itemRow; x = (1-itemWidth * itemRow - padingLeft * (itemRow + 1))/2; x += padingLeft; for (int j = 0; j < itemRow; j++) { Data.BAN ban = new Data.BAN(); ban.BanID = 0; ban.TenBan = String.Format("{0}",i*column+j+1); ban.KhuID = _Khu.KhuID; ban.LocationX = (decimal)x; ban.LocationY = (decimal)y; ban.Width = (decimal)itemWidth; ban.Height = (decimal)itemHeight; ban.Visual = true; ban.Deleted = false; ban.Hinh = null; this.AddTable(ban); x += itemWidth + padingLeft; } y += itemHeight + padingTop; } }
public POSButtonTable(Data.BAN ban,Grid parent) { _ButtonTableStatus = POSButtonTableStatus.None; mBan = ban; mGrid = parent; }