// Update SanPham Kho private void guna2GradientButton1_Click(object sender, EventArgs e) { string tensp, masp, maNCC; int soluong, dongia; if (tbSoLuong.Text == "" || tbGia.Text == "" || tbTen.Text == "" || tbMaNCC.Text == "" || tbMaSP.Text == "") { MessageBox.Show("Phải điền Đầy đủ Thông Tin", "Thông Báo", MessageBoxButtons.OK); } else { tensp = tbTen.Text; masp = tbMaSP.Text; maNCC = tbMaNCC.Text; soluong = int.Parse(tbSoLuong.Text); dongia = int.Parse(tbGia.Text); KhoDTO kho = new KhoDTO(masp, tensp, maNCC, soluong, dongia); if (editKho.UpdateSPKho(kho)) { MessageBox.Show("Update Success"); CRUD(); } else { MessageBox.Show("Update Fail,Xem Lại Mã Sản Phẩm!"); } } }
// add SP private void guna2GradientButton2_Click(object sender, EventArgs e) { string tensp, masp, maNCC; int soluong, dongia; DateTime ntn = DateTime.Now; tensp = tbTen.Text; masp = tbMaSP.Text; maNCC = tbMaNCC.Text; if (tbSoLuong.Text == "" || tbGia.Text == "") { MessageBox.Show("Không được để trống thông tin"); } else { soluong = int.Parse(tbSoLuong.Text); dongia = int.Parse(tbGia.Text); KhoDTO kho = new KhoDTO(masp, tensp, maNCC, soluong, dongia, ntn); if (editKho.AddSPKho(kho)) { MessageBox.Show("Thêm Sản Phẩm Success!"); CRUD(); } else { MessageBox.Show("Lỗi Mã SP Hoặc Chưa điền đủ thông tin !", "Thông Báo", MessageBoxButtons.OK); } } }
public bool AddSPKho(KhoDTO kho) { if (kho.Tensp == "" || kho.MaNCC == "" || kho.Masp == "" || kho.Ngaynhap == null || kho.SoLuong == null || kho.DonGia == null) { return(false); } return(KhoDAL.Instance.AddSPKho(kho)); }
//thêm kho private void navBarItem6_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { KhoDTO KhoDTO = new KhoDTO() { ConQuanLy = true }; ThemKho frm = new ThemKho(true, KhoDTO); frm.ShowDialog(); }
private void btnThem_Click(object sender, EventArgs e) { KhoDTO KhoDTO = new KhoDTO() { ConQuanLy = true }; ThemKho frm = new ThemKho(true, KhoDTO); frm.ShowDialog(); hienThi(); }
public ThemKho(bool _isAddNew1, KhoDTO KhoDTO) { InitializeComponent(); _isAddNew = _isAddNew1; txtMaKho.Text = KhoDTO.MaKho; txtTenKho.Text = KhoDTO.TenKho; txtDiaChiKho.Text = KhoDTO.DiaChiKho; txtDTKho.Text = KhoDTO.DTKho; mmGhiChu.Text = KhoDTO.ghichu; ckbConQuanLy.Checked = KhoDTO.ConQuanLy; if (!_isAddNew) { txtMaKho.Enabled = false; } }
private void SaveClick() { if (_InventoryScanning) { _userDialogs.ShowError("Please stop the scanning", 2000); return; } if (SelectedNhanVien == null || SelectedCustomer == null) { _userDialogs.ShowError("Please choose Employee and Customer", 2000); return; } if (this.Items.Count == 0) { _userDialogs.ShowError("Please add product to sale", 2000); return; } Device.BeginInvokeOnMainThread(() => this._userDialogs.ShowLoading("Loading ...", MaskType.Black)); Task.Run(() => { //var step = 100 / this.Items.Count; foreach (var o in this.Items) { //progress.PercentComplete += step; KhoDTO kho = this.apiClient.XuatKho(new XuatkhoDTO() { NhanVien = SelectedNhanVien.Code, KhachHang = SelectedCustomer.Code, Rfid = o.RfId }); } lock (fromServer) { var all = Items.Select(e => e.RfId.ToUpper()).ToList(); fromServer = fromServer.Where(e => !all.Contains(e.RfId.ToUpper())).ToList(); } lock (this.Items) { Items.Clear(); } }).ContinueWith(result => Device.BeginInvokeOnMainThread(() => { UserDialogs.Instance.HideLoading(); }) ); }
private void btnSua_Click(object sender, EventArgs e) { _currentRowIndex = gridView1.FocusedRowHandle; if (_currentRowIndex < 0) { return; } KhoDTO KhoDTO = new KhoDTO() { MaKho = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["MaKho"]).ToString(), TenKho = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["TenKho"]).ToString(), DiaChiKho = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["DiaChiKho"]).ToString(), DTKho = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["DTKho"]).ToString(), ghichu = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["ghichu"]).ToString(), ConQuanLy = bool.Parse(gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["ConQuanLy"]).ToString()), }; ThemKho frm = new ThemKho(false, KhoDTO); frm.ShowDialog(); hienThi(); }
public bool UpdateSPKho(KhoDTO kho) { return(KhoDAL.Instance.UpdateSPKho(kho)); }