예제 #1
0
        private void BtnAddSP_Click(object sender, RoutedEventArgs e)
        {
            ComboBoxItem item = cbLSP.SelectedItem as ComboBoxItem;

            if (txtTenSP.Text == "" || cbLSP.Text == "" || txtDG.Text == "")
            {
                MessageBox.Show("Vui Lòng Điền Đầy Đủ Thông Tin");
            }
            else
            {
                var sp = new SANPHAM
                {
                    TenSP     = txtTenSP.Text,
                    MaLoaiSP  = (int)item.Tag,
                    GiaBanRa  = decimal.Parse(txtDG.Text),
                    SoLuong   = 0,
                    KichHoat  = true,
                    KhuyenMai = txtKM.Text == "" ? 0 : int.Parse(txtKM.Text)
                };
                db.SANPHAMs.Add(sp);
                db.SaveChanges();
                MessageBox.Show("Thêm Thành Công");

                var a = (from s in db.SANPHAMs
                         select s).Max(s => s.MaSP);

                NhaCungCapList ncc = new NhaCungCapList(a);
                ncc.ShowDialog();

                txtTenSP.Text = "";
                cbLSP.Text    = "";
                txtDG.Text    = "";
                cbLSP.Text    = "";
                txtKM.Text    = "";

                Select();
            }
        }
예제 #2
0
        private void BtnAddNCC_Click(object sender, RoutedEventArgs e)
        {
            NhaCungCapList ncc = new NhaCungCapList(maSPUpdate);

            ncc.ShowDialog();
        }