Exemplo n.º 1
0
        public PropertiesTab()
        {
            InitializeComponent();
            tabStripProperties.HideMenuGlyph = true;
            dbGridViewProperties             = new dbDataGridView();
            dbGridViewProperties.Dock        = DockStyle.Fill;

            tabStripProperties.AlwaysShowMenuGlyph = false;
        }
        public static DialogResult SaveBeforeWindowHiding(string Caption, dbDataGridView db)
        {
            DialogResult result = DialogResult.Cancel;

            bool checkforValueChanged = false;

            try
            {
                foreach (DataGridViewRow row in db.Rows)
                {
                    if (Convert.ToBoolean(row.Cells[Constants.QUERY_GRID_ISEDITED_HIDDEN].Value))
                    {
                        checkforValueChanged = true;
                        break;
                    }
                }

                if (!checkforValueChanged)
                {
                    return(result);
                }

                result = MessageBox.Show("'" + Caption + "' contains some modified objects. Do you want to save changes?",
                                         Helper.GetResourceString(Constants.PRODUCT_CAPTION), MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in db.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[Constants.QUERY_GRID_ISEDITED_HIDDEN].Value))
                        {
                            int hierarchyLevel = AssemblyInspectorObject.DataSave.GetDepth((long)row.Tag);

                            AssemblyInspectorObject.DataSave.SaveCollection((long)row.Tag, hierarchyLevel);
                        }
                    }
                }
                else
                {
                    foreach (DataGridViewRow row in db.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[Constants.QUERY_GRID_ISEDITED_HIDDEN].Value))
                        {
                            int hierarchyLevel = AssemblyInspectorObject.DataSave.GetDepth((long)row.Tag);
                            AssemblyInspectorObject.DataSave.RefreshObject((long)row.Tag, hierarchyLevel);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.ShowMessage(ex);
            }

            return(result);
        }
Exemplo n.º 3
0
 public static void AddDatagrid(string strClassName, dbDataGridView dbDataGridViewQueryResult)
 {
     if (Instance.ContainsKey(strClassName))
     {
         Instance.Remove(strClassName);
         Instance.Add(strClassName, dbDataGridViewQueryResult);
     }
     else
     {
         Instance.Add(strClassName, dbDataGridViewQueryResult);
     }
 }
Exemplo n.º 4
0
        internal void AddToAttributeList(dbDataGridView datagridAttributeList, TreeNode tempTreeNode)
        {
            string className = string.Empty;

            try
            {
                //If field is not selected and Query Group has no clauses then reset the base class.
                if (datagridAttributeList.Rows.Count == 0)
                {
                    queryBuilder = (GetWindow(Constants.QUERYBUILDER)).Object as QueryBuilder;
                    queryBuilder.CheckForDataGridViewQueryRows();
                }

                //Get the full path of the selected item
                string fullpath = Helper.GetFullPath(tempTreeNode);

                if (tempTreeNode.Parent != null)
                {
                    ProxyType type = AssemblyInspectorObject.DataType.ResolveType(tempTreeNode.Parent.Tag.ToString());
                    className = type != null ? type.FullName : tempTreeNode.Parent.Name;
                }

                //Check if dragged item is from same class or not, if not then dont allow to drag item
                if (Helper.HashTableBaseClass.Count > 0)
                {
                    if (!Helper.HashTableBaseClass.Contains(Helper.BaseClass))
                    {
                        return;
                    }
                }

                //Check whether attributes is allready added in list, if yes dont allow to added again.
                if (!Helper.CheckUniqueNessAttributes(fullpath, datagridAttributeList))
                {
                    return;
                }

                //Add a new row and assing required values.
                Helper.AddElementToAttributeGrid(datagridAttributeList, className, fullpath);

                if (!Helper.HashTableBaseClass.Contains(Helper.BaseClass))
                {
                    Helper.HashTableBaseClass.Add(Helper.BaseClass, string.Empty);
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }
Exemplo n.º 5
0
        private void TreeView_OnContextMenuItemClicked(object sender, DBContextItemClickedEventArg e)
        {
            try
            {
                queryBuilder = ((ViewBase.GetWindow(Constants.QUERYBUILDER)).Object) as QueryBuilder;
                switch (e.Tag.ToString())
                {
                case Common.Constants.CONTEXT_MENU_SHOW_ALL_OBJECTS:
                    ShowAllObjects();
                    break;

                case Common.Constants.CONTEXT_MENU_ADD_TO_ATTRIBUTE:
                    if (queryBuilder != null)
                    {
                        AddToAttributeList(queryBuilder.DataGridViewAttributes, (TreeNode)e.Data);

                        ApplicationObject.ToolWindows.DTE.Windows.Item(Constants.QUERYBUILDER).Activate();
                    }
                    break;

                case Common.Constants.CONTEXT_MENU_EXPRESSION_GROUP:

                    string itmName   = ((ToolStripItem)e.Item).Name;
                    char[] splitChar = { '_' };
                    int    lastIndex = itmName.LastIndexOf("_");
                    int    index     = Convert.ToInt32(itmName.Split(splitChar, itmName.Length - lastIndex)[1].Split(splitChar)[1]);


                    DataGridViewGroup dgvGroup = (DataGridViewGroup)queryBuilder.TableLayoutPanelQueries.Controls[index];

                    dbDataGridView datagridObject = dgvGroup.DataGridViewQuery;
                    bool           rowAdded       = datagridObject.AddToQueryBuilder((TreeNode)e.Data, queryBuilder);
                    if (rowAdded)
                    {
                        queryBuilder = ((ViewBase.GetWindow(Constants.QUERYBUILDER)).Object) as QueryBuilder;
                        queryBuilder.EnableRunQuery = true;
                    }

                    ApplicationObject.ToolWindows.DTE.Windows.Item(Constants.QUERYBUILDER).Activate();
                    break;

                case "Rename":
                    dbtreeviewObject.LabelEdit = true;
                    dbtreeviewObject.SelectedNode.BeginEdit();
                    break;

                case "Delete Folder":
                    FavouriteFolder Fav = new FavouriteFolder(null, ((TreeNode)e.Data).Text);
                    OMEInteraction.UpdateFavourite(Fav);
                    dbtreeviewObject.Nodes.Remove((TreeNode)e.Data);
                    break;

                case "Delete Class":
                    TreeNode tNode      = (TreeNode)e.Data;
                    TreeNode parentNode = ((TreeNode)e.Data).Parent;

                    if (tNode != null && parentNode != null)
                    {
                        Fav = new FavouriteFolder(null, tNode.Parent.Text);

                        parentNode.Nodes.Remove(tNode);
                        if (parentNode.Nodes.Count > 0)
                        {
                            List <string> lststr = new List <string>();
                            foreach (TreeNode tempNode in parentNode.Nodes)
                            {
                                lststr.Add(tempNode.Text);
                            }

                            Fav.ListClass = lststr;
                        }

                        OMEInteraction.SaveFavourite(Fav);
                    }
                    break;
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }