private void autonumber() { using (DataClassesDataContext db = new DataClassesDataContext()) { Msmember m = db.Msmembers.OrderByDescending(s => s.MemberID).FirstOrDefault(); if (m != null) { string a = m.MemberID.ToString(); int n = Convert.ToInt32(a) + 1; tbxID.Text = n.ToString("d1"); } else { tbxID.Text = "1"; } } }
private void btnDelete_Click(object sender, EventArgs e) { using (DataClassesDataContext db = new DataClassesDataContext()) { if (tbxID.Text == "" || tbxName.Text == "" || tbxEmail.Text == "" || tbxHandphone.Text == "") { MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); bersih(); } else { Msmember m = db.Msmembers.Where(s => s.MemberID == tbxID.Text).FirstOrDefault(); db.Msmembers.DeleteOnSubmit(m); db.SubmitChanges(); awal(); MessageBox.Show("Successfully Deleted Data", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
partial void DeleteMsmember(Msmember instance);
partial void UpdateMsmember(Msmember instance);
partial void InsertMsmember(Msmember instance);