private void btnSubmit_Click(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            Student s = con.Students.SingleOrDefault(x => x.sName == txtName.Text);

            if (s != null)
            {
                s.sName       = txtName.Text;
                s.sFatherName = txtFather.Text;
                s.sMotherName = txtMother.Text;
                s.sContactNo  = txtContact.Text;
                s.sAdress     = txtAddress.Text;
                s.sSchool     = txtSchools.Text;
                s.sClass      = txtClass.Text;
                s.sSection    = txtsection.Text;
                s.sFees       = int.Parse(txtFees.Text);

                con.SubmitChanges();
                MessageBox.Show("Success");
            }
            else
            {
                MessageBox.Show("Not Update");
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            teacher t = con.teachers.SingleOrDefault(x => x.teacherName == txtName.Text);

            if (t != null)
            {
                t.teacherName      = txtName.Text;
                t.teacherEmail     = txtMail.Text;
                t.teacherContactNo = txtContactNo.Text;

                t.teacherAddress = txtAddress.Text;

                t.teacherDesignation = txtDesignation.Text;
                t.teacherPayPerClass = int.Parse(txtPayment.Text);

                con.SubmitChanges();
                MessageBox.Show("Success");
            }
            else
            {
                MessageBox.Show("Not Update");
            }
        }
        private void FormStudent_Load(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            var ob = con.Students.Where(x => x.sName.StartsWith(searchBox.Text));

            searchBox.DataSource    = ob.ToList();
            searchBox.DisplayMember = "sName";
        }
        private void FormAddStudent_Load(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            var ob = from f in con.sections
                     select f;

            if (ob.Any())
            {
                SectionBox.DataSource    = ob.ToList();
                SectionBox.DisplayMember = "sectionName";
            }
        }
Beispiel #5
0
        //connect with linQ
        private bool isUserValid()
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();
            var ob = from f in con.user_logins
                     where f.uName == UserID.Text &&
                     f.uPassword == Password.Text
                     select f;

            if (ob.Any())
            {
                return(true);
            }
            return(false);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            Student s = con.Students.SingleOrDefault(x => x.sName == txtName.Text);

            if (s != null)
            {
                con.Students.DeleteOnSubmit(s);
                con.SubmitChanges();
                MessageBox.Show(" Deleted");
            }
            else
            {
                MessageBox.Show(" Not Found");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            teacher t = con.teachers.SingleOrDefault(x => x.teacherName == txtName.Text);

            if (t != null)
            {
                con.teachers.DeleteOnSubmit(t);
                con.SubmitChanges();
                MessageBox.Show(" Deleted");
            }
            else
            {
                MessageBox.Show(" Not Found");
            }
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();
            string  temp = searchBox.GetItemText(searchBox.SelectedItem);
            teacher t    = con.teachers.SingleOrDefault(x => x.teacherName == temp);

            if (t != null)
            {
                txtName.Text      = t.teacherName;
                txtMail.Text      = t.teacherEmail;
                txtContactNo.Text = t.teacherContactNo;

                txtAddress.Text = t.teacherAddress;

                txtDesignation.Text = t.teacherDesignation;
                txtPayment.Text     = t.teacherPayPerClass.ToString();
            }
        }
        private void searchBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();
            string  temp = searchBox.GetItemText(searchBox.SelectedItem);
            Student s    = con.Students.SingleOrDefault(x => x.sName == temp);

            if (s != null)
            {
                txtName.Text    = s.sName;
                txtFather.Text  = s.sFatherName;
                txtMother.Text  = s.sMotherName;
                txtContact.Text = s.sContactNo;
                txtAddress.Text = s.sAdress;
                txtSchools.Text = s.sSchool;
                txtClass.Text   = s.sClass;
                txtsection.Text = s.sSection;
                txtFees.Text    = s.sFees.ToString();
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtCourse.Text.Length != 0)
            {
                MatrixLinQDataContext con = new MatrixLinQDataContext();

                section s = new section();

                s.sectionName = this.txtCourse.Text;

                con.sections.InsertOnSubmit(s);
                con.SubmitChanges();
                MessageBox.Show("New Section Added");
                txtCourse.Text = "";
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
Beispiel #11
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!isFieldEmpty())
            {
                MatrixLinQDataContext con = new MatrixLinQDataContext();
                teacher t = new teacher();
                t.teacherName        = txtName.Text;
                t.teacherEmail       = txtMail.Text;
                t.teacherContactNo   = txtContactNo.Text;
                t.teacherBloodGroup  = bloodGroup.SelectedItem.ToString();
                t.teacherReligion    = religion.SelectedItem.ToString();
                t.teacherAddress     = txtAddress.Text;
                t.teacherJoinDate    = joinDate.Value.ToString("dd/MM/yyyy");
                t.teacherDesignation = txtDesignation.Text;
                t.teacherPayPerClass = Convert.ToInt32(txtPayment.Text);

                con.teachers.InsertOnSubmit(t);
                con.SubmitChanges();
                MessageBox.Show("New User Added");
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            MatrixLinQDataContext con = new MatrixLinQDataContext();

            user_login uc = con.user_logins.SingleOrDefault(x => x.uName == Utility.UserName &&
                                                            x.uPassword == this.txtCurrentPassword.Text);

            if (uc != null)
            {
                uc.uPassword = newPass.Text;
                con.SubmitChanges();
                this.Dispose();
                MessageBox.Show("Password Changed");
            }
            else
            {
                MessageBox.Show("Error");
                txtCurrentPassword.Text = "";
                newPass.Text            = "";
                rePass.Text             = "";
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!isFieldEmpty())
            {
                MatrixLinQDataContext con = new MatrixLinQDataContext();
                Student s = new Student();
                s.sName        = txtName.Text;
                s.sFatherName  = txtFather.Text;
                s.sMotherName  = txtMother.Text;
                s.sContactNo   = txtContact.Text;
                s.sGender      = gender.SelectedItem.ToString();
                s.sAdress      = txtAddress.Text;
                s.sDateOfBirth = DoB.Value.ToString("dd/MM/yyyy");
                s.sJoiningDate = JoiningDate.Value.ToString("dd/MM/yyyy");
                s.sSchool      = txtSchools.Text;
                s.sClass       = ClassBox.SelectedItem.ToString();
                s.sSection     = SectionBox.GetItemText(SectionBox.SelectedItem);
                s.sFees        = int.Parse(txtFees.Text);

                con.Students.InsertOnSubmit(s);
                con.SubmitChanges();
                MessageBox.Show("New Student Added");
            }
        }