Esempio n. 1
0
        private void btnCreateSde_Click(object sender, EventArgs e)
        {
            setArcgis.init();
            EngineDatabase engine = new EngineDatabase();

            Db db = QuickConfig.Common.setXml.getConfig(ConfigName).Db;

            try
            {
                setDB setdb = new setDB(db.DbSystemUser.User, db.DbSystemUser.Password, db.Datasource);
                foreach (Control ctl in dbControlList)
                {
                    if (ctl is gdbChoose && ((gdbChoose)ctl).Check == true)
                    {
                        string    Name      = ((gdbChoose)ctl).Name;
                        DbSdeUser dbsdeuser = db.DbSdeUserList.Find((DbSdeUser ds) => ds.Name == Name);

                        if (setdb.isUserExist(dbsdeuser.User))
                        {
                            // MessageBox.Show("现势库已存在");

                            if (MessageBox.Show("现势库已存在,是否删除已有的现势库", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                bool res = setdb.deleteUser(dbsdeuser.User);
                                if (res == true)
                                {
                                    MessageBox.Show("现势库删除成功!");
                                }
                                else
                                {
                                    MessageBox.Show("现势库删除失败!");
                                }
                            }
                        }
                        else
                        {
                            string ans1 = engine.createSDE("Oracle", db.Datasource, db.DbSystemUser.User, db.DbSystemUser.Password, dbsdeuser.User, dbsdeuser.Password, dbsdeuser.Tablespace, Common.getSdeEcpFile());
                            setdb.grantUser(dbsdeuser.User);
                            MessageBox.Show("现势库创建结果如下:\r\n" + ans1);
                        }
                    }
                }
            }
            catch (Exception eg)
            {
                MessageBox.Show(eg.Message.ToString());
            }

            MessageBox.Show("企业空间库操作结束");
        }
Esempio n. 2
0
        private void btnInitSde_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("初始化空间库,会删除空间库原有内容,\r\n,请先备空间库库!\r\n继续请点击确定,放弃请点击取消。", "初始化空间库", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
            {
                return;
            }

            if (!checkSDEimportSet())
            {
                return;
            }
            //初始化 esri授权
            setArcgis.init();
            setArcgis.grant();

            EngineDatabase engine = new EngineDatabase();

            Db db = QuickConfig.Common.setXml.getConfig(ConfigName).Db;

            try
            {
                setDB setdb = new setDB(db.DbSystemUser.User, db.DbSystemUser.Password, db.Datasource);
                foreach (Control ctl in dbControlList)
                {
                    if (ctl is gdbChoose && ((gdbChoose)ctl).Check == true)
                    {
                        string    Name      = ((gdbChoose)ctl).Name;
                        DbSdeUser dbsdeuser = db.DbSdeUserList.Find((DbSdeUser ds) => ds.Name == Name);


                        string ans1 = "";
                        if (setdb.isUserExist(dbsdeuser.User))
                        {
                            setdb.grantUser(dbsdeuser.User);
                            ans1 += "用户 " + dbsdeuser.User + "授权成功\r\n";
                        }
                        ans1 += engine.importGDB2SDEWithWorkspace(db.Ip, "sde:oracle10g:" + db.Datasource, dbsdeuser.User, dbsdeuser.Password, dbsdeuser.Gdbfile, db.CS_TYPE, db.WKID, db.Prjpath);
                        MessageBox.Show(dbsdeuser.Label + "创建结果如下:\r\n" + ans1);
                    }
                }
            }
            catch (Exception eg)
            {
                MessageBox.Show(eg.Message.ToString());
            }

            MessageBox.Show("企业空间库初始化完成");
        }