Exemple #1
0
        void m_deleteContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            try
            {
                ToolStripItem tsItem = e.ClickedItem;

                if (tsItem.Tag != null)
                {
                    ContextItemClickedEventArg arg = new ContextItemClickedEventArg();
                    arg.Item = e.ClickedItem;


                    DataGridViewHitTestType hitTestType = hitTestInfo.Type;

                    if (hitTestType == DataGridViewHitTestType.Cell)
                    {
                        arg.Data = this;//.Rows[hitTestInfo.RowIndex];
                    }



                    if (OnContextMenuItemClicked != null)
                    {
                        OnContextMenuItemClicked(sender, arg);
                    }
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }
Exemple #2
0
        void m_deleteContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            ContextItemClickedEventArg arg = new ContextItemClickedEventArg();

            arg.CancelEventArguments = e;

            DataGridViewHitTestType hitTestType = hitTestInfo.Type;

            if (hitTestType == DataGridViewHitTestType.Cell)
            {
                arg.Data = this;//.Rows[hitTestInfo.RowIndex];
            }


            if (OnContextMenuOpening != null)
            {
                OnContextMenuOpening(sender, arg);
            }
        }
Exemple #3
0
		private static void treeview_OnContextMenuOpening(object sender, ContextItemClickedEventArg e)
		{
			try
			{
				TreeGridView treeview = (TreeGridView) e.Data;
				treeview.EndEdit();

				CancelEventArgs args = e.CancelEventArguments;
				if(dbInteraction.GetCurrentRecentConnection().ConnParam.ConnectionReadOnly)
				{
					args.Cancel = true;
					return;
				}
				if (treeview.SelectedRows.Count > 0)
				{
					DataGridViewRow selectedRow = treeview.SelectedCells[0].OwningRow;
					TreeGridNode treeGridNode = selectedRow as TreeGridNode;

					args.Cancel = !IsSetToNullOperationValidFor(FieldTypeForObjectInRow(selectedRow), treeGridNode.Parent.Tag);
				}
				else
				{
					args.Cancel = true;
				}
				
			}
			catch (Exception ex)
			{
				LoggingHelper.ShowMessage(ex);
			}
		}
Exemple #4
0
		private void treeview_OnContextMenuItemClicked(object sender, ContextItemClickedEventArg e)
		{
		    try
		    {
		        TreeGridView treeview = (TreeGridView) e.Data;
		        if (treeview.SelectedRows.Count <= 0)
		            return;

		        treeview.ContextMenuStrip.Dispose();
		        DialogResult dialogRes =
		            MessageBox.Show("This will set the value to null in the database. Do you want to continue?",
		                            Helper.GetResourceString(Constants.PRODUCT_CAPTION), MessageBoxButtons.YesNo,
		                            MessageBoxIcon.Question);

		        if (dialogRes != DialogResult.Yes)
		            return;

		        TreeGridNode node = (TreeGridNode) treeview.SelectedCells[0].OwningRow;

		        long id = dbInteraction.GetLocalID(treeview.Nodes[0].Tag);

		       
		            dbInteraction.SetFieldToNull(
		                ParentObjectFor(node),
		                CommonValues.UndecorateFieldName(node.Cells[0].Value.ToString()));

	           object obj = null;
				if (id != 0)
				{
					obj = dbInteraction.GetObjById(id);
				}
				else
				{
					MessageBox.Show("This object is already Null.", Helper.GetResourceString(Constants.PRODUCT_CAPTION),
					                MessageBoxButtons.OK, MessageBoxIcon.Information);
				    return;
				}
                
				if (obj != null)
				{
					dbInteraction.RefreshObject(obj, DepthFor(node));

					UpdateResultTable(treeview.SelectedCells[0].OwningRow.Cells[0],
					                  "null",
					                  (TreeGridNode) treeview.SelectedCells[0].OwningRow.Cells[0].OwningRow,
					                  (OMETabStripItem) treeview.Parent, true);

					treeview = dbInteraction.GetObjectHierarchy(obj, FieldTypeNameFor(treeview.Nodes[0]));
					detailsTabs.SelectedItem.Controls.Clear();
					detailsTabs.SelectedItem.Controls.Add(treeview);
					RegisterTreeviewEvents(treeview);
				}
				else //delete tab as teh obj is deleted and delete it from db grid view
				{
					int index = OffsetInCurrentPageFor(ObjectIndexInMasterViewFor((OMETabStripItem) treeview.Parent));
					detailsTabs.RemoveTab(detailsTabs.SelectedItem);
					masterView.Rows.RemoveAt(index - 1);

					if( detailsTabs.SelectedItem !=null )
                        detailsTabs.SelectedItem .Controls.Clear();
					lstObjIdLong.Remove(id);

					int m_pageCount = CurrentPageNumber();
					int startIndex = (CurrentPageNumber()*PagingData.PAGE_SIZE) - PagingData.PAGE_SIZE;
					int endIndex = startIndex + PagingData.PAGE_SIZE;
					labelNoOfObjects.Text = lstObjIdLong.Count.ToString();

					PagingData pgData = new PagingData(startIndex, endIndex);
					pgData.ObjectId = lstObjIdLong;
					if (lstObjIdLong.Count > 0)
					{
						List<Hashtable> hashListResult = dbInteraction.ReturnQueryResults(pgData, false, omQuery.BaseClass,
						                                                                  omQuery.AttributeList);
						Hashtable hAttributes = null;

						if (omQuery != null)
						{
							hAttributes = omQuery.AttributeList;
						}
						masterView.SetDatagridRows(hashListResult, ClassName, hAttributes, 1);
					}

					treeview = dbInteraction.GetObjectHierarchy(ReferencedObjectFor(detailsTabs.SelectedItem), ClassName);

				    if (detailsTabs.SelectedItem != null) detailsTabs.SelectedItem.Controls.Add(treeview);
				    RegisterTreeviewEvents(treeview);

					int delIndex = ObjectIndexInMasterViewFor(detailsTabs.SelectedItem);
					UpdateObjectDetailTablCaptions(delIndex);
				}
			}
			catch (Exception oEx)
			{
				LoggingHelper.ShowMessage(oEx);
			}
		}
Exemple #5
0
        void m_deleteContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
             try
            {
                ToolStripItem tsItem = e.ClickedItem;

                if (tsItem.Tag != null)
                {
                    ContextItemClickedEventArg arg = new ContextItemClickedEventArg();
                    arg.Item = e.ClickedItem;

                    
                    DataGridViewHitTestType hitTestType = hitTestInfo.Type;

                    if (hitTestType == DataGridViewHitTestType.Cell)
                    {
                        arg.Data = this;//.Rows[hitTestInfo.RowIndex];
                    }

                    

                    if (OnContextMenuItemClicked != null)
                        OnContextMenuItemClicked(sender, arg);
                }
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }

        }
Exemple #6
0
        void m_deleteContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {

            ContextItemClickedEventArg arg = new ContextItemClickedEventArg();
            arg.CancelEventArguments = e;

            DataGridViewHitTestType hitTestType = hitTestInfo.Type;

            if (hitTestType == DataGridViewHitTestType.Cell)
            {
                arg.Data = this;//.Rows[hitTestInfo.RowIndex];
            }


            if (OnContextMenuOpening != null)
            {
                OnContextMenuOpening(sender, arg);
            }
        }