static public bool OpenConnection()
 {
     try
     {
         checker       = new SQLChecker();
         sqlConnection = new MySqlConnection("");
         sqlConnection.Open();
         command             = sqlConnection.CreateCommand();
         command.Connection  = sqlConnection;
         command.CommandText = "SELECT CURRENT_DATE FROM dual";
         open = true;
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(false);
     }
 }
Ejemplo n.º 2
0
 public ViewController(IntPtr handle) : base(handle)
 {
     if (!Backendoptions.IsOpen())
     {
         if (!Backendoptions.OpenConnection())
         {
             System.Diagnostics.Process.GetCurrentProcess().Kill();
         }
     }
     checker = new SQLChecker();
     if (Backendoptions.IsAdmin())
     {
         AAUnitH        = new NSComboBox();
         AAddStClass    = new NSComboBox();
         AGrillParent   = new NSComboBox();
         AGrillStudent  = new NSComboBox();
         ACForm         = new NSComboBox();
         ACClass        = new NSComboBox();
         AALessClL      = new NSComboBox();
         AALessDay      = new NSComboBox();
         AALessRR       = new NSComboBox();
         AALessUH       = new NSComboBox();
         AALessSub      = new NSComboBox();
         AAClassForm    = new NSComboBox();
         AAClassProfile = new NSComboBox();
         ADelGrillSt    = new NSComboBox();
         ADelGrillPar   = new NSComboBox();
         ADelSt         = new NSComboBox();
         ADelTea        = new NSComboBox();
         ADelPar        = new NSComboBox();
         AchCl          = new NSComboBox();
         AChSt          = new NSComboBox();
         ATeaList       = new NSTextField();
         AParList       = new NSTextField();
         AStList        = new NSTextField();
     }
     else
     {
         if (Backendoptions.IsParent())
         {
             PChildList  = new NSComboBox();
             PMyInfo     = new NSTextField();
             PLegitimize = new NSComboBox();
             PNotes      = new NSTextField();
             PWarnings   = new NSTextField();
             PPresance   = new NSTextField();
         }
         else
         {
             if (Backendoptions.IsTeacher())
             {
                 TClass         = new NSComboBox();
                 TWSt           = new NSComboBox();
                 TCNSt          = new NSComboBox();
                 TCNVal         = new NSComboBox();
                 TCNDesc        = new NSComboBox();
                 TNCat          = new NSComboBox();
                 TNSt           = new NSComboBox();
                 TNSub          = new NSComboBox();
                 TNVal          = new NSComboBox();
                 TPreSt         = new NSComboBox();
                 TPreStat       = new NSComboBox();
                 TPreUnit       = new NSComboBox();
                 TPrUnit        = new NSComboBox();
                 TCheckPresance = new NSTextField();
                 TCheckStudent  = new NSTextField();
                 TBest1         = new NSTextField();
             }
             else if (Backendoptions.IsStudent())
             {
                 SWarnings = new NSTextField();
                 SPresance = new NSTextField();
                 SPoints   = new NSTextField();
                 SNotes    = new NSTextField();
                 SyInfo    = new NSTextField();
             }
         }
     }
 }