Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            String scode = comboBox3.Text;

            if (scode.Equals("") || scode.Equals(null))
            {
                MessageBox.Show("Please Enter/Select Teacher ID.");
            }
            else
            {
                MyDbCon         mdb    = new MyDbCon();
                String          sql    = "select * from teacher where tid=" + comboBox3.Text + "";
                MySqlDataReader reader = mdb.selectRow(sql);
                if (reader.HasRows)
                {
                    reader.Read();
                    textBox1.Text = reader.GetString(1);
                    textBox2.Text = reader.GetString(2);
                }
                else
                {
                    MessageBox.Show("Teacher Dosen't Dosen't Exist.");
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            String action = comboBox2.Text;
            String branch = comboBox1.Text;

            if (action.Equals("EDIT"))
            {
                EditBranch eb = new EditBranch(branch);
                this.Hide();
                eb.Show();
            }
            else if (action.Equals("DELETE"))
            {
                MyDbCon md    = new MyDbCon();
                String  query = "delete from branch where bcode=" + comboBox1.Text + "";
                if (md.runQuery(query))
                {
                    MessageBox.Show("Deleted Successfully.");
                    this.Hide();
                    Branch b = new Branch();
                    b.Show();
                }
                else
                {
                    MessageBox.Show("Failed !!");
                }
            }
            else
            {
                MessageBox.Show("Failed to delete.");
            }
        }
        private void SubAssignment_Load(object sender, EventArgs e)
        {
            MyDbCon mdb = new MyDbCon();
            String  sql = "select * from teacher";

            MySqlDataReader reader = mdb.selectRow(sql);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    comboBox2.Items.Add(reader.GetString(0));
                }
            }
            else
            {
                MessageBox.Show("There is no branch.");
            }
            sql = "select * from subject";
            MyDbCon         md      = new MyDbCon();
            MySqlDataReader reader2 = md.selectRow(sql);

            if (reader2.HasRows)
            {
                while (reader2.Read())
                {
                    comboBox1.Items.Add(reader2.GetString(0));
                }
            }
            listUser();
        }
        public string getShortName(int tid)
        {
            //string s;
            string          sql = "select tshort from teacher where tid='" + tid + "'";
            MyDbCon         md  = new MyDbCon();
            MySqlDataReader rd  = md.selectRow(sql);

            if (rd.HasRows)
            {
                rd.Read();
                return(rd.GetString(0));
            }
            return("NULL");
        }
        private void TimeTable_Load(object sender, EventArgs e)
        {
            MyDbCon         md     = new MyDbCon();
            string          sql    = "select * from branch";
            MySqlDataReader reader = md.selectRow(sql);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    comboBox1.Items.Add(reader.GetString(0));
                }
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox2.Text.Equals(textBox3.Text))
     {
         MyDbCon mdb = new MyDbCon();
         String  sql = "UPDATE `admin` SET `password`=" + textBox3.Text + " WHERE  id=1 and password = "******"Password Changed Successfully!!");
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("New and Confirm password dosen't match.");
     }
 }
Ejemplo n.º 7
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            MyDbCon         c      = new MyDbCon();
            String          sql    = "select * from `admin` where `username` = '" + textBox1.Text + "' and `password` = '" + textBox2.Text + "'";
            MySqlDataReader reader = c.selectRow(sql);

            if (reader.HasRows)
            {
                ActiveForm.Hide();
                Home h = new Home();
                h.Show();
            }
            else
            {
                MessageBox.Show(reader.HasRows + ": You have entered wrong id or password.");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MyDbCon         md  = new MyDbCon();
            String          sql = "select ttid from timetable where bcode = '" + comboBox1.Text + "' and bshift = '" + comboBox3.Text + "' and years = '" + comboBox2.Text + "'";
            MySqlDataReader rd  = md.selectRow(sql);

            if (rd.HasRows)
            {
                ShowTimeTable adt = new ShowTimeTable(int.Parse(comboBox1.Text), int.Parse(comboBox2.Text), int.Parse(comboBox3.Text));
                this.Hide();
                adt.Show();
            }
            else
            {
                MessageBox.Show("Time Table Doesn't Exist!! \nClick on Create to create the time table.");
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            MyDbCon         md  = new MyDbCon();
            String          sql = "select ttid from timetable where bcode = '" + comboBox1.Text + "' and bshift = '" + comboBox2.Text + "' and years = '" + comboBox3.Text + "'";
            MySqlDataReader rd  = md.selectRow(sql);

            if (rd.HasRows)
            {
                MessageBox.Show("Time Table already exists!! \nClick to show for update.");
            }
            else
            {
                AddTT adt = new AddTT(int.Parse(comboBox1.Text), int.Parse(comboBox2.Text), int.Parse(comboBox3.Text));
                this.Hide();
                adt.Show();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MyDbCon md    = new MyDbCon();
            String  query = "delete from subject where scode=" + comboBox1.Text + "";

            if (md.runQuery(query))
            {
                MessageBox.Show("Deleted Successfully.");
                this.Hide();
                Subject b = new Subject();
                b.Show();
            }
            else
            {
                MessageBox.Show("Failed !!");
            }
        }
Ejemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyDbCon mdb = new MyDbCon();
            String  sql = "update subject set scode=" + textBox1.Text + ", sname='" + textBox2.Text + "', bcode=" + textBox3.Text + ", years=" + textBox4.Text + " where scode=" + comboBox3.Text;

            if (mdb.runQuery(sql))
            {
                this.Hide();
                MessageBox.Show("Updated Successfully!!");
                Subject sb = new Subject();
                sb.Show();
            }
            else
            {
                MessageBox.Show("Failed !!");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MyDbCon mdb = new MyDbCon();
            String  sql = "UPDATE branch SET bname='" + textBox2.Text + "',byear=" + textBox3.Text + ",bshift=" + textBox4.Text + " WHERE bcode=" + branch + "";

            if (mdb.runQuery(sql))
            {
                this.Hide();
                MessageBox.Show("Updated Succefully !!");
                Branch b = new Branch();
                b.Show();
            }
            else
            {
                MessageBox.Show("There is no branch.");
            }
        }
        private void DeleteSubject_Load(object sender, EventArgs e)
        {
            MyDbCon         mdb    = new MyDbCon();
            String          sql    = "select * from subject";
            MySqlDataReader reader = mdb.selectRow(sql);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    comboBox1.Items.Add(reader.GetString(0));
                }
            }
            else
            {
                MessageBox.Show("There is no branch.");
            }
        }
Ejemplo n.º 14
0
        private void EditTeacher_Load(object sender, EventArgs e)
        {
            MyDbCon         mdb    = new MyDbCon();
            String          sql    = "select * from teacher";
            MySqlDataReader reader = mdb.selectRow(sql);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    comboBox3.Items.Add(reader.GetString(0));
                }
            }
            else
            {
                MessageBox.Show("There is no Teacher.");
            }
        }
        private void EditBranch_Load(object sender, EventArgs e)
        {
            MyDbCon         mdb    = new MyDbCon();
            String          sql    = "select * from branch where bcode = " + branch + "";
            MySqlDataReader reader = mdb.selectRow(sql);

            if (reader.HasRows)
            {
                reader.Read();
                textBox1.Text = reader.GetString(0);
                textBox2.Text = reader.GetString(1);
                textBox3.Text = reader.GetString(2);
                textBox4.Text = reader.GetString(3);
            }
            else
            {
                MessageBox.Show("There is no branch.");
            }
        }
Ejemplo n.º 16
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox3.Text.Equals("") || comboBox3.Text.Equals(null))
     {
         MessageBox.Show("Please Select/Choose The Teacher ID First.");
     }
     else
     {
         MyDbCon mdb = new MyDbCon();
         String  sql = "Update teacher set tname='" + textBox1.Text + "', tshort='" + textBox2.Text + "' where tid=" + comboBox3.Text;
         if (mdb.runQuery(sql))
         {
             MessageBox.Show("Teacher Details Updated Successfully!!");
             this.Hide();
             Teacher t = new Teacher();
             t.Show();
         }
         else
         {
             MessageBox.Show("Updation Failed !!");
         }
     }
 }
        private void ShowTimeTable_Load(object sender, EventArgs e)
        {
            label85.Text = "BRANCH CODE : " + branch;
            label86.Text = "YEAR : " + year;
            label87.Text = "SHIFT : " + shift;
            String          sql    = "select * from timetable where bcode='" + branch + "' and years='" + year + "' and bshift='" + shift + "' ";
            MyDbCon         mdb    = new MyDbCon();
            MySqlDataReader reader = mdb.selectRow(sql);

            if (reader.HasRows)
            {
                reader.Read();
                L11.Text = reader.GetString(4);
                T11.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L12.Text = reader.GetString(4);
                T12.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L13.Text = reader.GetString(4);
                T13.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L14.Text = reader.GetString(4);
                T14.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L15.Text = reader.GetString(4);
                T15.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L16.Text = reader.GetString(4);
                T16.Text = getShortName(int.Parse(reader.GetString(5)));

                reader.Read();
                L21.Text = reader.GetString(4);
                T21.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L22.Text = reader.GetString(4);
                T22.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L23.Text = reader.GetString(4);
                T23.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L24.Text = reader.GetString(4);
                T24.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L25.Text = reader.GetString(4);
                T25.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L26.Text = reader.GetString(4);
                T26.Text = getShortName(int.Parse(reader.GetString(5)));

                reader.Read();
                L31.Text = reader.GetString(4);
                T31.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L32.Text = reader.GetString(4);
                T32.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L33.Text = reader.GetString(4);
                T33.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L34.Text = reader.GetString(4);
                T34.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L35.Text = reader.GetString(4);
                T35.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L36.Text = reader.GetString(4);
                T36.Text = getShortName(int.Parse(reader.GetString(5)));

                reader.Read();
                L41.Text = reader.GetString(4);
                T41.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L42.Text = reader.GetString(4);
                T42.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L43.Text = reader.GetString(4);
                T43.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L44.Text = reader.GetString(4);
                T44.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L45.Text = reader.GetString(4);
                T45.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L46.Text = reader.GetString(4);
                T46.Text = getShortName(int.Parse(reader.GetString(5)));

                reader.Read();
                L51.Text = reader.GetString(4);
                T51.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L52.Text = reader.GetString(4);
                T52.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L53.Text = reader.GetString(4);
                T53.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L54.Text = reader.GetString(4);
                T54.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L55.Text = reader.GetString(4);
                T55.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L56.Text = reader.GetString(4);
                T56.Text = getShortName(int.Parse(reader.GetString(5)));


                reader.Read();
                L61.Text = reader.GetString(4);
                T61.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L62.Text = reader.GetString(4);
                T62.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L63.Text = reader.GetString(4);
                T63.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L64.Text = reader.GetString(4);
                T64.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L65.Text = reader.GetString(4);
                T65.Text = getShortName(int.Parse(reader.GetString(5)));
                reader.Read();
                L66.Text = reader.GetString(4);
                T66.Text = getShortName(int.Parse(reader.GetString(5)));
            }
        }