public void readSystemSettings()
 {
     try
     {
         string line      = null;
         char[] splitter1 = { ';' };
         char[] splitter2 = { ':' };
         System.IO.TextReader readFile = new StreamReader(".../Main/text/SystemSettings.txt");
         line = readFile.ReadLine();
         if (line != null)
         {
             string   _StringToWrite = loCryptorEngine.DecryptString(line);
             string[] data1          = _StringToWrite.Split(splitter1);
             for (int i = 0; i < data1.Length; i++)
             {
                 string[] data2 = null;
                 data2 = data1[i].Split(splitter2);
                 if (data2[0].ToString() == "CurrentLocationId")
                 {
                     try
                     {
                         cboCurrentLocation.SelectedValue = data2[1].ToString();
                     }
                     catch { }
                 }
                 else if (data2[0].ToString() == "CurrentBranchId")
                 {
                     try
                     {
                         cboCurrentBranch.SelectedValue = data2[1].ToString();
                     }
                     catch { }
                 }
                 else if (data2[0].ToString() == "CurrentConnection")
                 {
                     try
                     {
                         cboCurrentConnection.Text = data2[1].ToString();
                     }
                     catch { }
                 }
             }
         }
         readFile.Close();
         readFile = null;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public void readLicenseCertificate()
 {
     try
     {
         string line      = null;
         char[] splitter1 = { ';' };
         char[] splitter2 = { ':' };
         System.IO.TextReader readFile = new StreamReader(".../Main/text/LicenseCertificate.txt");
         line = readFile.ReadLine();
         if (line != null)
         {
             string   _StringToWrite = loCryptorEngine.DecryptString(line);
             string[] data1          = _StringToWrite.Split(splitter1);
             for (int i = 0; i < data1.Length; i++)
             {
                 string[] data2 = null;
                 data2 = data1[i].Split(splitter2);
                 if (data2[0].ToString() == "ApplicationId")
                 {
                     GlobalVariables.ApplicationId = data2[1].ToString();
                 }
                 if (data2[0].ToString() == "ProcessorId")
                 {
                     GlobalVariables.ProcessorId = data2[1].ToString();
                 }
                 if (data2[0].ToString() == "TrialVersion")
                 {
                     GlobalVariables.TrialVersion = data2[1].ToString();
                 }
                 if (data2[0].ToString() == "LicenseKey")
                 {
                     GlobalVariables.LicenseKey = data2[1].ToString();
                 }
                 if (data2[0].ToString() == "ExpiryDate")
                 {
                     GlobalVariables.lLicenseExpiry = DateTime.Parse(data2[1].ToString());
                 }
             }
         }
         else
         {
             Application.Exit();
         }
         readFile.Close();
         readFile = null;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void TimeLogUI_Load(object sender, EventArgs e)
        {
            string _DatabaseAddress = "";

            try
            {
                string line      = null;
                char[] splitter1 = { ';' };
                char[] splitter2 = { ':' };
                System.IO.TextReader readFile = new StreamReader(".../Main/text/databaseURL.txt");
                line = readFile.ReadLine();
                if (line != null)
                {
                    string _StringToWrite = loCryptoEngine.DecryptString(line);
                    _DatabaseAddress = _StringToWrite;
                }
                readFile.Close();
                readFile = null;
            }
            catch
            { }
            lTime = "";
            dgvTimeLog.DataSource = null;
            DataTable ldtTimeLog = loCommon.getTimeLogByEmployee(lDate, _DatabaseAddress, lBiometricsId);

            dgvTimeLog.DataSource = ldtTimeLog;
            lFromSelection        = false;
        }
Пример #4
0
        public bool connectDatabase()
        {
            string line = null;

            System.IO.TextReader readFile = new StreamReader("...\\databaseconnection.txt");
            line = readFile.ReadLine();
            if (line != null)
            {
                string _StringToRead = loCryptoEngine.DecryptString(line);
                myConnectionString = _StringToRead;
            }
            readFile.Close();
            readFile = null;

            try
            {
                conn = new MySqlConnection(myConnectionString);
                conn.Open();
                GlobalVariables.Connection = conn;
                char[]   splitter1 = { ';' };
                char[]   splitter2 = { '=' };
                string[] database  = myConnectionString.Split(splitter1);
                for (int i = 0; i < database.Length; i++)
                {
                    string[] detail = null;
                    detail = database[i].Split(splitter2);
                    if (detail[0].ToString().Replace(" ", "") == "SERVER")
                    {
                        GlobalVariables.DatabaseServer = detail[1].ToString();
                    }
                    if (detail[0].ToString().Replace(" ", "") == "DATABASE")
                    {
                        GlobalVariables.DatabaseName = detail[1].ToString();
                    }
                    if (detail[0].ToString().Replace(" ", "") == "UID")
                    {
                        GlobalVariables.DatabaseUID = detail[1].ToString();
                    }
                    if (detail[0].ToString().Replace(" ", "") == "PWD")
                    {
                        GlobalVariables.DatabasePWD = detail[1].ToString();
                    }
                    if (detail[0].ToString().Replace(" ", "") == "PORT")
                    {
                        GlobalVariables.DatabasePort = detail[1].ToString();
                    }
                }


                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Пример #5
0
        private void ImportDataUI_Load(object sender, EventArgs e)
        {
            string line = null;

            System.IO.TextReader readFile = new StreamReader("...\\databaseconnection.txt");
            line = readFile.ReadLine();
            if (line != null)
            {
                string _StringToRead = loCryptoEngine.DecryptString(line);
                line = _StringToRead;
            }
            readFile.Close();
            readFile = null;

            if (line != null)
            {
                string[] backuplocation = line.Split(';');
                for (int i = 0; i < backuplocation.Length; i++)
                {
                    string[] item;
                    switch (i)
                    {
                    case 0:
                        item = backuplocation[i].Split('=');
                        txtBackupServer.Text  = item[1].ToString();
                        txtRestoreServer.Text = item[1].ToString();
                        break;

                    case 1:
                        item = backuplocation[i].Split('=');
                        txtBackupDatabase.Text  = item[1].ToString();
                        txtRestoreDatabase.Text = item[1].ToString();
                        break;

                    case 2:
                        item = backuplocation[i].Split('=');
                        txtBackupUserId.Text  = item[1].ToString();
                        txtRestoreUserId.Text = item[1].ToString();
                        break;

                    case 3:
                        item = backuplocation[i].Split('=');
                        txtBackupPassword.Text  = item[1].ToString();
                        txtRestorePassword.Text = item[1].ToString();
                        break;

                    case 4:
                        item = backuplocation[i].Split('=');
                        txtBackupPort.Text  = item[1].ToString();
                        txtRestorePort.Text = item[1].ToString();
                        break;
                    }
                }
            }

            txtSaveToURL.Text = GlobalVariables.BackupPath;
            string pages = tbcBackupRestore.SelectedTab.Text;

            switch (pages)
            {
            case "Backup":
                btnBackupDatabase.Visible  = true;
                btnRestoreDatabase.Visible = false;
                break;

            case "Restore":
                btnRestoreDatabase.Visible = true;
                btnBackupDatabase.Visible  = false;
                break;
            }
        }