Exemple #1
0
 private void button_themthenap_Click(object sender, EventArgs e)
 {
     try
     {
         using (dbTRAVELDataContext them_thenap = new dbTRAVELDataContext())
         {
             TheNap them_tn = new TheNap();
             them_tn.MaTheNap = textBox_mathenap.Text.ToString();
             them_tn.GiaThe   = decimal.Parse(textBox_giathenap.Text.ToString());
             them_tn.SoSeri   = textBox_soseri.Text.ToString();
             them_tn.DaSuDung = 0;
             them_thenap.TheNaps.InsertOnSubmit(them_tn);
             them_thenap.SubmitChanges();
             MessageBox.Show("Thêm thẻ nạp mới thành công", "Thông báo");
             LoadTheNap();
         }
     }
     catch (Exception loi)
     {
         MessageBox.Show("Thẻ đã tồn tại hoặc dữ liệu bị thiếu", "Lỗi");
     }
 }
 partial void UpdateTheNap(TheNap instance);
 partial void DeleteTheNap(TheNap instance);
 partial void InsertTheNap(TheNap instance);