private void PGECampos_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { PropertyGridEx.PropertyGridEx obj = (PropertyGridEx.PropertyGridEx)s; PropertyGridEx.CustomProperty campo = null; foreach (PropertyGridEx.CustomProperty c in obj.Item) { if (c.Name == e.ChangedItem.Label) { campo = c; break; } } if (campo != null) { //Se asigno un campo if (((Clases.clsNodoTiny)nodoActual.Tag).tipoNodo == Clases.clsEnums.TipoNodo.Expediente) { //Es un expediente Clases.clsCampoDato myCampo = new Clases.clsCampoDato(Clases.clsCampoDato.TipoCampo.Expediente, ((Clases.clsNodoTiny)nodoActual.Tag).idNodo, campo.Tag.ToString()); myCampo.valor = campo.Value.ToString(); myCampo.guardarDatos(); } else if (((Clases.clsNodoTiny)nodoActual.Tag).tipoNodo == Clases.clsEnums.TipoNodo.Documento) { //Es un Documentos Final Clases.clsCampoDato myCampo = new Clases.clsCampoDato(Clases.clsCampoDato.TipoCampo.Documento, PGECampos.Tag.ToString(), campo.Tag.ToString()); myCampo.valor = campo.Value.ToString(); myCampo.guardarDatos(); } } }
public AppSettingsForm(CustomDesignControl[] customDesignControls) { InitializeComponent(); MainForm._settingsXml.LoadFormPosition(this); // Создать компонент с расширенными свойствами _propertyGridEx = new PropertyGridEx.PropertyGridEx(); _propertyGridEx.ShowCustomProperties = true; _propertyGridEx.Dock = DockStyle.Fill; _propertyGridEx.Parent = this; _propertyGridEx.BringToFront(); _propertyGridEx.PropertyValueChanged += _propertyGridEx_PropertyValueChanged; _controls = customDesignControls; foreach (CustomDesignControl cntrl in customDesignControls) { TreeNode addedTreeNode = null; if (cntrl.Description != null) { addedTreeNode = tvSettings.Nodes.Add(cntrl.Description); } else { addedTreeNode = tvSettings.Nodes.Add(cntrl.SettingId); } // Загрузить пользовательские настройки tvSettings.SelectedNode = addedTreeNode; ParseProperty(ParseType.LoadFromFile); } }
public void UpdatePropertyGrid(PropertyGridEx.PropertyGridEx pgProperties) { // Get Attribute information from the database regarding this attribute. //String strQuery = "Select NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS, LOCK_, PRIVATE_ From NETWORKS Where NETWORK_NAME = '" + m_strNetworkName + "'"; String strQuery = "Select NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS From NETWORKS Where NETWORK_NAME = '" + m_strNetworkName + "'"; try { DataSet ds = DBMgr.ExecuteQuery(strQuery); // More random error checking if (ds.Tables[0].Rows.Count != 1) { throw (new Exception()); } else { pgProperties.Item[0].Value = ds.Tables[0].Rows[0].ItemArray[0].ToString(); pgProperties.Item[1].Value = ds.Tables[0].Rows[0].ItemArray[1].ToString(); pgProperties.Item[2].Value = ds.Tables[0].Rows[0].ItemArray[2].ToString(); pgProperties.Item[3].Value = ds.Tables[0].Rows[0].ItemArray[3].ToString(); pgProperties.Item[4].Value = ds.Tables[0].Rows[0].ItemArray[4].ToString(); pgProperties.Item[5].Value = ds.Tables[0].Rows[0].ItemArray[5].ToString(); pgProperties.Item[6].Value = ds.Tables[0].Rows[0].ItemArray[6].ToString(); pgProperties.Refresh(); } } catch (Exception sqlE) { Global.WriteOutput("Error: Cannot update property tool window. " + sqlE.Message); } }
public String SavePropertiesToDatabase(PropertyGridEx.PropertyGridEx pgProperties) { m_strNetworkName = pgProperties.Item[0].Value.ToString(); String strInsert; switch (DBMgr.NativeConnectionParameters.Provider) { case "MSSQL": //strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS,LOCK_,PRIVATE_) VALUES ('" strInsert = "INSERT INTO NETWORKS (NETWORK_NAME, DESCRIPTION, DESIGNER_USERID, DESIGNER_NAME, DATE_CREATED, DATE_LAST_EDIT, NUMBER_SECTIONS) VALUES ('" + pgProperties.Item[0].Value + "', '" + pgProperties.Item[1].Value + "', '" + pgProperties.Item[2].Value + "', '" + pgProperties.Item[3].Value + "', '" + pgProperties.Item[4].Value + "', '" + pgProperties.Item[5].Value + "', '" + pgProperties.Item[6].Value + "')"; break; case "ORACLE": //strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS,LOCK_,PRIVATE_) VALUES ("; strInsert = "INSERT INTO NETWORKS (NETWORK_NAME,DESCRIPTION,DESIGNER_USERID,DESIGNER_NAME,DATE_CREATED,DATE_LAST_EDIT,NUMBER_SECTIONS) VALUES ("; foreach (PropertyGridEx.CustomProperty networkProperty in pgProperties.Item) { if (networkProperty.Value.ToString().ToLower() == "true") { strInsert += "'1', "; } else if (networkProperty.Value.ToString().ToLower() == "false") { strInsert += "'0', "; } else { strInsert += "'" + networkProperty.Value.ToString() + "', "; } } strInsert = strInsert.Remove(strInsert.Length - 2); strInsert += ")"; break; default: throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX"); //break; } try { DBMgr.ExecuteNonQuery(strInsert); } catch (Exception sqlE) { Global.WriteOutput("Error: Insert new network into database failed with, " + sqlE.Message); return(""); } return(m_strNetworkName); }
public void SetNetworkProperties(PropertyGridEx.PropertyGridEx pgProperties, bool bIsModal) { // Initialize the property grid for attributes. pgProperties.Item.Clear(); pgProperties.Item.Add("Network Name", "", !bIsModal, "Network Information", "Display name of the network. (Do not use escape characters in network name i.e. \"\\,'", true); pgProperties.Item.Add("Description", "", false, "Network Information", "Network description", true); pgProperties.Item.Add("Designer UserID", "", false, "Network Information", "User ID of network creator.", true); pgProperties.Item.Add("Designer Name", "", false, "Network Information", "Name of network creator.", true); pgProperties.Item.Add("Date Created", "", true, "Network Information", "Network creation date.", true); pgProperties.Item.Add("Date Last Edit", "", true, "Network Information", "The last date changes were made to the network.", true); pgProperties.Item.Add("Number Sections", "", true, "Network Information", "Number of sections in the network.", true); //pgProperties.Item.Add("Lock", false, false, "Network Information", "True if only the creator and those with specific permissions can modify the network.", true); //pgProperties.Item.Add("Private", false, false, "Network Information", "True if only the creator and those with specific permissions can view the newtwork in the network list.", true); }