private void DisplayClassProperties() { try { OMETrace.WriteFunctionStart(); if (Helper.ClassName != null) { if (OMEInteraction.GetCurrentConnParams() != null) { if (OMEInteraction.GetCurrentConnParams() != null) { buttonSaveIndex.Enabled = !OMEInteraction.GetCurrentConnParams().ConnectionReadOnly&& !AssemblyInspectorObject.Connection.CheckForClientServer(); labelNoOfObjects.Text = "Number of objects : " + AssemblyInspectorObject.ClassProperties.GetObjectCountForAClass(Helper.ClassName); dbGridViewProperties.Size = Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); ArrayList fieldPropertiesList = GetFieldsForAllClass(); dbGridViewProperties.ReadOnly = false; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_CLASSPOPERTY, fieldPropertiesList); //Enable Disable IsIndexed Checkboxes foreach (DataGridViewRow row in dbGridViewProperties.Rows) { ProxyType type = row.Cells["Type"].Value as ProxyType; if (type.IsEditable && (type.IsPrimitive || type.IsNullable)) { row.Cells[2].ReadOnly = false; } else { row.Cells[2].ReadOnly = true; } } if (!panelForClassPropTable.Controls.Contains(dbGridViewProperties)) { panelForClassPropTable.Controls.Add(dbGridViewProperties); } dbGridViewProperties.Dock = DockStyle.Fill; } } } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Shows all the objects of selected class /// </summary> private void ShowAllObjects() { try { OMETrace.WriteFunctionStart(); ShowObjectsForAClass(); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void DisplayClassProperties() { try { OMETrace.WriteFunctionStart(); if (Helper.ClassName != null) { if (dbInteraction.GetCurrentRecentConnection() != null) if (dbInteraction.GetCurrentRecentConnection().ConnParam != null) { buttonSaveIndex.Enabled = dbInteraction.GetCurrentRecentConnection().ConnParam.Host == null; labelNoOfObjects.Text = "Number of objects : " + dbInteraction.NoOfObjectsforAClass(Helper.ClassName); dbGridViewProperties.Size = Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); ArrayList fieldPropertiesList = GetFieldsForAllClass(); dbGridViewProperties.ReadOnly = false; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_CLASSPOPERTY, fieldPropertiesList); //Enable Disable IsIndexed Checkboxes foreach (DataGridViewRow row in dbGridViewProperties.Rows) { IType type = row.Cells["Type"].Value as IType; if (type.IsEditable) { row.Cells[2].ReadOnly = false; } else row.Cells[2].ReadOnly = true; } if (!panelForClassPropTable.Controls.Contains(dbGridViewProperties)) panelForClassPropTable.Controls.Add(dbGridViewProperties); dbGridViewProperties.Dock = DockStyle.Fill; } } else buttonSaveIndex.Enabled = false; OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Validate/Commit value to control when vlaue changed/enter in datagridview value column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { OMETrace.WriteFunctionStart(); string valueColumn = Helper.GetResourceString(Constants.QUERY_GRID_VALUE); string fieldName = dbDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(); string classname = dbDataGridView.Rows[e.RowIndex].Cells[Constants.QUERY_GRID_CALSSNAME_HIDDEN].Value.ToString(); ProxyType type = dbDataGridView.Rows[e.RowIndex].Cells[5].Value as ProxyType; object value = dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value; if (dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value != null && !string.IsNullOrEmpty(dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value.ToString())) { bool isValid = Validations.ValidateDataType(classname, fieldName, value); if (!isValid) { //reset the previous value if value is not valid dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = m_previousCellValue; } else { //set the changed value if value is valid if (AssemblyInspectorObject.DataType.CheckTypeIsSame(type.DisplayName, typeof(DateTime)) && e.ColumnIndex == 2) { DateTime dt = DateTime.Parse(Convert.ToDateTime(value).ToString("MM/dd/yyyy hh:mm:ss tt")); dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = dt.ToString(); } else { dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = value.ToString(); } } m_previousCellValue = string.Empty; OMETrace.WriteFunctionEnd(); } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Validate/Commit value to control when vlaue changed/enter in datagridview value column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { OMETrace.WriteFunctionStart(); string valueColumn = Helper.GetResourceString(Constants.QUERY_GRID_VALUE); IType type = dbDataGridView.Rows[e.RowIndex].Cells[5].Value as IType; object value = dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value; if (dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value != null && !string.IsNullOrEmpty(dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value.ToString())) { //gridQuery.Rows[j].Cells[Constants.QUERY_GRID_FIELDTYPE_HIDDEN].Value //Validate the entered value bool isValid = Validations.ValidateDataType(FieldTypeForConstraint(dbDataGridView.CurrentCell.OwningRow), value); if (!isValid) { //reset the previous value if value is not valid dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = m_previousCellValue; } else { //set the changed value if value is valid if (type.IsSameAs(typeof(DateTime)) && e.ColumnIndex == 2) { DateTime dt = DateTime.Parse(Convert.ToDateTime(value).ToString("MM/dd/yyyy hh:mm:ss tt")); dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = dt.ToString(); } else { dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = value.ToString(); } } m_previousCellValue = string.Empty; OMETrace.WriteFunctionEnd(); } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public void LoadAppropriatedata() { DefaultSetting(); Helper.ClassName = null; dbInteractionObject = new dbInteraction(); storedclasses = dbInteractionObject.FetchAllStoredClasses(); if (storedclasses != null) { classCount = storedclasses.Count; } //Assembly view disabled for java db. I don't know any other way ICollection keysCollection = storedclasses.Keys; foreach (string str in keysCollection) { if (!str.Contains(",")) { toolStripButtonAssemblyView.Enabled = false; break; } } //Populate the TreeView dbtreeviewObject.AddFavouritFolderFromDatabase(); dbtreeviewObject.AddTreeNode(storedclasses, null); SelectFirstClassNode(); propertiesTab = PropertiesTab.Instance; if (classCount == 0) { propertiesTab.ShowClassProperties = false; toolStripButtonAssemblyView.Enabled = toolStripButtonFlatView.Enabled = false; } recConnection = dbInteraction.GetCurrentRecentConnection(); PopulateSearchStrings(); dbtreeviewObject.Focus(); dbtreeviewObject.Refresh(); OMETrace.WriteFunctionEnd(); instance = this; }
public void DisplayDatabaseProperties() { try { OMETrace.WriteFunctionStart(); dbGridViewProperties.Size = panelDatabaseProperties.Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_DBPROPERTIES, null); dbGridViewProperties.Rows.Add(1); if (AssemblyInspectorObject.Connection.GetTotalDbSize() == -1) { dbGridViewProperties.Rows[0].Cells[0].Value = "NA for Client/Server"; } else { dbGridViewProperties.Rows[0].Cells[0].Value = AssemblyInspectorObject.Connection.GetTotalDbSize() + " bytes"; } dbGridViewProperties.Rows[0].Cells[1].Value = AssemblyInspectorObject.Connection.NoOfClassesInDb().ToString(); if (AssemblyInspectorObject.Connection.GetFreeSizeOfDb() == -1) { dbGridViewProperties.Rows[0].Cells[2].Value = "NA for Client/Server"; } else { dbGridViewProperties.Rows[0].Cells[2].Value = AssemblyInspectorObject.Connection.GetFreeSizeOfDb() + " bytes"; } if (!panelDatabaseProperties.Controls.Contains(dbGridViewProperties)) { panelDatabaseProperties.Controls.Add(dbGridViewProperties); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// RowRemoved: resets the height of the grid if row removed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { try { OMETrace.WriteFunctionStart(); if (dbDataGridView.Rows.Count == 0) { if (OnRowsRemoved != null) { OnRowsRemoved(sender, e); } } else //set the opertator column of the first row readonly false { dbDataGridView.Rows[0].Cells[3].ReadOnly = false; } if (dbDataGridView.RowCount > 0) { int height = dbDataGridView.ColumnHeadersHeight + dbDataGridView.RowTemplate.Height + (dbDataGridView.RowTemplate.Height * dbDataGridView.RowCount); if (dbDataGridView.Height > 106) { dbDataGridView.Height = height; Height = panelTop.Height + height; } } else { dbDataGridView.Height = 106; Height = panelTop.Height + dbDataGridView.Height; } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Load Event of DataGridView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DataGridViewGroup_Load(object sender, EventArgs e) { try { OMETrace.WriteFunctionStart(); //Populate the Query Group operator combobox string[] operatorList = QueryHelper.GetOperators(); dbDataGridView.PopulateDisplayGrid(Constants.VIEW_QUERYBUILDER, null); comboBoxOperator.Items.AddRange(operatorList); comboBoxOperator.SelectedIndex = 0; dbDataGridView.MultiSelect = true; dbDataGridView.OnDBGridCellClick += dbDataGridView_OnDBGridCellClick; //Build context menu specific to rows dbDataGridView.BuildRowContextMenu(); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
internal static string GetFullPath(TreeNode treenode) { StringBuilder fullpath = new StringBuilder(string.Empty); TreeNode treenodeParent; List <string> stringParent = new List <string>(); string parentName = string.Empty; try { OMETrace.WriteFunctionStart(); treenodeParent = treenode.Parent; while (treenodeParent != null && treenodeParent.Tag.ToString() != "Fav Folder" && treenodeParent.Tag.ToString() != "Assembly View") { if (treenodeParent.Name.LastIndexOf(",") != -1) { char[] splitChar = { ',' }; //Set the base class name for selected field BaseClass = treenodeParent.Name; //get parent name from node text parentName = treenodeParent.Name.Split(splitChar)[0]; int classIndex = parentName.LastIndexOf('.'); //get the parent name of selected node parentName = parentName.Substring(classIndex + 1, parentName.Length - classIndex - 1); } else { BaseClass = treenodeParent.Name; int classIndex = treenodeParent.Name.LastIndexOf('.'); //get the parent name of selected node parentName = treenodeParent.Name.Substring(classIndex + 1, treenodeParent.Name.Length - classIndex - 1); } if (!string.IsNullOrEmpty(parentName)) { stringParent.Add(parentName); } if (treenodeParent.Parent != null) { treenodeParent = treenodeParent.Parent; } else { break; } } //Prepare fullpath of the selected node for (int i = stringParent.Count; i > 0; i--) { string parent = stringParent[i - 1] + "."; fullpath.Append(parent); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } return(fullpath.Append(treenode.Name).ToString()); }
/// <summary> /// Set ClassName when the treenode selected /// </summary> /// <param name="node"></param> private void SetClassName(TreeNode node) { try { OMETrace.WriteFunctionStart(); if (node.Parent == null && node.Tag != null && (node.Tag.ToString() == "Fav Folder" || node.Tag.ToString() == "Assembly View")) { PropertiesTab.Instance.ShowClassProperties = false; return; } PropertiesTab.Instance.ShowClassProperties = true; //Check Selected view and set the class name accordingly if (toolStripButtonAssemblyView.Checked || (node.Parent != null) && (node.Parent.Tag.ToString() == "Fav Folder" || node.Tag.ToString() == "Assembly View")) { if (node.FullPath.IndexOf(CONST_BACK_SLASH_CHAR) != -1) { string className = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[1]; if (className.IndexOf(CONST_BACK_SLASH_CHAR) != -1) { className = className.Split(CONST_BACK_SLASH_CHAR)[0]; } Helper.ClassName = className; } else { Helper.ClassName = node.FullPath; } dbAssemblyTreeView.SelectedNode = node; } else { if (!GetRootNode(node).Tag.ToString().Equals("Fav Folder")) { if (Helper.ClassName != null) { if (!Helper.ClassName.Equals(node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0])) { Helper.ClassName = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0]; } } else { Helper.ClassName = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0]; } } dbtreeviewObject.SelectedNode = node; } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }