void OnStopEditing(bool save) { // Don't do anything if the extension is disabled if (IsExtensionEnabled != true) { return; } // Reset the database-validity flag just in case m_DatabaseIsValid = false; m_DatabaseUsesRepresentation = false; // Destroy the SysInfo reference m_SysInfo = null; // Kill the NCGMP-validity flag g_EditWorkspaceIsValid = false; // Close the Map Unit Legend Form // Mixing UI into the Extension! Balderdash! I should try and make the UserControl listen to edit events... UID theUid = new UIDClass(); theUid.Value = ThisAddIn.IDs.dwnMapUnitLegendEditor; IDockableWindow mapUnitForm = ArcMap.DockableWindowManager.GetDockableWindow(theUid); if (mapUnitForm.IsVisible() == true) { mapUnitForm.Show(false); } }
void InitSysInfo() { sysForm = new sysInfo(); sysForm.Hide(); sysForm.setParam = setParam; showpara = sysForm.ShowSysParam; showParam(); }
public sourceLegendItemSelection(IWorkspace theWorkspace) { InitializeComponent(); sysInfo sourceSysInfo = new sysInfo(theWorkspace); this.grpSourceLegend.Text = sourceSysInfo.ProjName; m_theWorkspace = theWorkspace; PopulateListbox(); }
void OnStartEditing() { // Don't do anything if the extension is disabled if (IsExtensionEnabled != true) { return; } // Check that the workspace being edited is NCGMP-valid. m_EditWorkspace = theEditor.EditWorkspace; m_DatabaseIsValid = ncgmpChecks.IsWorkspaceMinNCGMPCompliant(m_EditWorkspace); //// Check that the SysInfo table is present. //if (m_DatabaseIsValid == true) //{ // m_DatabaseIsValid = ncgmpChecks.IsSysInfoPresent(m_EditWorkspace); //} // Open the SysInfo Table, Look for ProjectID values if (m_DatabaseIsValid == true) { m_SysInfo = new sysInfo(m_EditWorkspace); // If Project Name has not yet been specified, then open the form to set it. if (m_SysInfo.ProjName == null) { Forms.newDatabaseInfo NewInfoForm = new Forms.newDatabaseInfo(); NewInfoForm.ShowDialog(); m_SysInfo.ProjName = NewInfoForm.projTitle; m_SysInfo.ProjAbbr = NewInfoForm.projAbbr; } // Check other Database-validity things m_DatabaseUsesRepresentation = ncgmpChecks.AreRepresentationsUsed(m_EditWorkspace); //m_DatabaseHasStations = ncgmpChecks.IsAzgsStationAddinPresent(m_EditWorkspace); } // From http://resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esrigeodatabase/IWorkspaceEditControl.htm // "By default on simple classes, insert cursors handed out by the geodatabase will internally bypass the CreateRow // and Store mechanisms when creating and updating objects. Tools that use insert cursors include Planarize, // Create Features and the Object Loader. When CreateRow and Store are bypassed, subsequent events are not fired // for clients listening to IEditEvents and IObjectClassEvents." // // I have to do this because the topology tool uses an Insert cursor, bypassing the OnCreate event! IWorkspaceEditControl wsEditControl = (IWorkspaceEditControl)m_EditWorkspace; wsEditControl.SetStoreEventsRequired(); // Set the Global variable that notifies other classes that the database is valid NCGMP g_EditWorkspaceIsValid = true; }
private void Button5_Click(object sender, EventArgs e) { //保存信息 if (sys.SysSec.CheckdbCon(sys.SysSec.dbSvrName, sys.SysSec.dbName, sys.SysSec.dbUserName, sys.SysSec.dbUserPwd) == false) { MessageBox.Show("数据库连接失败,请先设置数据库配置"); return; } myEFContext db = new myEFContext(); int n = db.sysInfo.Count(); if (n == 0) { //新增 sysInfo sysInfo = new sysInfo { companyName = TextBox8.Text, sysName = TextBox10.Text, sysVersion = Application.ProductVersion, sysCreateTime = DateTime.Now, MaxUser = 100, sysDeadTime = DateTime.Now.AddYears(10), sysKey = "", sharePath = "" }; db.sysInfo.Add(sysInfo); db.SaveChanges(); SysSec.companyName = TextBox8.Text; SysSec.sysName = TextBox10.Text; } else if (n == 1) { sysInfo sysInfo = db.sysInfo.First(); sysInfo.companyName = TextBox8.Text; sysInfo.sysName = TextBox10.Text; sysInfo.sysVersion = Application.ProductVersion; db.SaveChanges(); SysSec.companyName = TextBox8.Text; SysSec.sysName = TextBox10.Text; } }
private void SysLoad() { textBox11.Text = sys.SysSec.dbSvrName; textBox4.Text = sys.SysSec.dbName; textBox6.Text = sys.SysSec.dbUserName; textBox5.Text = sys.SysSec.dbUserPwd; myEFContext db = new myEFContext(); sysInfo sysInfo = db.sysInfo.First(); if (sysInfo != null) { TextBox8.Text = sysInfo.companyName; TextBox10.Text = sysInfo.sysName; } }
public void LoadSysData() { //如果没有admin用户,添加该用户 myEFContext db = new myEFContext(); //检查系统设置 int n = db.sysInfo.Count(); if (n == 1) { sysInfo sysInfo = db.sysInfo.First(); SysSec.companyName = sysInfo.companyName; SysSec.sysName = sysInfo.sysName; } n = db.Users.Where(t => t.UserLoginName.ToLower() == "admin").Count(); if (n == 0) { User adminUser = new User { UserLoginName = "admin", UserPassword = SysSec.StringSec("admin"), UserName = "******", Level = 0, Enable = true, remark = "系统内置管理员,不能删除", UserCreateTime = DateTime.Now, LastLoginTime = null }; db.Users.Add(adminUser); db.SaveChanges(); //自动打开系统配置界面 MessageBox.Show("第一次登录使用系统,请设置系统数据"); Form dbset = new sys.SysSet(); dbset.ShowDialog(); } }
private void SysSet_FormClosing(object sender, FormClosingEventArgs e) { //检查数据库连接 if (sys.SysSec.CheckdbCon(sys.SysSec.dbSvrName, sys.SysSec.dbName, sys.SysSec.dbUserName, sys.SysSec.dbUserPwd) == false) { MessageBox.Show("数据库连接失败,确认退出吗?"); Environment.Exit(0); } //检查系统设置 myEFContext db = new myEFContext(); int n = db.sysInfo.Count(); if (n == 1) { sysInfo sysInfo = db.sysInfo.First(); SysSec.companyName = sysInfo.companyName; SysSec.sysName = sysInfo.sysName; } }