示例#1
0
 partial void DeleteVoter(Voter instance);
示例#2
0
 partial void UpdateVoter(Voter instance);
示例#3
0
 partial void InsertVoter(Voter instance);
示例#4
0
 private void detach_Voters(Voter entity)
 {
     this.SendPropertyChanging();
     entity.Area = null;
 }
示例#5
0
 private void attach_Voters(Voter entity)
 {
     this.SendPropertyChanging();
     entity.Area = this;
 }
示例#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  = "";
            }
        }