Beispiel #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtTenLoaiSP.Text == "" || txtPhantramloinhuan.Text == "")
            {
                MessageBox.Show("Bạn còn dữ liệu chưa nhập");
                return;
            }
            LoaiSP_DTO a = new LoaiSP_DTO();

            a.TenLoaiSP        = txtTenLoaiSP.Text;
            a.MaDonViTinh      = Int16.Parse(cbbDV.SelectedValue.ToString());
            a.PhanTramLoiNhuan = (float)Double.Parse(txtPhantramloinhuan.Text);
            if (a.PhanTramLoiNhuan > 1)
            {
                MessageBox.Show("Phần trăm lợi nhuận phải nhỏ hơn 1");
                return;
            }
            if (a.PhanTramLoiNhuan <= 0)
            {
                MessageBox.Show("Phần trăm lợi nhuận phải lớn hơn 0");
                return;
            }
            if (lo.CheckTenLoaiSP(a.TenLoaiSP) == 0)
            {
                lo.ThemLoaiSP(a);
                this.Close();
                //MessageBox.Show("Thêm thành công");
            }
            else
            {
                MessageBox.Show("Loại sản phẩm này đã trùng tên, bạn vui lòng chọn tên khác");
                return;
            }
        }
Beispiel #2
0
        private void btnThemLoaiSP_Click(object sender, EventArgs e)
        {
            if (LoaiSPChon == null)
            {
                ChiTiet();

                bool kq = loaiSPBUS.ThemLoaiSP(LoaiSPChon);
                if (kq)
                {
                    MessageBox.Show(string.Format("Thêm mới loại sản phẩm có mã {0} thành công.", LoaiSPChon.MaLoaiSP));
                    LoadDSLoaiSP();
                }
                else
                {
                    MessageBox.Show("Thêm không thành công!");
                    LoaiSPChon = null;
                }
            }
        }