Пример #1
0
        private void btnSaveHangHoaS_Click(object sender, EventArgs e)
        {
            HangHoaDTO hh = new HangHoaDTO();

            if (txtTenHHS.Text.Length <= 0)
            {
                lblThongBaoS.Text = "Chưa nhập Tên Hàng Hóa !";
            }
            else if (txtDVTS.Text.Length <= 0)
            {
                lblThongBaoS.Text = "Chưa nhập Đơn Vị Tính !";
            }
            else if (txtGiaBanS.Text.Length <= 0)
            {
                lblThongBaoS.Text = "Chưa nhập Giá Bán !";
            }
            else if (txtGiaMuaS.Text.Length <= 0)
            {
                lblThongBaoS.Text = "Chưa nhập Giá Mua !";
            }
            else
            {
                hh.MaHH      = Convert.ToInt32(txtMaHH.Text);
                hh.TeHH      = txtTenHHS.Text;
                hh.DonViTinh = txtDVTS.Text;
                hh.GiaBan    = Convert.ToDecimal(txtGiaBanS.Text);
                hh.GiaMua    = Convert.ToDecimal(txtGiaMuaS.Text);
                hh.GhiChu    = txtGhiChuS.Text;
                if (hanghoaBUS.UpDateData(hh))
                {
                    MessageBox.Show("Cập nhật thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Cập nhật lại đê bạn ơi,wrong rùi :>", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }