private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.layer == LayerMask.NameToLayer("Owner")) { CatchHandler ch = GameManager.Instance.Player.GetComponent <CatchHandler>(); if (ch.CatchSlot.childCount == 0) { fetchObj?.StickReachedGoal(); } } }
public QBRequest DoInvoiceAdd(QBRequest wqObject) { bool sessionBegun = false; bool connectionOpen = false; //Create the session Manager object var sessionManager = new Interop.QBFC11.QBSessionManager(); try { IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", wqObject.QBVersion, 0); //originally was 7 qbxml version supported # 1.1 March 2002 # 2.0 November 2002 # 2.1 June 2003 # 3.0 November 2003 # 4.0 November 2004 # 4.1 June 2005 # 5.0 November 2005 # 6.0 October 2006 requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; try { using (var db = new PreferredFloristDBDataContext()) { customer = db.BC_BillingAddresses.FirstOrDefault(p => p.PF_accountNumber == wqObject.CustomerID); } } catch (Exception ex) { CatchHandler ch = new CatchHandler(); ch.CaptureError(ex); } BuildInvoiceAddRq(requestMsgSet, customer, wqObject); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("", "Site Manager"); connectionOpen = true; try { sessionManager.BeginSession("", ENOpenMode.omMultiUser); } catch { sessionManager.BeginSession("", ENOpenMode.omSingleUser); } sessionBegun = true; //Send the request and get the response from QuickBooks IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet); //End the session and close the connection to QuickBooks sessionManager.EndSession(); sessionBegun = false; sessionManager.CloseConnection(); connectionOpen = false; WalkInvoiceAddRs(responseMsgSet); } catch (Exception ex) { if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } qbTranasctionResponse = 99; qbTransactionResponseDetail = String.Format("AddInvoiceInQuickBooks failed. {0} {1}", ex.InnerException.Message, qbTransactionResponseDetail); CatchHandler ch = new CatchHandler(); ch.CaptureError(ex); } wqObject.QBListID = qbListIDforThisTransaction; wqObject.Status = qbTranasctionResponse; wqObject.StatusMessage = qbTransactionResponseDetail; return wqObject; }