private void frmBanHang_Load(object sender, EventArgs e) { HelperUI.autoCompleteTenSanPham(tb_TenSanPham, HelperUI.checkLoai(cbb_LoaiSanPham.Text.ToString())); dgv_DuLieu.AutoGenerateColumns = false; fillData(); dgv_DuLieu.ForeColor = Color.Black; }
private void frmThongTinSanPham_Load(object sender, EventArgs e) { HelperUI.loadData_cbbTinhTrang(cbb_TinhTrang); //HelperUI.loadData_cbbPhanLoai(cbb_PhanLoai); dgv_DuLieu.AutoGenerateColumns = false; dgv_DuLieu.ForeColor = Color.Black; }
private void frmNhapHang_Load(object sender, EventArgs e) { HelperUI.loadData_cbbTinhTrang(cbb_TinhTrang); dgv_DuLieu.AutoGenerateColumns = false; fillData(); dgv_DuLieu.ForeColor = Color.Black; }
private void cbb_PhanLoai_SelectedIndexChanged(object sender, EventArgs e) { Loai = HelperUI.checkLoai(cbb_PhanLoai.Text.ToString()); HelperUI.autoCompleteTenSanPham(tb_TenSanPham, Loai); ProductService sv = new ProductService(); dgv_DuLieu.DataSource = sv.GetStockInformationWithType(Loai); }
private void frmKho_Load(object sender, EventArgs e) { ProductService sv = new ProductService(); dgv_DuLieu.AutoGenerateColumns = false; HelperUI.autoCompleteTenSanPham(tb_TenSanPham, HelperUI.checkLoai(cbb_PhanLoai.Text.ToString())); dgv_DuLieu.DataSource = sv.LoadStockInformation(10); dgv_DuLieu.ForeColor = Color.Black; }
private void cbb_Loai_SelectedIndexChanged(object sender, EventArgs e) { Loai = HelperUI.checkLoai(cbb_Loai.Text); if (Loai.Equals("01")) { Type = "TypeV"; HelperUI.loadData_cbbPhanLoai(cbb_PhanLoai, Type); } else { Type = "Type"; HelperUI.loadData_cbbPhanLoai(cbb_PhanLoai, Type); } HelperUI.autoCompleteTenSanPham(tb_TenSanPham, Loai); }
//Không thay đổi trừ Admin //Lấy Value - Key "" private void cbb_Loai_SelectedIndexChanged(object sender, EventArgs e) { Loai = HelperUI.checkLoai(cbb_Loai.Text); if (Loai.Equals("01")) { Type = "TypeV"; HelperUI.loadData_cbbPhanLoai(cbb_PhanLoai, Type); } else { Type = "Type"; HelperUI.loadData_cbbPhanLoai(cbb_PhanLoai, Type); } fillData(); }
private void btn_Them_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(cbb_LoaiSanPham.Text.ToString())) { MessageBox.Show("Vui lòng chọn loại sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (string.IsNullOrEmpty(tb_TenSanPham.Text.ToString())) { MessageBox.Show("Vui lòng chọn tên sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_TenSanPham.Focus(); } else if (string.IsNullOrEmpty(tb_SoLuong.Text.ToString())) { MessageBox.Show("Vui lòng chọn số lượng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_SoLuong.Focus(); } else { NgayBan = DateTime.Parse(dtp_NgayBan.Text.ToString()); ID = Helper.GetIDFromName(tb_TenSanPham.Text); SellProductDto sell = new SellProductDto(); ProductRepo pro = new ProductRepo(); sell.ID_Product = ID; sell.ProductName = tb_TenSanPham.Text.ToString(); sell.Quantities = Int32.Parse(tb_SoLuong.Text.ToString()); sell.Category = Loai; sell.DateOfSale = NgayBan; DialogResult dlg = MessageBox.Show("Xác nhận thông tin sản phẩm đã chính xác!!", "Thông báo!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dlg.Equals(DialogResult.OK)) { ProductService sv = new ProductService(); sv.SellProduct(sell, NgayBan); MessageBox.Show("Đã thêm sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); fillData(); HelperUI.ResetAllControls(groupBox1); } } } catch { } }
//string Status; #endregion #region Envent private void btn_Duyet_Click(object sender, EventArgs e) { try { DialogResult dlg = MessageBox.Show("Xác nhận duyệt đơn hàng!!", "Thông báo!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dlg.Equals(DialogResult.OK)) { ProductService sv = new ProductService(); sv.ChangeStatusOfOrder(ID, "01"); MessageBox.Show("Ok!!"); List <OrderDetailDto> ls = new List <OrderDetailDto>(); ls = sv.GetAllOrdersAreWaiting(); dgv_DuLieu.DataSource = ls; HelperUI.ResetAllControls(groupBox1); } } catch { } }
private void strip_Sua_Click(object sender, EventArgs e) { try { ProductDto pro = new ProductDto(); ProductService sv = new ProductService(); if (string.IsNullOrEmpty(cbb_Loai.Text)) { MessageBox.Show("Vui lòng chọn loại sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); cbb_Loai.Focus(); } else if (string.IsNullOrEmpty(tb_TenSanPham.Text)) { MessageBox.Show("Vui lòng điền tên sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_TenSanPham.Focus(); } else if (string.IsNullOrEmpty(tb_Hieu.Text)) { MessageBox.Show("Vui lòng điền hiệu sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_Hieu.Focus(); } else if (string.IsNullOrEmpty(tb_Doi.Text)) { MessageBox.Show("Vui lòng điền đời sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_Doi.Focus(); } else if (string.IsNullOrEmpty(tb_HangSanXuat.Text)) { MessageBox.Show("Vui lòng điền hãng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_HangSanXuat.Focus(); } else if (string.IsNullOrEmpty(tb_MoTa.Text)) { MessageBox.Show("Vui lòng điền mô tả sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_MoTa.Focus(); } else if (string.IsNullOrEmpty(cbb_PhanLoai.Text)) { MessageBox.Show("Vui lòng chọn phân loại sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (string.IsNullOrEmpty(cbb_TinhTrang.Text)) { MessageBox.Show("Vui lòng chọn tình trạng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { pro.ID = ID; pro.Doi = tb_Doi.Text.ToString(); pro.Hang = tb_HangSanXuat.Text.ToString(); pro.Hieu = tb_Hieu.Text.ToString(); pro.Ten = tb_TenSanPham.Text.ToString(); pro.MoTa = tb_MoTa.Text.ToString(); pro.Loai = Loai; pro.PhanLoai = PhanLoai; pro.TinhTrang = TinhTrang; DialogResult dlg = MessageBox.Show("Xác nhận thông tin sản phẩm đã chính xác!!", "Thông báo!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dlg.Equals(DialogResult.OK)) { sv.EditVehicle(pro); MessageBox.Show("Đã sửa thông tin sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); fillData(); HelperUI.ResetAllControls(groupBox1); } } } catch { MessageBox.Show(".."); } }
private void cbb_LoaiSanPham_SelectedIndexChanged(object sender, EventArgs e) { Loai = HelperUI.checkLoai(cbb_LoaiSanPham.Text.ToString()); HelperUI.autoCompleteTenSanPham(tb_TenSanPham, Loai); }
private void btn_Them_Click(object sender, EventArgs e) { try { ImportProductDto pro = new ImportProductDto(); ProductService sv = new ProductService(); if (string.IsNullOrEmpty(cbb_Loai.Text)) { MessageBox.Show("Vui lòng chọn loại sản phẩm !!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); cbb_Loai.Focus(); } else if (string.IsNullOrEmpty(tb_TenSanPham.Text)) { MessageBox.Show("Vui lòng chọn loại sản phẩm !!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_TenSanPham.Focus(); } else if (string.IsNullOrEmpty(dtp_NgayNhapHang.Text)) { MessageBox.Show("Vui lòng chọn ngày nhập hàng!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); dtp_NgayNhapHang.Focus(); } else if (string.IsNullOrEmpty(tb_SoLuong.Text)) { MessageBox.Show("Vui lòng nhập số lượng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_SoLuong.Focus(); } else if (string.IsNullOrEmpty(cbb_TinhTrang.Text)) { MessageBox.Show("Vui lòng chọn tình trạng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); cbb_TinhTrang.Focus(); } else if (string.IsNullOrEmpty(tb_Hang.Text)) { MessageBox.Show("Vui lòng nhập hãng sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_Hang.Focus(); } else if (string.IsNullOrEmpty(tb_MoTa.Text)) { MessageBox.Show("Vui lòng nhập mô tả sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_MoTa.Focus(); } else if (string.IsNullOrEmpty(cbb_PhanLoai.Text)) { MessageBox.Show("Vui lòng chọn phân loại sản phẩm!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); cbb_PhanLoai.Focus(); } else { DateTime NgayNhap = dtp_NgayNhapHang.Value; int SoLuong = Int32.Parse(tb_SoLuong.Text.ToString()); pro.Category = Loai; pro.Status = TinhTrang; pro.Classification = PhanLoai; pro.ProductName = tb_TenSanPham.Text.ToString(); pro.ID_Product = Helper.GetIDFromName(tb_TenSanPham.Text.ToString()); pro.Label = tb_Hang.Text.ToString(); pro.Description = tb_MoTa.Text.ToString(); pro.Quantities = SoLuong; DialogResult dlg = MessageBox.Show("Xác nhận thông tin nhập hàng đã chính xác!!", "Thông báo!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dlg.Equals(DialogResult.OK)) { sv.ImportProduct(pro, NgayNhap); fillData(); MessageBox.Show("Đã thêm thông tin nhập hàng!!", "Thông báo!!", MessageBoxButtons.OK, MessageBoxIcon.Information); HelperUI.ResetAllControls(groupBox1); } } } catch { //MessageBox.Show(".."); } }