private void submitbtn_Click(object sender, RoutedEventArgs e) { var res = (Area)areadg.SelectedItem; if (fntext.Text == "" || lntext.Text == "" || gendertext.Text == "" || agetext.Text == "" || educationtext.Text == "" || cnictext.Text == "" || partytext.Text == "") { // MessageBox.Show("Good","Alert", MessageBoxButton.OKCancel, MessageBoxImage.Error); MessageBox.Show("Please fill all of the fields"); } if (res == null) { MessageBox.Show("Please select your area"); } else { Canditate V = new Canditate() { First_Name = fntext.Text, Last_Name = lntext.Text, Gender = gendertext.Text, Age = agetext.Text, Education = educationtext.Text, CNIC = cnictext.Text, Party = partytext.Text, AID = res.AID }; dc.Canditates.InsertOnSubmit(V); dc.SubmitChanges(); MessageBox.Show("Succesfully Added"); fntext.Text = ""; lntext.Text = ""; gendertext.Text = ""; agetext.Text = ""; educationtext.Text = ""; cnictext.Text = ""; partytext.Text = ""; } }
partial void DeleteCanditate(Canditate instance);
partial void UpdateCanditate(Canditate instance);
partial void InsertCanditate(Canditate instance);
private void detach_Canditates(Canditate entity) { this.SendPropertyChanging(); entity.Area = null; }
private void attach_Canditates(Canditate entity) { this.SendPropertyChanging(); entity.Area = this; }