Esempio n. 1
0
 partial void DeleteVoter(Voter instance);
Esempio n. 2
0
 partial void UpdateVoter(Voter instance);
Esempio n. 3
0
 partial void InsertVoter(Voter instance);
Esempio n. 4
0
 private void detach_Voters(Voter entity)
 {
     this.SendPropertyChanging();
     entity.Area = null;
 }
Esempio n. 5
0
 private void attach_Voters(Voter entity)
 {
     this.SendPropertyChanging();
     entity.Area = this;
 }
Esempio n. 6
0
        private async void submitbtn_Click(object sender, RoutedEventArgs e)
        {
            var res = (Area)areadg.SelectedItem;

            if (fntext.Text == "" || lntext.Text == "" || gendertext.Text == "" ||
                agetext.Text == "" || phonetext.Text == "" || edutext.Text == "" ||
                occtext.Text == "" || cnictext.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
            {
                Voter V = new Voter()
                {
                    First_Name = fntext.Text,
                    Last_Name  = lntext.Text,
                    CNIC       = cnictext.Text,
                    Age        = agetext.Text,
                    Phone      = phonetext.Text,
                    Ocupation  = occtext.Text,
                    Gender     = gendertext.Text,
                    Vote       = "no",
                    AID        = res.AID
                };
                string p   = res.Area1;
                string c   = res.City;
                int    vid = 0;
                dc.Voters.InsertOnSubmit(V);
                dc.SubmitChanges();

                var res1 = from q in dc.Voters where q.CNIC == V.CNIC select new { VID = q.VID };

                foreach (var r in res1)
                {
                    vid = r.VID;
                }


                //pbStatus.Visibility = Visibility.Visible;
                //pbStatus.IsIndeterminate = true;
                int a = await message(V.Phone, p, c, vid);

                // pbStatus.IsIndeterminate = false;


                //pbStatus.Visibility = Visibility.Hidden;

                MessageBox.Show("Succesfully Added");

                fntext.Text     = "";
                lntext.Text     = "";
                gendertext.Text = "";
                agetext.Text    = "";
                edutext.Text    = "";
                cnictext.Text   = "";
                occtext.Text    = "";
                phonetext.Text  = "";
            }
        }