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 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 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");
            }
        }
Exemplo n.º 6
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");
            }
        }