private void Button_Them_Click(object sender, RoutedEventArgs e) { PHIEUHANG phieuHang = new PHIEUHANG(); if (tbMaHang.Text != "" && tbMaKhach.Text != "" && tbSoCT.Text != "" && tbSoLuong.Text != "" && tbDienGiai.Text != "" && datePicker.Text != "") { phieuHang.NGAY = datePicker.SelectedDate.Value; phieuHang.SOCHUNGTU = tbSoCT.Text; phieuHang.MAKHACHHANG = tbMaKhach.Text; phieuHang.DIENGIAI = tbDienGiai.Text; phieuHang.MAHANG = tbMaHang.Text; if (LoaiPhieu == 1) { phieuHang.SOLUONG = Int32.Parse(tbSoLuong.Text); } else { phieuHang.SOLUONG = -Int32.Parse(tbSoLuong.Text); } phieuHang.LOAIPHIEU = (byte)LoaiPhieu; // Kiểm tra dữ liệu nhập if (QUERY.KiemTraSoChungTu(phieuHang.SOCHUNGTU)) { MessageBox.Show("Số chứng từ đã tồn tại", "Thông báo"); } else if (QUERY.KiemTraMaKhachHang(phieuHang.MAKHACHHANG) == false) { MessageBox.Show("Không tồn tại mã khách hàng", "Thông báo"); } else if (QUERY.KiemTraMaHang(phieuHang.MAHANG) == false) { MessageBox.Show("Không tồn tại mã hàng", "Thông báo"); } else // Thêm phiếu hàng { INSERT.ThemPhieuHang(phieuHang); UPDATE.SuaSoLuongSanPham(phieuHang.MAHANG, (int)phieuHang.SOLUONG); MessageBox.Show("Thêm thành công", "Thông báo"); this.Close(); } } else { MessageBox.Show("Chưa nhập đủ thông tin", "Thông báo"); } }
private void Update() { UPDATE?.Invoke(); }
/// <summary> /// Constructor. Assings this button as a Buttons value /// </summary> /// <param name="Key">Buttons value to assign</param> public Button(Buttons Butt) { update = ButtonUpdate; button = Butt; }
/// <summary> /// Constructor. Assings this button as a key value /// </summary> /// <param name="Key">Key value to assign</param> public Button(Keys Key) { update = KeyUpdate; key = Key; }
public void HandleUpdate(RealmTime time) { Wmap map = Owner.Map; WmapTile tile; World world = GameServer.Manager.GetWorld(Owner.Id); int xBase = (int)X; int yBase = (int)Y; int sent = 0; HashSet <Entity> sendEntities = new HashSet <Entity>(GetNewEntities()); List <UPDATE.TileData> list = new List <UPDATE.TileData>(APPOX_AREA_OF_SIGHT); mapWidth = Owner.Map.Width; mapHeight = Owner.Map.Height; blocksight = (world.Dungeon ? Sight.RayCast(this, 15) : Sight.GetSightCircle(SIGHTRADIUS)).ToList(); foreach (IntPoint i in blocksight.ToList()) { int x = i.X + xBase; int y = i.Y + yBase; if (x < 0 || x >= mapWidth || y < 0 || y >= mapHeight || tiles[x, y] >= (tile = map[x, y]).UpdateCount) { continue; } if (!visibleTiles.ContainsKey(new IntPoint(x, y))) { visibleTiles[new IntPoint(x, y)] = true; } list.Add(new UPDATE.TileData { X = (short)x, Y = (short)y, Tile = tile.TileId }); tiles[x, y] = tile.UpdateCount; sent++; } FameCounter.TileSent(sent); int[] dropEntities = GetRemovedEntities().Distinct().ToArray(); clientEntities.RemoveWhere(_ => Array.IndexOf(dropEntities, _.Id) != -1); List <Entity> toRemove = lastUpdate.Keys.Where(i => !clientEntities.Contains(i)).ToList(); toRemove.ForEach(i => lastUpdate.TryRemove(i, out int val)); foreach (var i in sendEntities) { lastUpdate[i] = i.UpdateCount; } IEnumerable <ObjectDef> newStatics = GetNewStatics(xBase, yBase); IEnumerable <IntPoint> removeStatics = GetRemovedStatics(xBase, yBase); List <int> removedIds = new List <int>(); if (!world.Dungeon) { foreach (IntPoint i in removeStatics.ToArray()) { removedIds.Add(Owner.Map[i.X, i.Y].ObjId); clientStatic.Remove(i); } } if (sendEntities.Count <= 0 && list.Count <= 0 && dropEntities.Length <= 0 && newStatics.ToArray().Length <= 0 && removedIds.Count <= 0) { return; } UPDATE packet = new UPDATE() { Tiles = list.ToArray(), NewObjects = sendEntities.Select(_ => _.ToDefinition()).Concat(newStatics.ToArray()).ToArray(), RemovedObjectIds = dropEntities.Concat(removedIds).ToArray() }; Client.SendMessage(packet); UpdatesSend++; }