Exemple #1
0
 public void SetValue(Gxml gxml)
 {
     this._name                = gxml.Name;
     this.label.Text           = gxml.Label;
     this.gxml_folderPath.Text = gxml.Path;
     this.gxml_ip.Text         = gxml.Ip;
     this.gxml_user.Text       = gxml.User;
     this.gxml_password.Text   = gxml.Password;
 }
Exemple #2
0
        private void loadAppsInit()
        {
            Apps apps = configset.Apps;

            appsConfig appconfig = new appsConfig();

            appconfig.SetConfigApps(apps);
            appconfig.ConfigName = configName;
            AppInitControlAdd(appconfig);
            // 设置网站安装

            if (apps.WebAppList.Count > 0)
            {
                webSiteInstall websiteinstall = new webSiteInstall();
                websiteinstall.SetInstallWebapps(apps);
                websiteinstall.ConfigName = configName;
                AppInitControlAdd(websiteinstall);
            }

            //设置服务安装
            if (apps.ServiceAppList.Count > 0)
            {
                foreach (ServiceApp serviceapp in apps.ServiceAppList)
                {
                    serviceInstall serviceinstall = new serviceInstall();
                    serviceinstall.SetValue(serviceapp);
                    serviceinstall.ConfigName = configName;
                    AppInitControlAdd(serviceinstall);
                }
            }

            //设置ftp安装
            if (apps.FtpList.Count > 0)
            {
                for (int i = 0; i < apps.FtpList.Count; i++)
                {
                    Ftp            ftp            = apps.FtpList[i];
                    ftpSiteInstall ftpsiteinstall = new ftpSiteInstall();
                    ftpsiteinstall.SetValue(ftp);
                    ftpsiteinstall.ConfigName = configName;
                    AppInitControlAdd(ftpsiteinstall);
                }
            }

            //设置共享目录安装
            if (apps.GxmlList.Count > 0)
            {
                for (int i = 0; i < apps.GxmlList.Count; i++)
                {
                    Gxml        gxml        = apps.GxmlList[i];
                    gxmlInstall gxmlinstall = new gxmlInstall();
                    gxmlinstall.SetValue(gxml);
                    gxmlinstall.ConfigName = configName;
                    AppInitControlAdd(gxmlinstall);
                }
            }
        }
Exemple #3
0
 public void setValue(Gxml gxml)
 {
     this.txt_name.Text         = gxml.Name;
     this.txt_label.Text        = gxml.Label;
     this.txt_path.Text         = gxml.Path;
     this.txt_relativepath.Text = gxml.Relativepath;
     this.txt_ip.Text           = gxml.Ip;
     this.txt_user.Text         = gxml.User;
     this.txt_password.Text     = gxml.Password;
 }
Exemple #4
0
        private void btn_creategxml_Click(object sender, EventArgs e)
        {
            Apps apps = QuickConfig.Common.setXml.getConfig(ConfigName).Apps;
            Gxml gxml = apps.GxmlList.Find((Gxml gx) => gx.Name == this.Name);

            setGXML setgxml = new setGXML();

            setgxml.SetFileRole(gxml.Path, gxml.User);
            setgxml.shareFolder(gxml.Path, gxml.Label, "");
            setMessage.MessageShow("", "共享目录创建成功!", this.btn_creategxml);
        }
Exemple #5
0
        public Object getValue()
        {
            Gxml gxml = new Gxml();

            gxml.Name         = this.txt_name.Text;
            gxml.Label        = this.txt_label.Text;
            gxml.Path         = this.txt_path.Text;
            gxml.Relativepath = this.txt_relativepath.Text;
            gxml.Ip           = this.txt_ip.Text;
            gxml.User         = this.txt_user.Text;
            gxml.Password     = this.txt_password.Text;
            return(gxml);
        }
Exemple #6
0
        private void btnSaveConfig_Click(object sender, EventArgs e)
        {
            if (allControl.Count > 0)
            {
                #region  序
                Control    mfctl = allControl.Find((Control ctl) => (ctl is mainFolder));
                Apps       apps  = new Apps();
                mainFolder mf    = mfctl as mainFolder;
                apps.Name  = mf.Name;
                apps.Label = mf.Label;
                apps.Path  = mf.FolderPath;


                //-- 服务
                List <ServiceApp> serviceapps = new List <ServiceApp>();
                List <Control>    servicesctl = allControl.FindAll((Control ctl) => (ctl is serviceSet));
                if (servicesctl != null && servicesctl.Count > 0)
                {
                    foreach (Control ctl in servicesctl)
                    {
                        serviceSet serviceset = ctl as serviceSet;
                        ServiceApp serviceapp = new ServiceApp();
                        serviceapp.Name         = serviceset.Name;
                        serviceapp.Label        = serviceset.Label;
                        serviceapp.Path         = serviceset.FolderPath;
                        serviceapp.ConfigFolder = serviceset.ConfigFolder;
                        serviceapp.Ip           = serviceset.Ip;
                        serviceapp.Port         = serviceset.Port;

                        ServiceApp oldServiceapp = configset.Apps.ServiceAppList.Find((ServiceApp sa) => sa.Name == serviceset.Name);
                        serviceapp.Relativepath = oldServiceapp.Relativepath;
                        serviceapp.Servicename  = oldServiceapp.Servicename;
                        serviceapp.Installbat   = oldServiceapp.Installbat;
                        serviceapp.Removebat    = oldServiceapp.Removebat;
                        serviceapps.Add(serviceapp);
                    }
                }
                apps.ServiceAppList = serviceapps;
                //-- 网站
                List <WebApp>  webapps    = new List <WebApp>();
                List <Control> webappsctl = allControl.FindAll((Control ctl) => (ctl is webSiteSet));
                if (webappsctl != null && webappsctl.Count > 0)
                {
                    foreach (Control ctl in webappsctl)
                    {
                        webSiteSet websiteset = ctl as webSiteSet;
                        WebApp     webapp     = new WebApp();
                        webapp.Name         = websiteset.Name;
                        webapp.Label        = websiteset.Label;
                        webapp.Path         = websiteset.FolderPath;
                        webapp.ConfigFolder = websiteset.ConfigFolder;
                        webapp.SiteName     = websiteset.SiteName;
                        webapp.Ip           = websiteset.Ip;
                        webapp.Port         = websiteset.Port;
                        webapp.X86bit       = websiteset.X86bit;

                        WebApp oldWebapp = configset.Apps.WebAppList.Find((WebApp sa) => sa.Name == websiteset.Name);
                        webapp.Relativepath = oldWebapp.Relativepath;

                        webapp.VirtualDirList = websiteset.VirtualDirList;

                        webapps.Add(webapp);
                    }
                }
                apps.WebAppList = webapps;

                //--程序
                List <App>     appList = new List <App>();
                List <Control> appsctl = allControl.FindAll((Control ctl) => (ctl is appFolder));
                if (appsctl != null && appsctl.Count > 0)
                {
                    foreach (Control ctl in appsctl)
                    {
                        appFolder appfolder = ctl as appFolder;
                        App       app       = new App();
                        app.Name         = appfolder.Name;
                        app.Label        = appfolder.Label;
                        app.Path         = appfolder.FolderPath;
                        app.ConfigFolder = appfolder.ConfigFolder;

                        App oldApp = configset.Apps.AppList.Find((App sa) => sa.Name == appfolder.Name);
                        app.Relativepath = oldApp.Relativepath;

                        appList.Add(app);
                    }
                }
                apps.AppList = appList;

                //--ftp站点
                List <Ftp>     ftpList = new List <Ftp>();
                List <Control> ftpsctl = allControl.FindAll((Control ctl) => (ctl is ftpSiteSet));
                if (ftpsctl != null && ftpsctl.Count > 0)
                {
                    foreach (Control ctl in ftpsctl)
                    {
                        ftpSiteSet ftpsiteset = ctl as ftpSiteSet;
                        Ftp        ftp        = new Ftp();
                        ftp.Name     = ftpsiteset.Name;
                        ftp.Label    = ftpsiteset.Label;
                        ftp.Path     = ftpsiteset.FolderPath;
                        ftp.Ip       = ftpsiteset.Ip;
                        ftp.User     = ftpsiteset.User;
                        ftp.Password = ftpsiteset.Password;

                        Ftp oldFtp = configset.Apps.FtpList.Find((Ftp sa) => sa.Name == ftpsiteset.Name);
                        ftp.Relativepath = oldFtp.Relativepath;

                        ftpList.Add(ftp);
                    }
                }
                apps.FtpList = ftpList;

                //--共享目录
                List <Gxml>    gxmlList = new List <Gxml>();
                List <Control> gxmlsctl = allControl.FindAll((Control ctl) => (ctl is gxmlSet));
                if (gxmlsctl != null && gxmlsctl.Count > 0)
                {
                    foreach (Control ctl in gxmlsctl)
                    {
                        gxmlSet gxmlset = ctl as gxmlSet;
                        Gxml    gxml    = new Gxml();
                        gxml.Name     = gxmlset.Name;
                        gxml.Label    = gxmlset.Label;
                        gxml.Path     = gxmlset.FolderPath;
                        gxml.Ip       = gxmlset.Ip;
                        gxml.User     = gxmlset.User;
                        gxml.Password = gxmlset.Password;

                        Gxml oldGxml = configset.Apps.GxmlList.Find((Gxml sa) => sa.Name == gxmlset.Name);
                        gxml.Relativepath = oldGxml.Relativepath;

                        gxmlList.Add(gxml);
                    }
                }
                apps.GxmlList = gxmlList;
                #endregion


                #region 数据
                Control       datasourcectl = allControl.Find((Control ctl) => (ctl is dbSet));
                Control       dataimpctl    = allControl.Find((Control ctl) => (ctl is impdataFolder));
                dbSet         dbset         = datasourcectl as dbSet;
                impdataFolder impdatafolder = dataimpctl as impdataFolder;
                Db            db            = new Db();
                db.Name            = dbset.Name;
                db.Label           = impdatafolder.Label;
                db.Ip              = dbset.Ip;
                db.Datasource      = dbset.Datasource;
                db.Datafolder_type = dbset.DataFolder_type;
                db.Datafolder      = dbset.DataFolder;
                db.Relativepath    = configset.Db.Relativepath;

                Control scs = allControl.Find((Control ctl) => (ctl is sdeCoordinateSystemSet));
                if (scs != null)
                {
                    db.CS_TYPE = ((sdeCoordinateSystemSet)scs).CS_TYPE;
                    db.WKID    = ((sdeCoordinateSystemSet)scs).WKID;
                    db.Prjpath = ((sdeCoordinateSystemSet)scs).Prjpath;
                }
                else
                {
                    db.CS_TYPE = "";
                    db.WKID    = "";
                    db.Prjpath = "";
                }

                db.Impfolder = impdatafolder.FolderPath;

                //-- system用户
                Control         systemuserctl   = allControl.Find((Control ctl) => (ctl is dbSystemuserSet));
                dbSystemuserSet dbsystemuserset = systemuserctl as dbSystemuserSet;
                DbSystemUser    dbsystemuser    = new DbSystemUser();
                dbsystemuser.Name     = dbsystemuserset.Name;
                dbsystemuser.Label    = dbsystemuserset.Label;
                dbsystemuser.User     = dbsystemuserset.User;
                dbsystemuser.Password = dbsystemuserset.Password;

                db.DbSystemUser = dbsystemuser;
                //-- 普通用户
                List <DbUser>  dbuserList = new List <DbUser>();
                List <Control> dbusersctl = allControl.FindAll((Control ctl) => (ctl is dbUserSet));
                if (dbusersctl != null && dbusersctl.Count > 0)
                {
                    foreach (Control ctl in dbusersctl)
                    {
                        dbUserSet dbuserset = ctl as dbUserSet;
                        DbUser    dbuser    = new DbUser();
                        dbuser.Name       = dbuserset.Name;
                        dbuser.Label      = dbuserset.Label;
                        dbuser.Tablespace = dbuserset.Tablespace;
                        dbuser.User       = dbuserset.User;
                        dbuser.Password   = dbuserset.Password;

                        Control   dmpchoosectl = allControl.Find((Control cc) => (cc is dmpChoose) && ((cc as dmpChoose).Name == dbuserset.Name));
                        dmpChoose dmpchoose    = dmpchoosectl as dmpChoose;
                        dbuser.Dmpfile = dmpchoose.FilePath;

                        DbUser oldDbuser = configset.Db.DbUserList.Find((DbUser sa) => sa.Name == dbuserset.Name);
                        dbuser.Relativepath = oldDbuser.Relativepath;

                        dbuserList.Add(dbuser);
                    }
                }
                db.DbUserList = dbuserList;
                //-- sde 用户
                List <DbSdeUser> dbsdeuserList = new List <DbSdeUser>();
                List <Control>   dbsdeusersctl = allControl.FindAll((Control ctl) => (ctl is dbSdeUserSet));
                if (dbsdeusersctl != null && dbsdeusersctl.Count > 0)
                {
                    foreach (Control ctl in dbsdeusersctl)
                    {
                        dbSdeUserSet dbsdeuserset = ctl as dbSdeUserSet;
                        DbSdeUser    dbsdeuser    = new DbSdeUser();
                        dbsdeuser.Name       = dbsdeuserset.Name;
                        dbsdeuser.Label      = dbsdeuserset.Label;
                        dbsdeuser.Tablespace = dbsdeuserset.Tablespace;
                        dbsdeuser.User       = dbsdeuserset.User;
                        dbsdeuser.Password   = dbsdeuserset.Password;
                        Control   gdbchoosectl = allControl.Find((Control cc) => (cc is gdbChoose) && ((cc as gdbChoose).Name == dbsdeuserset.Name));
                        gdbChoose gdbchoose    = gdbchoosectl as gdbChoose;
                        dbsdeuser.Gdbfile = gdbchoose.FolderPath;

                        DbSdeUser oldDbsdeuser = configset.Db.DbSdeUserList.Find((DbSdeUser sa) => sa.Name == dbsdeuserset.Name);
                        dbsdeuser.Relativepath = oldDbsdeuser.Relativepath;

                        dbsdeuserList.Add(dbsdeuser);
                    }
                }
                db.DbSdeUserList = dbsdeuserList;
                #endregion
                #region 参数
                Pars           pars    = new Pars();
                List <Par>     parList = new List <Par>();
                List <Control> parsctl = allControl.FindAll((Control ctl) => (ctl is parSet));
                if (parsctl != null && parsctl.Count > 0)
                {
                    foreach (Control ctl in parsctl)
                    {
                        parSet parset = ctl as parSet;
                        Par    par    = new Par();
                        par.Key   = parset.Key;
                        par.Label = parset.Label;
                        par.Value = parset.Value;

                        parList.Add(par);
                    }
                }
                pars.ParList = parList;
                #endregion

                #region 工具
                Definebtns definebtns = new Definebtns();


                List <Btn>     btnList = new List <Btn>();
                List <Control> btnsctl = allControl.FindAll((Control ctl) => (ctl is btnSet));
                if (btnsctl != null && btnsctl.Count > 0)
                {
                    foreach (Control ctl in btnsctl)
                    {
                        btnSet btnset = ctl as btnSet;
                        Btn    btn    = new Btn();
                        btn = btnset.btn;
                        btnList.Add(btn);
                    }
                }

                definebtns.BtnList = btnList;



                #endregion


                #region 备份
                Backup           backup              = new Backup();
                Control          backupfolderctl     = allControl.Find((Control ctl) => (ctl is backupFolder));
                backupFolder     backupfolder        = backupfolderctl as backupFolder;
                Control          backupcontentsetctl = allControl.Find((Control ctl) => (ctl is backupContentSet));
                backupContentSet backupcontentset    = backupcontentsetctl as backupContentSet;
                Control          backupsetctl        = allControl.Find((Control ctl) => (ctl is backupSet));
                backupSet        backupset           = backupsetctl as backupSet;

                backup.Name           = backupfolder.Name;
                backup.Label          = backupfolder.Label;
                backup.Content        = backupcontentset.BackupContent;
                backup.Path           = backupfolder.BackupFolderPath;
                backup.Type           = backupset.Type;
                backup.Type_daytime   = backupset.Type_daytime;
                backup.Type_week      = backupset.Type_week;
                backup.Type_weektime  = backupset.Type_weektime;
                backup.Type_month     = backupset.Type_month;
                backup.Type_monthtime = backupset.Type_monthtime;


                #endregion


                //保存成Set
                configset.Apps       = apps;
                configset.Db         = db;
                configset.Pars       = pars;
                configset.Definebtns = definebtns;
                configset.Backup     = backup;
                saveConfig();

                setMessage.MessageShow("", "保存成功!", this.btnSaveConfig);
            }
        }
Exemple #7
0
        private void loadSetControls()
        {
            Apps apps = configset.Apps;

            //设置主目录
            mainFolder mainfolder = new mainFolder();

            mainfolder.SetValue(apps);
            mainfolder.allControl = allControl;
            mainfolder.set        = configset;
            SetControlAdd(mainfolder);

            //服务设置
            if (apps.ServiceAppList.Count > 0)
            {
                for (int i = 0; i < apps.ServiceAppList.Count; i++)
                {
                    ServiceApp serviceapp = apps.ServiceAppList[i];
                    serviceSet serviceset = new serviceSet();
                    serviceset.SetValue(serviceapp);
                    SetControlAdd(serviceset);
                }
            }

            //网站设置
            if (apps.WebAppList.Count > 0)
            {
                for (int i = 0; i < apps.WebAppList.Count; i++)
                {
                    WebApp     webapp     = apps.WebAppList[i];
                    webSiteSet websiteset = new webSiteSet();
                    websiteset.SetValue(webapp);
                    SetControlAdd(websiteset);
                }
            }

            //客户端程序
            if (apps.AppList.Count > 0)
            {
                for (int i = 0; i < apps.AppList.Count; i++)
                {
                    App       app       = apps.AppList[i];
                    appFolder appfolder = new appFolder();
                    appfolder.SetValue(app);
                    SetControlAdd(appfolder);
                }
            }

            //ftp
            if (apps.FtpList.Count > 0)
            {
                for (int i = 0; i < apps.FtpList.Count; i++)
                {
                    Ftp        ftp        = apps.FtpList[i];
                    ftpSiteSet ftpsiteset = new ftpSiteSet();
                    ftpsiteset.SetValue(ftp);
                    SetControlAdd(ftpsiteset);
                }
            }

            //gxml
            if (apps.GxmlList.Count > 0)
            {
                for (int i = 0; i < apps.GxmlList.Count; i++)
                {
                    Gxml    gxml    = apps.GxmlList[i];
                    gxmlSet gxmlset = new gxmlSet();
                    gxmlset.SetValue(gxml);
                    SetControlAdd(gxmlset);
                }
            }
        }
Exemple #8
0
 public void SetValue(Gxml gxml)
 {
     this._name      = gxml.Name;
     this.label.Text = gxml.Label;
 }
Exemple #9
0
        public void backup(Set set, string toolsFolder, string toolsTempFolder)
        {
            BackupContents bcs = new BackupContents();

            bcs = JsonClassHelper.Json2Class <BackupContents>(set.Backup.Content);

            if (bcs == null || bcs.content == null)
            {
                return;
            }
            else
            {
                exp_tem_path = toolsFolder;
                exp_path     = toolsTempFolder;
                dayString    = DateTime.Now.Year + "-" + (DateTime.Now.Month < 10 ? "0" + DateTime.Now.Month : DateTime.Now.Month + "") + "-" + (DateTime.Now.Day < 10 ? "0" + DateTime.Now.Day : DateTime.Now.Day + ""); //DateTime.Now.ToShortDateString();
                string timeString = DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "--" + DateTime.Now.Second.ToString();

                backup_path = set.Backup.Path + "\\backup-" + dayString + "\\" + timeString;
                if (!System.IO.Directory.Exists(backup_path))
                {
                    System.IO.Directory.CreateDirectory(backup_path);
                }


                setConfig setconfig = new setConfig();
                string    ansStr    = "开始备份数据\r\n";


                if (bcs.content.Find((BackupContent bc) => bc.Name == "sde") != null && bcs.content.Find((BackupContent bc) => bc.Name == "sde").Type.Count > 0)
                {
                    //备份 sde库
                    //初始化 esri授权
                    setArcgis.init();
                    setArcgis.grant();
                }


                foreach (BackupContent bc in bcs.content)
                {
                    if (bc.Type == null)
                    {
                        continue;
                    }


                    foreach (BackupContentType bctype in bc.Type)
                    {
                        if (bc.Name == "dmp")
                        {
                            string name   = bctype.Name;
                            DbUser dbuser = set.Db.DbUserList.Find((DbUser du) => du.Name == name);

                            if (bctype.Set != null && bctype.Set.Count > 0)
                            {
                                string    remoteInfo  = bctype.Set.Find((BackupContentSet bcsset) => bcsset.SetKey == "remoteInfo").SetValue;
                                string [] remoteInfos = remoteInfo.Split(',');

                                setBAT.OracleExpdp(exp_tem_path, exp_path, dbuser.User, dbuser.Password, set.Db.Datasource, dbuser.Label, backup_path, remoteInfos[0], remoteInfos[1], remoteInfos[2], bctype.getValueList("excludeTable"), true);
                                setBAT.FilePackage(exp_tem_path, exp_path, "正在压缩" + dbuser.Label + "dmpdp文件", backup_path + "\\EXP-" + dbuser.User.ToUpper() + ".DMPDP", backup_path + "\\exp-" + dbuser.User, false, null, null, true);
                                File.Delete(backup_path + "\\exp-" + dbuser.User + ".dmpdp");
                                ansStr += dbuser.Label + "数据expdp导出完成\r\n";
                            }
                            else
                            {
                                setBAT.OracleExp(exp_tem_path, exp_path, dbuser.User, dbuser.Password, set.Db.Datasource, dbuser.Label, backup_path, true);
                                setBAT.FilePackage(exp_tem_path, exp_path, "正在压缩" + dbuser.Label + "dmp文件", backup_path + "\\exp-" + dbuser.User + ".dmp", backup_path + "\\exp-" + dbuser.User, false, null, null, true);
                                File.Delete(backup_path + "\\exp-" + dbuser.User + ".dmp");
                                ansStr += dbuser.Label + "数据导出完成\r\n";
                            }
                        }
                        else if (bc.Name == "app")
                        {
                            string type = bctype.Type;
                            string name = bctype.Name;

                            string labelStr    = "";
                            string appfolder   = "";
                            string appfilename = "";

                            dynamic typeObject = System.Reflection.Assembly.Load("QuickConfig.Model").CreateInstance(type, false);;

                            if (typeObject is ServiceApp)
                            {
                                ServiceApp dbuser = set.Apps.ServiceAppList.Find((ServiceApp du) => du.Name == name);
                                labelStr    = dbuser.Label;
                                appfolder   = dbuser.Path;
                                appfilename = dbuser.Label;
                            }
                            else if (typeObject is WebApp)
                            {
                                WebApp dbuser = set.Apps.WebAppList.Find((WebApp du) => du.Name == name);
                                labelStr    = dbuser.Label;
                                appfolder   = dbuser.Path;
                                appfilename = dbuser.Label;
                            }
                            else if (typeObject is App)
                            {
                                App dbuser = set.Apps.AppList.Find((App du) => du.Name == name);
                                labelStr    = dbuser.Label;
                                appfolder   = dbuser.Path;
                                appfilename = dbuser.Label;
                            }
                            else if (typeObject is Ftp)
                            {
                                Ftp dbuser = set.Apps.FtpList.Find((Ftp du) => du.Name == name);
                                labelStr    = dbuser.Label;
                                appfolder   = dbuser.Path;
                                appfilename = dbuser.Label;
                            }
                            else if (typeObject is Gxml)
                            {
                                Gxml dbuser = set.Apps.GxmlList.Find((Gxml du) => du.Name == name);
                                labelStr    = dbuser.Label;
                                appfolder   = dbuser.Path;
                                appfilename = dbuser.Label;
                            }

                            setBAT.FilePackage(exp_tem_path, exp_path, labelStr, appfolder, backup_path + "\\" + appfilename, true, bctype.getValueList("excludeFolder"), bctype.getValueList("excludeFile"), true);

                            ansStr += appfilename + "程序备份完成\r\n";
                        }
                        else if (bc.Name == "sde")
                        {
                            string         name   = bctype.Name;
                            DbSdeUser      dbuser = set.Db.DbSdeUserList.Find((DbSdeUser du) => du.Name == name);
                            EngineDatabase engine = new EngineDatabase();
                            engine.createGDBFile(backup_path, dbuser.Tablespace + ".gdb");
                            string ans1 = engine.exportSDE2GDBWithWorkspace(set.Db.Ip, "sde:oracle10g:" + set.Db.Datasource, dbuser.User, dbuser.Password, backup_path + "\\" + dbuser.Tablespace + ".gdb");
                            // setBAT.FilePackage(exp_tem_path, exp_path, "正在压缩" + dbuser.Label + "gdb文件", backup_path + "\\" + dbuser.Tablespace + ".gdb", backup_path + "\\" + dbuser.User,true,null,null, true);
                            ansStr += dbuser.Label + "导出结果如下:\r\n" + ans1 + "\r\n";

                            ansStr += dbuser.Label + "导出导出完成\r\n";
                        }
                    }
                }
                ansStr += "备份结束\r\n";
                StreamWriter sw = null;
                if (!File.Exists(backup_path + "\\" + dayString + ".log"))
                {
                    //不存在就新建一个文本文件,并写入一些内容
                    sw = File.CreateText(backup_path + "\\" + dayString + ".log");
                }
                else
                {
                    sw = new StreamWriter(backup_path + "\\" + dayString + ".log");
                }

                sw.Write(ansStr);
                sw.Close();
            }
        }
Exemple #10
0
        private void changeDefaultPath(string mainFolder)
        {
            List <Control> servicectl = allControl.FindAll((Control ctl) => (ctl is serviceSet));

            if (servicectl != null && servicectl.Count > 0)
            {
                foreach (Control ctl in servicectl)
                {
                    ServiceApp serviceapp = set.Apps.ServiceAppList.Find((ServiceApp sa) => sa.Name == ((serviceSet)ctl).Name);

                    ((serviceSet)ctl).FolderPath = mainFolder + "\\" + serviceapp.Relativepath;
                }
            }

            List <Control> websitectl = allControl.FindAll((Control ctl) => (ctl is webSiteSet));

            if (websitectl != null && websitectl.Count > 0)
            {
                foreach (Control ctl in websitectl)
                {
                    WebApp webapp = set.Apps.WebAppList.Find((WebApp sa) => sa.Name == ((webSiteSet)ctl).Name);

                    ((webSiteSet)ctl).FolderPath = mainFolder + "\\" + webapp.Relativepath;
                }
            }

            List <Control> appctl = allControl.FindAll((Control ctl) => (ctl is appFolder));

            if (appctl != null && appctl.Count > 0)
            {
                foreach (Control ctl in appctl)
                {
                    App app = set.Apps.AppList.Find((App sa) => sa.Name == ((appFolder)ctl).Name);

                    ((appFolder)ctl).FolderPath = mainFolder + "\\" + app.Relativepath;
                }
            }

            List <Control> ftpctl = allControl.FindAll((Control ctl) => (ctl is ftpSiteSet));

            if (ftpctl != null && ftpctl.Count > 0)
            {
                foreach (Control ctl in ftpctl)
                {
                    Ftp ftp = set.Apps.FtpList.Find((Ftp sa) => sa.Name == ((ftpSiteSet)ctl).Name);

                    ((ftpSiteSet)ctl).FolderPath = mainFolder + "\\" + ftp.Relativepath;
                }
            }

            List <Control> gxmlctl = allControl.FindAll((Control ctl) => (ctl is gxmlSet));

            if (gxmlctl != null && gxmlctl.Count > 0)
            {
                foreach (Control ctl in gxmlctl)
                {
                    Gxml gxml = set.Apps.GxmlList.Find((Gxml sa) => sa.Name == ((gxmlSet)ctl).Name);

                    ((gxmlSet)ctl).FolderPath = mainFolder + "\\" + gxml.Relativepath;
                }
            }

            List <Control> impdatafolderctl = allControl.FindAll((Control ctl) => (ctl is impdataFolder));

            if (impdatafolderctl != null && impdatafolderctl.Count > 0)
            {
                foreach (Control ctl in impdatafolderctl)
                {
                    ((impdataFolder)ctl).FolderPath = mainFolder + "\\" + set.Db.Relativepath;
                }
            }

            List <Control> dmpctl = allControl.FindAll((Control ctl) => (ctl is dmpChoose));

            if (dmpctl != null && dmpctl.Count > 0)
            {
                foreach (Control ctl in dmpctl)
                {
                    DbUser dbuser = set.Db.DbUserList.Find((DbUser sa) => sa.Name == ((dmpChoose)ctl).Name);

                    ((dmpChoose)ctl).FilePath = mainFolder + "\\" + dbuser.Relativepath;
                }
            }

            List <Control> gdbctl = allControl.FindAll((Control ctl) => (ctl is gdbChoose));

            if (gdbctl != null && gdbctl.Count > 0)
            {
                foreach (Control ctl in gdbctl)
                {
                    DbSdeUser dbsdeuser = set.Db.DbSdeUserList.Find((DbSdeUser sa) => sa.Name == ((gdbChoose)ctl).Name);

                    ((gdbChoose)ctl).FolderPath = mainFolder + "\\" + dbsdeuser.Relativepath;
                }
            }
        }