예제 #1
0
        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     = "";
            }
        }
예제 #2
0
 partial void DeleteCanditate(Canditate instance);
예제 #3
0
 partial void UpdateCanditate(Canditate instance);
예제 #4
0
 partial void InsertCanditate(Canditate instance);
예제 #5
0
 private void detach_Canditates(Canditate entity)
 {
     this.SendPropertyChanging();
     entity.Area = null;
 }
예제 #6
0
 private void attach_Canditates(Canditate entity)
 {
     this.SendPropertyChanging();
     entity.Area = this;
 }