Пример #1
0
 private void buttonX_Add_Click(object sender, EventArgs e)
 {
     HienthiCTdathang();
     if (c2.sosanhMSP(textBoxX_msp.Text.Trim())) //neu msp da ton tai thuc hien add
     {
         if (nh != null)
         {
             SP s = new SP();
             s = s.SetSP(textBoxX_msp.Text, int.Parse(textBoxX_soluong.Text));
             SP      sp = nh.AddSP(s);
             DataRow dr = DtableMuahang.NewRow();
             dr["msp"]       = sp.GetMSP();
             dr["tensp"]     = sp.GetTensp();
             dr["giamua"]    = sp.GetGiaMua();
             dr["slnhap"]    = sp.GetSoluong();
             dr["thanhtien"] = sp.GetThanhtien();
             DtableMuahang.Rows.Add(dr);
             deleteRow(dataGridViewX1, "Column_msp");
         }
     }
     else
     {
         MessageBox.Show("Hãy thêm Sp mới vào");
         frSanpham frsp = new frSanpham();
         frsp.Show();
     }
 }
Пример #2
0
 private void buttonItem2_Click(object sender, EventArgs e) // gọi form san phẩm
 {
     if (spForm1 == null || spForm1.IsDisposed)
     {
         spForm1           = new frSanpham();
         spForm1.MdiParent = this;
         spForm1.Show();
     }
     else
     {
         spForm1.Activate();
     }
 }