Exemplo n.º 1
0
 private void LogoutPanel_Click(object sender, EventArgs e)
 {
     Maintab.DisableTab(metroTabPage1);
     LogoutPanel.Enabled = false;
     Pbackup.Enabled     = false;
     username            = null;
     idPre = 0;
     check = false;
 }
Exemplo n.º 2
0
 private void MainForm_Activated(object sender, EventArgs e)
 {
     if (check == false)
     {
         Maintab.DisableTab(metroTabPage1);
     }
     else if (check == true)
     {
         if (idPre == 1)
         {
             Maintab.EnableTab(metroTabPage1);
             LogoutPanel.Enabled = true;
             Pbackup.Enabled     = true;
             foreach (Control c in metroTabPage1.Controls)
             {
                 if (c is Button)
                 {
                     c.Enabled = true;
                 }
             }
         }
         else if (idPre == 2)
         {
             try
             {
                 DataTable dt = Class_Users.usp_getMyprevilages(username);
                 if (dt.Rows[0][0].ToString() == "False" || dt.Rows[0][0].ToString() == string.Empty)
                 {
                     btnAddStudent.Enabled = false;
                 }
                 if (dt.Rows[1][0].ToString() == "False" || dt.Rows[1][0].ToString() == string.Empty)
                 {
                     btnStudentsManagment.Enabled = false;
                 }
                 if (dt.Rows[2][0].ToString() == "False" || dt.Rows[2][0].ToString() == string.Empty)
                 {
                     btnAddSchoolYear.Enabled = false;
                 }
                 if (dt.Rows[3][0].ToString() == "False" || dt.Rows[3][0].ToString() == string.Empty)
                 {
                     btnSchoolYearManagment.Enabled = false;
                 }
                 if (dt.Rows[4][0].ToString() == "False" || dt.Rows[4][0].ToString() == string.Empty)
                 {
                     btnAddFilier.Enabled = false;
                 }
                 if (dt.Rows[5][0].ToString() == "False" || dt.Rows[5][0].ToString() == string.Empty)
                 {
                     btnFiliereManagment.Enabled = false;
                 }
                 if (dt.Rows[6][0].ToString() == "False" || dt.Rows[6][0].ToString() == string.Empty)
                 {
                     btnClasses.Enabled = false;
                 }
                 if (dt.Rows[7][0].ToString() == "False" || dt.Rows[7][0].ToString() == string.Empty)
                 {
                     btnDiscount.Enabled = false;
                 }
                 if (dt.Rows[8][0].ToString() == "False" || dt.Rows[8][0].ToString() == string.Empty)
                 {
                     btnOtherFees.Enabled = false;
                 }
                 if (dt.Rows[9][0].ToString() == "False" || dt.Rows[9][0].ToString() == string.Empty)
                 {
                     btnAddFacture.Enabled = false;
                 }
                 if (dt.Rows[10][0].ToString() == "False" || dt.Rows[10][0].ToString() == string.Empty)
                 {
                     btnFeesMang.Enabled = false;
                 }
                 if (dt.Rows[11][0].ToString() == "False" || dt.Rows[11][0].ToString() == string.Empty)
                 {
                     btnFeeStatic.Enabled = false;
                 }
                 if (dt.Rows[12][0].ToString() == "False" || dt.Rows[12][0].ToString() == string.Empty)
                 {
                     btnLateFees.Enabled = false;
                 }
                 if (dt.Rows[13][0].ToString() == "False" || dt.Rows[13][0].ToString() == string.Empty)
                 {
                     btnUsersMan.Enabled = false;
                 }
                 if (dt.Rows[14][0].ToString() == "False" || dt.Rows[14][0].ToString() == string.Empty)
                 {
                     btnPrev.Enabled = false;
                 }
                 Maintab.EnableTab(metroTabPage1);
                 LogoutPanel.Enabled = true;
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else if (idPre == 0)
         {
             Maintab.DisableTab(metroTabPage1);
             LogoutPanel.Enabled = false;
             Pbackup.Enabled     = false;
             username            = null;
             idPre = 0;
             check = false;
         }
     }
 }