Example #1
0
        public static void RightClickEvent(ref SAPbouiCOM.ContextMenuInfo eventInfo, out bool BubbleEvent)
        {
            if (objWithHoldingTax == null)
            {
                objWithHoldingTax = new Operations();
            }

            SAPbouiCOM.Form objForm = null;
            BubbleEvent = true;
            try
            {
                objForm = MainObject.Instance.B1Application.Forms.Item(eventInfo.FormUID);

                #region UDO Form
                if (objForm.TypeEx == "BYB_T1SWT100UDO" &&
                    eventInfo.BeforeAction &&
                    eventInfo.ItemUID == "0_U_G"

                    )
                {
                    SelfWithholdingTax.addInsertRowRelationMenuUDO(objForm, eventInfo);
                    SelfWithholdingTax.addDeleteRowRelationMenuUDO(objForm, eventInfo);
                }

                if (objForm.TypeEx == "BYB_T1SWT100UDO" &&
                    !eventInfo.BeforeAction &&
                    eventInfo.ItemUID == "0_U_G"

                    )
                {
                    SelfWithholdingTax.removeDeleteRowRelationMenuUDO();
                    SelfWithholdingTax.removeInsertRowRelationMenuUDO();
                }
                #endregion
                #region Invoice
                if (objForm.TypeEx == "133" &&
                    eventInfo.BeforeAction
                    )
                {
                    string strLastActiveForm = MainObject.Instance.B1Application.Forms.ActiveForm.UniqueID;
                    CacheManager.CacheManager.Instance.addToCache("LastActiveForm", strLastActiveForm, CacheManager.CacheManager.objCachePriority.Default);
                }

                if (objForm.TypeEx == "133" &&
                    !eventInfo.BeforeAction)
                {
                    CacheManager.CacheManager.Instance.removeFromCache("LastActiveForm");
                }
                #endregion
            }
            catch (COMException comEx)
            {
                Exception er = new Exception(Convert.ToString("COM Error::" + comEx.ErrorCode + "::" + comEx.Message + "::" + comEx.StackTrace));
                _Logger.Error("", comEx);
            }
            catch (Exception er)
            {
                _Logger.Error("", er);
            }
        }