public void del_sub()
        {
            if (string.IsNullOrEmpty(tbxsubcode.Text))
            {
                MessageBox.Show("Subject code field is empty."); tbxsubcode.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxsubject.Text))
            {
                MessageBox.Show("Subject field is empty."); tbxsubject.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlec.Text))
            {
                MessageBox.Show("Lecture field is empty."); tbxlec.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlab.Text))
            {
                MessageBox.Show("Laboratory field is empty."); tbxlab.Focus(); return;
            }

            UserSubClass z               = new UserSubClass();
            bool         isDeleted       = z.Delete_sub(d1, UserSubClass.Fullname, UserSubClass.Schoolyear, UserSubClass.Semester);
            bool         isDeleteStudsub = z.Delete_Studsub(Convert.ToInt32(d6));

            if (isDeleted && isDeleteStudsub)
            {
                XtraMessageBox.Show("Deleted!");
            }
        }
        private void create_sub()
        {
            if (string.IsNullOrEmpty(tbxsubcode.Text))
            {
                MessageBox.Show("Subject code field is empty."); tbxsubcode.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxsubject.Text))
            {
                MessageBox.Show("Subject field is empty."); tbxsubject.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlec.Text))
            {
                MessageBox.Show("Lecture field is empty."); tbxlec.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlab.Text))
            {
                MessageBox.Show("Laboratory field is empty."); tbxlab.Focus(); return;
            }
            UserSubClass.Subcode     = Convert.ToString(tbxsubcode.Text);
            UserSubClass.Subdescript = Convert.ToString(tbxsubject.Text);
            UserSubClass.Lec         = Convert.ToString(tbxlec.Text);
            UserSubClass.Lab         = Convert.ToString(tbxlab.Text);
            UserSubClass.Units       = Convert.ToString(tbxunits.Text);


            UserSubClass z        = new UserSubClass();
            bool         iscreate = z.createSub(UserSubClass.Subcode, UserSubClass.Subdescript, UserSubClass.Lec, UserSubClass.Lab, UserSubClass.Units, UserSubClass.Fullname, UserSubClass.Schoolyear, UserSubClass.Semester);
        }
Exemplo n.º 3
0
        private void TestBtn_Click(object sender, EventArgs e)
        {
            UserSubClass.TempConnection = string.Concat("Server = ", txtServerName.Text, "; Database = ", txtDatabase.Text, "; Uid = ", txtUsername.Text, "; Pwd = ", txtPassword.Text, "; Port = ", txtPort.Text, ";");
            //Properties.Settings.Default.MyConnectionString = UserSubClass.TempConnection;
            UserSubClass z             = new UserSubClass();
            bool         isTestSuccess = z.test_conn();

            if (!isTestSuccess)
            {
                conn_statusLbl.Text    = "Connection Successful";
                conn_statusLbl.Visible = true;
                SaveBtn.Enabled        = true;
            }
            else
            {
                conn_statusLbl.Text    = "Connection Error!";
                conn_statusLbl.Visible = true;
            }
        }
        public void update_sub()
        {
            if (string.IsNullOrEmpty(tbxsubcode.Text))
            {
                MessageBox.Show("Subject code field is empty."); tbxsubcode.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxsubject.Text))
            {
                MessageBox.Show("Subject field is empty."); tbxsubject.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlec.Text))
            {
                MessageBox.Show("Lecture field is empty."); tbxlec.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxlab.Text))
            {
                MessageBox.Show("Laboratory field is empty."); tbxlab.Focus(); return;
            }

            UserSubClass.Subcode     = Convert.ToString(tbxsubcode.Text);
            UserSubClass.Subdescript = Convert.ToString(tbxsubject.Text);
            UserSubClass.Lec         = Convert.ToString(tbxlec.Text);
            UserSubClass.Lab         = Convert.ToString(tbxlab.Text);
            UserSubClass.Units       = Convert.ToString(tbxunits.Text);
            d7 = Convert.ToInt32(d6);
            UserSubClass z            = new UserSubClass();
            bool         isUpdated    = z.Update_sub(d7, UserSubClass.Fullname, UserSubClass.Schoolyear, UserSubClass.Semester);
            bool         isUpdateStud = z.Update_StudSub(d7);

            if (isUpdated && isUpdateStud)
            {
                XtraMessageBox.Show("Updated!");
            }
            else
            {
                XtraMessageBox.Show("Error unable to update!");
            }
        }
        private void verify()
        {
            if (string.IsNullOrEmpty(tbxscholyer.Text))
            {
                tbxscholyer.Focus(); return;
            }
            if (string.IsNullOrEmpty(tbxsem.Text))
            {
                tbxsem.Focus(); return;
            }

            Char     c    = '-';
            DateTime date = DateTime.Now;
            int      d1   = Convert.ToInt32(date.Year);
            int      d2   = Convert.ToInt32(date.Month);

            string[] schoolyear = Convert.ToString(tbxscholyer.Text).Split(c);
            int      count      = 0;

            foreach (string school in schoolyear)
            {
                int year = Convert.ToInt32(school);
                if ((year >= d1) && (count == 1))
                {
                    if ((string.Compare(Convert.ToString(tbxsem.Text), "2nd") == 0) && d2 < 6)
                    {
                        count++;
                    }
                    if ((string.Compare(Convert.ToString(tbxsem.Text), "1st") == 0) && d2 > 7)
                    {
                        count++;
                    }
                }
                else if ((year <= d1) && (count == 0))
                {
                    count++;
                }
            }
            if (count == 2)
            {
                tbxsubcode.Enabled    = true;
                tbxsubject.Enabled    = true;
                tbxlab.Enabled        = true;
                tbxlec.Enabled        = true;
                tbxunits.Enabled      = true;
                createbtn.Enabled     = true;
                updatebtn.Enabled     = true;
                deletebtn.Enabled     = true;
                tblcreate_sub.Enabled = true;

                UserSubClass.Schoolyear = Convert.ToString(tbxscholyer.Text);
                UserSubClass.Semester   = Convert.ToString(tbxsem.Text);
                UserSubClass z      = new UserSubClass();
                bool         verify = z.insScholYer(UserSubClass.Schoolyear, UserSubClass.Semester);
                if (!verify)
                {
                    XtraMessageBox.Show("ERROR OCCURED!");
                }
                else
                {
                    XtraMessageBox.Show("Verified!");
                }
            }
            else if (count != 2)
            {
                tbxscholyer.Text      = "";
                tbxsubcode.Enabled    = false;
                tbxsubject.Enabled    = false;
                tbxlab.Enabled        = false;
                tbxlec.Enabled        = false;
                tbxunits.Enabled      = false;
                createbtn.Enabled     = false;
                updatebtn.Enabled     = false;
                deletebtn.Enabled     = false;
                tblcreate_sub.Enabled = false;
                XtraMessageBox.Show("Unable to verify school year");
            }
            tbxsubcode.Focus();
        }
 public void Curriculum_Disp()
 {
     Curriculum_data             = UserSubClass.Get_Curriculum();
     Curriculum_table.DataSource = Curriculum_data;
 }
 public void Disp_CurrentSub()
 {
     data = UserSubClass.Get_CurrentSub();
     tblcreate_sub.DataSource = data;
     Cor_tbl.DataSource       = data;
 }
 public void Disp_Curriculum()
 {
     data3 = UserSubClass.Get_StudCurriculum();
     gridcontrol_curriculum.DataSource = data3;
 }
 public void Disp_COR()
 {
     data2 = UserSubClass.Get_COR();
     gridControl_COR.DataSource = data2;
 }
 public void DispAdd_sub()
 {
     data = UserSubClass.Get_AddedSub();
     add_subdtgv.DataSource = data;
 }