예제 #1
0
파일: Request.cs 프로젝트: rezaulk/C-sharp
        private void button1_Click(object sender, EventArgs e)
        {
            BloodDataContext D = new BloodDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\C# projects\finalProject\Blood Donation\Blood.mdf;Integrated Security=True;Connect Timeout=30");

            GuestInfo pr = new GuestInfo();

            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")
            {
                pr.GName    = textBox2.Text;
                pr.GPhone   = textBox3.Text;
                pr.GAddress = textBox4.Text;
                D.GuestInfos.InsertOnSubmit(pr);
                D.SubmitChanges();

                RequestInfo rq = new RequestInfo();
                rq.DonorId = Convert.ToInt32(textBox1.Text);
                rq.Gphone  = textBox3.Text;

                var x = from a in D.GuestInfos
                        where a.GPhone.Equals(textBox3.Text)
                        select a;
                int str = x.First().Gid;

                rq.Gid = str;

                D.RequestInfos.InsertOnSubmit(rq);
                MessageBox.Show("Request Send");
                this.Hide();
                D.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Please fill up all information");
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BloodDataContext D = new BloodDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\C# projects\finalProject\Blood Donation\Blood.mdf;Integrated Security=True;Connect Timeout=30");

            //RequestInfo j = D.RequestInfos.SingleOrDefault(x => x.DonorId == Convert.ToInt32(textBox1.Text));

            var y = from a in D.RequestInfos
                    where a.Gid == Convert.ToInt32(textBox1.Text)
                    select a;

            if (y.Any())
            {
                foreach (var a in y)
                {
                    D.RequestInfos.DeleteOnSubmit(a);
                }

                GuestInfo i = D.GuestInfos.SingleOrDefault(t => t.Gid == Convert.ToInt32(textBox1.Text));

                D.GuestInfos.DeleteOnSubmit(i);
                D.SubmitChanges();
                s.showde();
            }
            else
            {
                MessageBox.Show("Guest Id Invalid");
            }
        }
예제 #3
0
 partial void UpdateGuestInfo(GuestInfo instance);
예제 #4
0
 partial void DeleteGuestInfo(GuestInfo instance);
예제 #5
0
 partial void InsertGuestInfo(GuestInfo instance);