Exemplo n.º 1
0
 private void LoadData()
 {
     try
     {
         if (_isAdminconnection)
         {
             RegistrySupport registry = new RegistrySupport();
             String          data     = registry.Read(Settings.PROGRAM_GRID_KEY);
             String[]        programs = data.Split(new String[] { "<limiter1>" }, StringSplitOptions.RemoveEmptyEntries);
             foreach (String program in programs)
             {
                 String[] records = program.Split(new String[] { "<limiter>" }, StringSplitOptions.RemoveEmptyEntries);
                 programsGrid.Rows.Add(records);
             }
         }
         else
         {
             RegistrySupport registry = new RegistrySupport();
             String          data     = registry.Read(Settings.CLIENT_GRID_KEY);
             String[]        programs = data.Split(new String[] { "<limiter1>" }, StringSplitOptions.RemoveEmptyEntries);
             foreach (String program in programs)
             {
                 String[] records = program.Split(new String[] { "<limiter>" }, StringSplitOptions.RemoveEmptyEntries);
                 clientgrid.Rows.Add(records);
             }
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
    public static void SetConnectionDetails()
    {
        RegistrySupport registry = new RegistrySupport();
        String          data     = registry.Read(Settings.PROGRAM_GRID_KEY);

        if (data == null)
        {
            return;
        }

        String[] programs = data.Split(new String[] { "<limiter1>" }, StringSplitOptions.RemoveEmptyEntries);
        Dictionary <String, Dictionary <String, String> > conn = new Dictionary <String, Dictionary <String, String> >();

        foreach (String program in programs)
        {
            String[] records = program.Split(new String[] { "<limiter>" }, StringSplitOptions.RemoveEmptyEntries);
            Dictionary <String, String> details = new Dictionary <String, String>();
            details.Add("NAME", records[0]);
            details.Add("SERVER", records[1]);
            details.Add("USERNAME", records[2]);
            details.Add("PASSWORD", records[3]);
            details.Add("DBNAME", records[4]);
            switch (records[0].ToUpper())
            {
            case "DBSETTINGS":
                conn.Add("SETTINGS", details);
                break;

            case "MASTER":
                conn.Add("MASTER", details);
                break;

            case "WMS":
                conn.Add("WMS", details);
                break;

            case "ABBOT":
                conn.Add("ABBOT", details);
                break;

            case "DONGA":
                conn.Add("DONGA", details);
                break;

            case "CAMBERT":
                conn.Add("CAMBERT", details);
                break;
            }
        }
        DBConnection = conn;
    }
Exemplo n.º 3
0
        public static void SetConnectionDetails()
        {
            RegistrySupport registry = new RegistrySupport();
            String          data     = registry.Read(Settings.PROGRAM_GRID_KEY);

            if (data == null)
            {
                return;
            }

            String[] programs = data.Split(new String[] { "<limiter1>" }, StringSplitOptions.RemoveEmptyEntries);
            Dictionary <String, Dictionary <String, String> > conn = new Dictionary <String, Dictionary <String, String> >();

            foreach (String program in programs)
            {
                String[] records = program.Split(new String[] { "<limiter>" }, StringSplitOptions.RemoveEmptyEntries);
                Dictionary <String, String> details = new Dictionary <String, String>();
                details.Add("SoftwareName", records[0]);
                details.Add("Server", records[1]);
                details.Add("Directory", records[2]);
                details.Add("User", records[3]);
                details.Add("password", records[4]);
                details.Add("Local", records[5]);
                details.Add("isAbbot", records[6]);
                if (records.Count() == 8)
                {
                    details.Add("DatabaseName", records[7]);
                }

                switch (records[0].ToUpper())
                {
                case "DISPATCH":
                    conn.Add("DISPATCH", details);
                    break;

                case "WMS":
                    conn.Add("WMS", details);
                    break;

                case "ABBOT":
                    conn.Add("ABBOT", details);
                    break;

                case "DONGA":
                    conn.Add("DONGA", details);
                    break;

                case "OMS":
                    conn.Add("OMS", details);
                    break;
                }
            }
            DBConnection = conn;

            registry = new RegistrySupport();
            data     = registry.Read(Settings.CLIENT_GRID_KEY);

            if (data == null)
            {
                return;
            }

            programs = data.Split(new String[] { "<limiter1>" }, StringSplitOptions.RemoveEmptyEntries);
            conn     = new Dictionary <String, Dictionary <String, String> >();
            foreach (String program in programs)
            {
                String[] records = program.Split(new String[] { "<limiter>" }, StringSplitOptions.RemoveEmptyEntries);
                Dictionary <String, String> details = new Dictionary <String, String>();
                details.Add("ClientName", records[0]);
                details.Add("Directory", records[1]);
                details.Add("DBTYPE", records[2]);
                conn.Add(records[0], details);
            }
            ClientConnection = conn;
        }