예제 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            VBBDBDataContext v = new VBBDBDataContext();
            User             u = new User();
            //string username=t
            var getAccount = (
                from x in v.Users
                where x.Name == tn.Text

                select x

                );

            foreach (User x in getAccount)
            {
                try
                {
                    x.MobileNumber = int.Parse(tm.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("Enter valid mobile no.");
                }
                //v.Users.InsertOnSubmit(u);

                v.SubmitChanges();
            }
        }
예제 #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            VBBDBDataContext v = new VBBDBDataContext();

            Post p = new Post();

            p.PostText = tbpost.Text;
            v.Posts.InsertOnSubmit(p);
            v.SubmitChanges();


            this.Hide();
            Home h = new Home();

            h.Show();
        }
예제 #3
0
        private void btnsignin_Click(object sender, EventArgs e)
        {
            v = new VBBDBDataContext();

            string username = textBox1.Text;
            string password = textBox2.Text;

            if (username == "")
            {
                MessageBox.Show("Username must be filled!");
            }
            else if (password == "")
            {
                MessageBox.Show("Password must be filled!");
            }
            else
            {
                var getAccount = (
                    from x in v.Users
                    where x.Name == username && x.Password == password
                    select x
                    );

                if (getAccount.Count() != 1)
                {
                    MessageBox.Show("Invalid username & password!");
                }
                else if (getAccount.Count() == 1)
                {
                    // public int i = x;
                    this.Hide();
                    Home h = new Home();
                    h.Show();
                }
            }
        }
예제 #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            VBBDBDataContext v = new VBBDBDataContext();
            User             u = new User();

            var item = this.comboBox1.GetItemText(this.comboBox1.SelectedItem);

            if (item == "A+")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name, x.BloodGroup, x.LastDonationDate, x.MobileNumber, x.Address
                }

                                            );
            }
            else if (item == "A-")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "B+")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "B-")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "AB+")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "AB-")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "O+")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
            else if (item == "O-")
            {
                dataGridView1.DataSource = (from x in v.Users
                                            where x.BloodGroup == item
                                            select new
                {
                    x.Name,
                    x.BloodGroup,
                    x.LastDonationDate,
                    x.MobileNumber,
                    x.Address
                }

                                            );
            }
        }
예제 #5
0
        private void btnsignin_Click(object sender, EventArgs e)
        {
            if (tbname.Text == "")
            {
                MessageBox.Show("Name must be filled");
            }
            else if (tbpassword.Text == "")
            {
                MessageBox.Show("Password must be filled");
            }
            else if (tbdateofbirth.Text == "")
            {
                MessageBox.Show("Date of birth  must be filled");
            }
            else if (tbbloodgroup.Text == "")
            {
                MessageBox.Show("Blood group must be filled");
            }
            else if (tblastdonationdate.Text == "")
            {
                MessageBox.Show("Last donation date must be filled");
            }
            else if (tbmobilenumber.Text == "")
            {
                MessageBox.Show("Mobile number must be filled");
            }
            else if (tbaddress.Text == "")
            {
                MessageBox.Show("Adress must be filled");
            }
            else
            {
                v = new VBBDBDataContext();
                User u = new User();
                u.Name        = tbname.Text;
                u.Password    = tbpassword.Text;
                u.DateOfBirth = Convert.ToDateTime(tbdateofbirth.Text);    //dob
                u.BloodGroup  = tbbloodgroup.Text;

                /* try
                 * {
                 *
                 *   u.LastDonationDate = Convert.ToDateTime(tblastdonationdate.Text);
                 * }
                 * catch (Exception)
                 * {
                 *   MessageBox.Show("Enter date in right format(ex:mm/dd/yyyy)");*/

                u.LastDonationDate = Convert.ToDateTime(tblastdonationdate.Text);    // last donation d
                u.MobileNumber     = Convert.ToInt32(tbmobilenumber.Text);
                u.Address          = tbaddress.Text;

                v.Users.InsertOnSubmit(u);


                try
                {
                    v.SubmitChanges();
                    MessageBox.Show("Successfully registered!");
                    Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Something went wrong, Try again!");
                }

                this.Hide();
                Signin si = new Signin();
                si.Show();
            }
        }
예제 #6
0
 private void Profile_Load(object sender, EventArgs e)
 {
     v    = new VBBDBDataContext();
     Emps = v.Users.ToList();
     ShowData();
 }
예제 #7
0
파일: Home.cs 프로젝트: tohedul/VBB
        private void Home_Load_1(object sender, EventArgs e)
        {
            VBBDBDataContext v = new VBBDBDataContext();

            dataGridView1.DataSource = v.Posts;
        }