private void btn_TiepTuc_Click(object sender, EventArgs e) { try { int id = SanPhamModels.SanPhams.getLastMa(); Dao.CTSanPham a = new Dao.CTSanPham(); a.KichCo = int.Parse(txt_KichCo.Text); a.MaSac = txt_MauSac.Text; a.GiaBan = float.Parse(txt_GiaBan.Text); a.ChatLieu = txt_ChatLieu.Text; listCT.Add(a); btn_Xoa.Enabled = true; btn_HoanTat.Enabled = true; txt_ChatLieu.Text = ""; txt_GiaBan.Text = ""; txt_KichCo.Text = ""; txt_MauSac.Text = ""; comboBox1.Enabled = false; getdatas(); } catch (Exception) { MessageBox.Show("Bạn chưa điền đủ thông tin"); } }
private void btn_TiepTuc_Click(object sender, EventArgs e) { int id = SanPhamModels.SanPhams.getLastMa(); Dao.CTSanPham a = new Dao.CTSanPham(); a.KichCo = int.Parse(txt_KichCo.Text); a.MaSac = txt_MauSac.Text; a.GiaBan = float.Parse(txt_GiaBan.Text); a.ChatLieu = txt_ChatLieu.Text; listCT.Add(a); btn_Xoa.Enabled = true; btn_HoanTat.Enabled = true; txt_ChatLieu.Text = ""; txt_GiaBan.Text = ""; txt_KichCo.Text = ""; txt_MauSac.Text = ""; getdatas(); }
private void btn_CapNhat_Click(object sender, EventArgs e) { Dao.CTSanPham ctsp = new Dao.CTSanPham(); ctsp.MaCTSp = int.Parse(lb_MaChiTietSanPham.Text); ctsp.KichCo = int.Parse(txt_KichCo.Text); ctsp.MaSac = txt_MauSac.Text; ctsp.ChatLieu = txt_ChatLieu.Text; ctsp.GiaBan = int.Parse(txt_GiaBan.Text); ctsp.MaSp = int.Parse(comboBox1.SelectedValue.ToString()); if (SanPhamModels.SanPhams.SuaCTSP(ctsp)) { MessageBox.Show("Cập nhật thành công"); getdata(true); reset(); } else { MessageBox.Show("Cập nhật thất bại"); } }