Пример #1
0
        public static void SaveDataIfRequired()
        {
            try
            {
                if (HashClassGUID != null)
                {
                    foreach (DictionaryEntry entry in HashClassGUID)
                    {
                        string winCaption = entry.Key.ToString();


                        string caption = GetCaption(winCaption);

                        dbDataGridView dataGridView = ListofModifiedObjects.Instance[winCaption] as dbDataGridView;
                        if (dataGridView != null)
                        {
                            ListofModifiedObjects.SaveBeforeWindowHiding(caption, dataGridView);
                            ListofModifiedObjects.Instance.Remove(winCaption);
                        }
                    }
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.HandleException(oEx);
            }
        }
Пример #2
0
		public PropertiesTab()
		{
			InitializeComponent();
			tabStripProperties.HideMenuGlyph = true;
			dbGridViewProperties = new dbDataGridView();
			dbGridViewProperties.Dock = DockStyle.Fill;

			tabStripProperties.AlwaysShowMenuGlyph = false;
		}
Пример #3
0
        public static void AddElementToAttributeGrid(dbDataGridView dbDataGridAttributes, string className, string fullpath)
        {
            dbDataGridAttributes.Rows.Add(1);
            int index = dbDataGridAttributes.Rows.Count - 1;

            dbDataGridAttributes.Rows[index].Cells[0].Value = fullpath;
            dbDataGridAttributes.Rows[index].Cells[0].Tag   = className;
            dbDataGridAttributes.ClearSelection();
            dbDataGridAttributes.Rows[index].Cells[0].Selected = true;
        }
Пример #4
0
		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 = dbInteraction.GetDepth(row.Tag);

                            Helper.DbInteraction.SaveCollection(row.Tag, hierarchyLevel);
                        }
					}
				}
				else
				{
					foreach (DataGridViewRow row in db.Rows)
					{
						if (Convert.ToBoolean(row.Cells[Constants.QUERY_GRID_ISEDITED_HIDDEN].Value))
						{
							dbInteraction.RefreshObject(row.Tag, 1);
						}
					}
				}
			}
			catch (Exception ex)
			{
				LoggingHelper.ShowMessage(ex);
			}

			return result;
		}
Пример #5
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);
			}
		}
Пример #6
0
        public static void AddElementToAttributeGrid(dbDataGridView dbDataGridAttributes, string className, string fullpath)
        {
            dbDataGridAttributes.Rows.Add(1);
            int index = dbDataGridAttributes.Rows.Count - 1;

            dbDataGridAttributes.Rows[index].Cells[0].Value = fullpath;
            dbDataGridAttributes.Rows[index].Cells[0].Tag   = className;
            dbDataGridAttributes.ClearSelection();
            dbDataGridAttributes.Rows[index].Cells[0].Selected = true;
            ProxyType type         = AssemblyInspectorObject.DataType.ResolveType(className);
            string    newclassName = type != null ? type.FullName : className;

            dbDataGridAttributes.Rows[index].Tag = newclassName;
        }
Пример #7
0
        public static bool CheckUniqueNessAttributes(string fullpath, dbDataGridView datagridAttributeList)
        {
            try
            {
                if (datagridAttributeList.Rows.Count > 0)
                {
                    for (int i = 0; i < datagridAttributeList.Rows.Count; i++)
                    {
                        if (fullpath.Equals(datagridAttributeList.Rows[i].Cells[0].Value.ToString()))
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }

            return(true);
        }
Пример #8
0
		private void InitializeResultDataGridView()
		{
			try
			{
				masterView = new dbDataGridView();
				masterView.Size = Size;
				masterView.ReadOnly = false;
				masterView.EditMode = DataGridViewEditMode.EditOnF2;
				masterView.ScrollBars = ScrollBars.Both;
				masterView.AllowUserToOrderColumns = true;
				masterView.AllowUserToResizeColumns = true;
				masterView.AllowDrop = true;
				masterView.Dock = DockStyle.Fill;
				masterView.SelectionChanged += masterView_SelectionChanged;
				masterView.CellEndEdit += masterView_CellEndEdit;
				masterView.CellBeginEdit += masterView_CellBeginEdit;
				masterView.Click += masterView_Click;
				tableLayoutPanelResultGrid.Controls.Add(masterView, 0, 0);
			}
			catch (Exception oEx)
			{
				LoggingHelper.ShowMessage(oEx);
			}
		}
Пример #9
0
	    /// <summary>
		/// Initialise the Attribute DataGrid
		/// </summary>
		private void InitializeAttributesDataGrid()
		{
			try
			{
				dbDataGridAttributes = new dbDataGridView();

				dbDataGridAttributes.Dock = DockStyle.Fill;
				dbDataGridAttributes.MultiSelect = true;
				dbDataGridAttributes.ColumnHeadersHeight = 12;
				dbDataGridAttributes.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
				DataGridViewCellStyle style = new DataGridViewCellStyle();
				style.BackColor = SystemColors.Control;
				style.ForeColor = Color.Black;
				style.Font = new Font("Tahoma", 8.25F, FontStyle.Bold);
				dbDataGridAttributes.ColumnHeadersDefaultCellStyle = style;
				dbDataGridAttributes.BuildRowContextMenu();
				splitContainerQueryBuilder.Panel2.Controls.Add(dbDataGridAttributes);

				dbDataGridAttributes.PopulateDisplayGrid(Constants.VIEW_ATTRIBUTES, null);

				//Register Event Handlers
				dbDataGridAttributes.DragEnter += dataGridAttributes_DragEnter;
				dbDataGridAttributes.KeyDown += dataGridAttributes_KeyDown;
				dbDataGridAttributes.RowsRemoved += dataGridAttributes_RowsRemoved;
				dbDataGridAttributes.MouseDown += dataGridAttributes_MouseDown;
			}
			catch (Exception oEx)
			{
				LoggingHelper.ShowMessage(oEx);
			}
		}
Пример #10
0
		/// <summary>
		/// Prepares the OMQuery Groups
		/// </summary>
		/// <param name="datagridview"></param>
		/// <returns></returns>
		private static OMQueryGroup PrepareQueryCollection(dbDataGridView datagridview)
		{
			//Get all the columns names from resource
			string fieldColumnName = Helper.GetResourceString(Constants.QUERY_GRID_FIELD);
			string conditionColumnName = Helper.GetResourceString(Constants.QUERY_GRID_CONDITION);
			string valueColumnName = Helper.GetResourceString(Constants.QUERY_GRID_VALUE);
			string operatorColumnName = Helper.GetResourceString(Constants.QUERY_GRID_OPERATOR);

		    OMQueryGroup objectManagerQueryGroup = null;

			try
			{
				OMETrace.WriteFunctionStart();

				int rowCount = datagridview.RowCount;
				if (rowCount > 0)
				{
                   
					objectManagerQueryGroup = new OMQueryGroup();
					string stringOperator = datagridview.Rows[0].Cells[operatorColumnName].Value.ToString();
					CommonValues.LogicalOperators clauseOperator = (CommonValues.LogicalOperators)Enum.Parse(typeof(CommonValues.LogicalOperators), stringOperator);
					for (int i = 0; i < rowCount; i++)
					{
                        string fieldName = datagridview.Rows[i].Cells[fieldColumnName].Value.ToString();
						string stringCondition = datagridview.Rows[i].Cells[conditionColumnName].Value.ToString();
						string className = datagridview.Rows[i].Cells[Constants.QUERY_GRID_CALSSNAME_HIDDEN].Value.ToString();
					    string fieldType = FieldTypeFor(datagridview.Rows[i]);
						//get the value for each expression if value not specified then return null
						string stringValue;
						if (datagridview.Rows[i].Cells[valueColumnName].Value != null)
						{
                            
                                stringValue = datagridview.Rows[i].Cells[valueColumnName].Value.ToString();
                           
                           
						}
						else
							return null;

						OMQueryClause queryClause = new OMQueryClause(className, fieldName, stringCondition, stringValue, clauseOperator, fieldType);
						objectManagerQueryGroup.AddOMQueryClause(queryClause);
					}
				}

				OMETrace.WriteFunctionEnd();
			}
			catch (Exception oEx)
			{
				LoggingHelper.ShowMessage(oEx);
			}

			return objectManagerQueryGroup;
		}
Пример #11
0
 public static void AddElementToAttributeGrid(dbDataGridView dbDataGridAttributes, string className, string fullpath)
 {
     dbDataGridAttributes.Rows.Add(1);
     int index = dbDataGridAttributes.Rows.Count - 1;
     dbDataGridAttributes.Rows[index].Cells[0].Value = fullpath;
     dbDataGridAttributes.Rows[index].Cells[0].Tag = className;
     dbDataGridAttributes.ClearSelection();
     dbDataGridAttributes.Rows[index].Cells[0].Selected = true;
 }
Пример #12
0
		public static bool CheckUniqueNessAttributes(string fullpath, dbDataGridView datagridAttributeList)
		{
			try
			{
				if (datagridAttributeList.Rows.Count > 0)
				{
					for (int i = 0; i < datagridAttributeList.Rows.Count; i++)
					{
						if (fullpath.Equals(datagridAttributeList.Rows[i].Cells[0].Value.ToString()))
							return false;
					}
				}
			}
			catch (Exception oEx)
			{
				LoggingHelper.ShowMessage(oEx);
			}

			return true;
		}
Пример #13
0
 public static void AddElementToAttributeGrid(dbDataGridView dbDataGridAttributes, string className, string fullpath)
 {
     dbDataGridAttributes.Rows.Add(1);
     int index = dbDataGridAttributes.Rows.Count - 1;
     dbDataGridAttributes.Rows[index].Cells[0].Value = fullpath;
     dbDataGridAttributes.Rows[index].Cells[0].Tag = className;
     dbDataGridAttributes.ClearSelection();
     dbDataGridAttributes.Rows[index].Cells[0].Selected = true;
     ProxyType type = AssemblyInspectorObject.DataType.ResolveType(className);
     string newclassName = type != null ? type.FullName : className;
     dbDataGridAttributes.Rows[index].Tag = newclassName;
 }