Ejemplo n.º 1
0
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            if (radioMale.Checked)
            {
                string query = string.Format("insert into Person(FirstName,LastName,Contact,Email,DateOfBirth,Gender) values('{0}','{1}','{2}','{3}','{4}',(select id from Lookup where Value='Male'))", txtFirstName.Text, txtLastName.Text, txtContact.Text, txtEmail.Text, txtDob.Text);
                DataBaseConnection.getInstance().executeQuery(query);
            }
            else
            {
                string query = string.Format("insert into Person(FirstName,LastName,Contact,Email,DateOfBirth,Gender) values('{0}','{1}','{2}','{3}','{4}',(select id from Lookup where Value='Female'))", txtFirstName.Text, txtLastName.Text, txtContact.Text, txtEmail.Text, txtDob.Text);
                DataBaseConnection.getInstance().executeQuery(query);
            }

            string totalStudent  = "select count(*) from Person ";
            var    readPersonLen = DataBaseConnection.getInstance().getRowsCount(totalStudent);
            string query2        = string.Format("insert into Student(id,RegistrationNo) values('{0}','{1}')", readPersonLen, txtRegNo.Text);

            DataBaseConnection.getInstance().executeQuery(query2);
            txtRegNo.Text       = "";
            txtLastName.Text    = "";
            txtFirstName.Text   = "";
            txtEmail.Text       = "";
            txtDob.Text         = "";
            txtContact.Text     = "";
            radioFemale.Checked = false;
            radioMale.Checked   = false;
        }
Ejemplo n.º 2
0
        private void radioInActive_CheckedChanged(object sender, EventArgs e)
        {
            List <student> list_L = new List <student>();

            if (radioInActive.Checked)
            {
                string query  = "select GroupId,AssignmentDate,Student.RegistrationNo,Person.FirstName from GroupStudent join Student on Student.Id=GroupStudent.StudentId join Person on Student.Id=Person.Id where GroupStudent.Status=4";
                var    result = DataBaseConnection.getInstance().readData(query);
                while (result.Read())
                {
                    student s = new student();
                    s.GroupAssignmentDate = result.GetDateTime(1).ToString("dd-MM-yyyy");
                    s.GroupId             = Convert.ToString(result.GetInt32(0));
                    s.Name               = result.GetString(3);
                    s.GroupStatus        = "In Active";
                    s.RegistrationNumber = result.GetString(2);
                    list_L.Add(s);
                }
            }
            list_M = list_L;
            dataGridView1.Visible = false;
            dgGroups.Visible      = true;
            BindingSource source = new BindingSource();

            source.DataSource   = list_M;
            dgGroups.DataSource = source;
        }
Ejemplo n.º 3
0
        public void Auto()

        {
            string st = string.Format("select RegistrationNo from Student left join GroupStudent on Student.Id=GroupStudent.StudentId where GroupStudent.StudentId is null ");

            da = DataBaseConnection.getInstance().getAllData(st);
            DataTable dt = new DataTable();

            da.Fill(dt);

            if (dt.Rows.Count > 0)

            {
                for (int i = 0; i < dt.Rows.Count; i++)

                {
                    coll.Add(dt.Rows[i]["RegistrationNo"].ToString());
                }
            }
            else

            {
                MessageBox.Show("No Free Student  found");
            }

            txtRegistrationSearch.AutoCompleteMode = AutoCompleteMode.Suggest;

            txtRegistrationSearch.AutoCompleteSource = AutoCompleteSource.CustomSource;

            txtRegistrationSearch.AutoCompleteCustomSource = coll;
        }
Ejemplo n.º 4
0
        private void btnAddAdvisor_Click(object sender, EventArgs e)
        {
            string query = string.Format("insert into Advisor(Designation,Salary) values((select id from Lookup where Value='" + comboAddesig.Text + "'),'{0}')", txtAdSalary.Text);

            DataBaseConnection.getInstance().executeQuery(query);
            comboAddesig.Text = "";
            txtAdSalary.Text  = "";
        }
Ejemplo n.º 5
0
        private void addAdvisor_Load(object sender, EventArgs e)
        {
            string query = String.Format("select Value from Lookup where Category='DESIGNATION'");
            var    des   = DataBaseConnection.getInstance().readData(query);

            while (des.Read())
            {
                comboAddesig.Items.Add(des.GetString(0));
            }
        }
Ejemplo n.º 6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string query = string.Format("select id from Student where RegistrationNo='" + txtRegistrationSearch.Text + "'");

            var getId = DataBaseConnection.getInstance().readData(query);

            while (getId.Read())
            {
                stud_list.Add(getId.GetInt32(0));
            }

            List <student> st_L = new List <student>();

            foreach (int std in stud_list)
            {
                string query2 = string.Format("select Student.RegistrationNo , FirstName,Email from Person join Student on Person.id=Student.id where Person.id='{0}'", std);
                var    result = DataBaseConnection.getInstance().readData(query2);
                while (result.Read())
                {
                    if (result.GetString(0) != "" && result.GetString(2) != "" && result.GetString(1) != "")
                    {
                        student s = new student();
                        s.RegistrationNumber = result.GetString(0);
                        s.Name  = result.GetString(1);
                        s.Email = result.GetString(2);
                        s.Id    = Convert.ToString(std);
                        st_L.Add(s);
                    }
                }
            }
            st_L = st_L.Distinct().ToList();
            BindingSource si = new BindingSource();

            si.DataSource            = st_L;
            dataGridView1.DataSource = si;
            st_M = st_L;
            txtRegistrationSearch.Text = "";
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string query = string.Format("insert into GroupOne(Created_On) values('{0}')", DateTime.Now);

            DataBaseConnection.getInstance().executeQuery(query);
            string     groupQuery = "select * from GroupOne";
            var        groupList  = DataBaseConnection.getInstance().readData(groupQuery);
            List <int> intList    = new List <int>();

            while (groupList.Read())
            {
                intList.Add(groupList.GetInt32(0));
            }
            int count = intList.Count();

            foreach (student ob in st_M)
            {
                string query2 = string.Format("insert into GroupStudent(GroupId,StudentId,Status,AssignmentDate) values('{0}','{1}',(select id from Lookup where Value='InActive'),'{2}')", intList[count - 1], ob.Id, DateTime.Now);
                DataBaseConnection.getInstance().executeQuery(query2);
            }
            txtRegistrationSearch.Text = "";
            dataGridView1.DataSource   = null;
        }
Ejemplo n.º 8
0
        // DataBaseConnection.getInstance().conStr = "Data Source=DESKTOP-3RUJBK3\\SQLEXPRESS;Initial Catalog=deProjectMini;Integrated Security=True";

        private void button1_Click(object sender, EventArgs e)
        {
            string query = string.Format("insert into Project(Description,Title) values('{0}','{1}')", textBox2.Text, textBox1.Text);

            DataBaseConnection.getInstance().executeQuery(query);
        }
Ejemplo n.º 9
0
 private void HomePage_Load(object sender, EventArgs e)
 {
     DataBaseConnection.getInstance().conStr = "Data Source=DESKTOP-3RUJBK3\\SQLEXPRESS;Initial Catalog=deProjectMini;Integrated Security=True";
 }