Exemple #1
0
        private void SavaDBConfig(DBInfo info)
        {
            try
            {
                _workSpace = new WorkSpace(SystemUtils.ApplicationPath);
                _workSpace.Load();
                _workSpace.DBInfo = info;

                if (_workSpace.Save())
                {
                    COMM.MySqlDBHelper.ModifyConnectionInfo(_workSpace.DBInfo.Server,
                                                            _workSpace.DBInfo.DBName,
                                                            _workSpace.DBInfo.User,
                                                            _workSpace.DBInfo.PWD);

                    ShowStatusInfo("状态:连接数据库成功!", Color.Blue);
                }
                else
                {
                    // MessageBox.Show("连接数据库失败,请检查数据库配置!", "追溯系统", MessageBoxButtons.OK);
                    ShowStatusInfo("状态:连接数据库失败!", Color.Red);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message.ToString());
            }
        }
Exemple #2
0
        private Data()
        {
            this.Items = new List <WorkSpace>();

            if (!Directory.Exists(Path.Combine(Application.StartupPath, "Data")))
            {
                return;
            }

            // Загрузка
            string[] directories = Directory.GetDirectories(Path.Combine(Application.StartupPath, "Data"), "*", SearchOption.TopDirectoryOnly);

            for (int i = 0; i < directories.Length; i++)
            {
                try
                {
                    Items.Add(WorkSpace.Load(directories[i]));
                }
                catch (Exception) { }
            }
        }