public static void Show() { Console.WriteLine("Chart of Accounts from the current company file"); using (var cn = ConnectionMgr.GetConnection()) { var batch = cn.NewBatch(); var qry = batch.MsgSet.AppendAccountQueryRq(); //if return elements are not specified, the account query can trigger permission errors //because bank and credit card account numbers are included by default qry.IncludeRetElementList.Add("Name"); qry.IncludeRetElementList.Add("AccountType"); batch.SetClosures(qry, b => { var accounts = new QBFCIterator <IAccountRetList, IAccountRet>(b); foreach (var account in accounts) { Console.WriteLine(" Account name:{0}, type {1}", Safe.Value(account.Name), account.AccountType.GetAsString()); } }); batch.Run(); } }
public static void Run() { using (var cn = ConnectionMgr.GetConnection()) { Console.WriteLine("WARNING: this demonstration will change the name of every customer in your company file. Are you sure you want to do this? (y/n)"); switch (Console.ReadKey().KeyChar) { case 'y': case 'Y': break; default: return; } var queryBatch = cn.NewBatch(); var updateBatch = cn.NewBatch(); var qry = queryBatch.MsgSet.AppendCustomerQueryRq(); //specify returned values to limit the size of the XML qry.IncludeRetElementList.Add("ListID"); qry.IncludeRetElementList.Add("EditSequence"); qry.IncludeRetElementList.Add("CompanyName"); queryBatch.SetClosures(qry, b => { var customers = new QBFCIterator <ICustomerRetList, ICustomerRet>(b); foreach (var customer in customers) { var qryMod = updateBatch.MsgSet.AppendCustomerModRq(); qryMod.ListID.SetValue(Safe.Value(customer.ListID)); qryMod.EditSequence.SetValue(Safe.Value(customer.EditSequence)); string tweakedName = Safe.Value(customer.CompanyName) + " tweaked by Zombie"; qryMod.CompanyName.SetValue(Safe.LimitedString(tweakedName, 41)); } }); StatusMgr.Trace("Running query for all edit sequences"); if (!queryBatch.Run()) { return; } StatusMgr.Trace("Updating all customers"); updateBatch.Run(); } }
IEnumerator SetupAsync() { GameObject go = new GameObject("ConnectionMgr"); go.transform.parent = this.transform; mConnectionMgr = go.AddComponent <ConnectionMgr>(); yield return(null); AsyncOperation loadAsync = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(SceneName); yield return(loadAsync); SetupTartgeScene(); yield return(new AsyncOperation()); }
public void Awake() { // Check to see if audio manager exists. AudioMgr audio = FindObjectOfType <AudioMgr>(); if (audio == null) { GameObject.Instantiate(AudioMgrPrefab); } // Check to see if audio manager exists. ConnectionMgr connection = FindObjectOfType <ConnectionMgr>(); if (connection == null) { GameObject.Instantiate(ConnectionMgrPrefab); } }
void Start() { Screen.fullScreen = false; GameObject go = new GameObject("ConnectionMgr"); go.transform.parent = this.transform; mConnectionMgr = go.AddComponent <ConnectionMgr>(); mRadianceMgr = new RadianceManager(); //StartCoroutine(SetupAsync()); ConsoleUI.instance.SetIpAddress(serverAddress); //StartCoroutine(CheckInternetIpAddressAsync()); //1751578 mHistory = go.AddComponent <History>(); //1751578 }
public static void Run() { using (var cn = ConnectionMgr.GetConnection()) { var batch = cn.NewBatch(); var qry = batch.MsgSet.AppendGeneralSummaryReportQueryRq(); qry.GeneralSummaryReportType.SetValue(Interop.QBFC13.ENGeneralSummaryReportType.gsrtSerialNumberInStockBySite); batch.SetClosures(qry, b => { var report = b as IReportRet; for (int idx = 0; idx < Safe.Value(report.NumRows); idx++) { var row = report.ReportData.ORReportDataList.GetAt(idx); if (row.TextRow != null) { Console.WriteLine(row.TextRow.value.GetValue()); } if (row.DataRow != null) { Console.WriteLine(row.DataRow.RowData.value.GetValue()); for (int idb = 0; idb < row.DataRow.ColDataList.Count; idb++) { Console.WriteLine(row.DataRow.ColDataList.GetAt(idb).value.GetValue()); } } } }); batch.Run(); } }
private void button1_Click(object sender, RoutedEventArgs e) { using (var cn = ConnectionMgr.GetConnection()) { Console.WriteLine("Customer list from the current company file"); var batch = cn.NewBatch(); var qryCust = batch.MsgSet.AppendCustomerQueryRq(); batch.SetClosures(qryCust, b => { var customers = new QBFCIterator <ICustomerRetList, ICustomerRet>(b); foreach (var customer in customers) { // Console.WriteLine(Safe.Value(customer.FullName)); } }); batch.Run(); } }
/// <summary> /// Output a simple list of all customers in the company file /// </summary> public static void Show() { using (var cn = ConnectionMgr.GetConnection()) { Console.WriteLine("Customer list from the current company file"); var batch = cn.NewBatch(); var qryCust = batch.MsgSet.AppendCustomerQueryRq(); batch.SetClosures(qryCust, b => { var customers = new QBFCIterator <ICustomerRetList, ICustomerRet>(b); foreach (var customer in customers) { Console.WriteLine(Safe.Value(customer.FullName)); } }); batch.Run(); } }
private static void Main(string[] args) { var menuItems = new string[][] { new string[] { "1", "Customer List (Read Only)" }, new string[] { "2", "Customer Update (NOT Read Only)" }, new string[] { "3", "Account List (Read Only)" }, new string[] { "4", "Serial Number Report" }, new string[] { "Q", "Quit" } }; try { ConnectionMgr.InitDesktop("Zombie demonstration console application"); //the StatusConsole class will direct all error and trace information to the console StatusMgr.AddListener(new StatusConsole(), true); Console.WriteLine("\r\nThis application demonstrates the capabilities of the Zombie Library\r\n"); char c; do { Console.WriteLine("\r\n=====================================================\r\n"); Console.WriteLine(" Please select a demonstration:"); foreach (var item in menuItems) { Console.WriteLine("\r\n\t{0}:\t{1}", item[0], item[1]); } c = Console.ReadKey().KeyChar; switch (c) { case '1': CustomerList.Show(); break; case '2': CustomerUpdate.Run(); break; case '3': AccountList.Show(); break; case '4': SerialNumberReport.Run(); break; case 'Q': case 'q': break; default: Console.WriteLine("unrecognized key: {0}", c); break; } }while (c != 'q' && c != 'Q'); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Thank you for trying Zombie!"); }
public void UpdateList(ClientObjectAttribute clientObjectAttribute) { ConnectionMgr connectionMgr = Launcher.instance.connectionMgr; CTSMarker ctsMarker = connectionMgr.cloudToTcpSocketMap[this]; Launcher.instance.history.UpdateCamera(ctsMarker.sessionId, clientObjectAttribute); //clientObjectAttribute.LightPosZ = 66; if (mList.Count <= 0) { EnqueueAttributeData(clientObjectAttribute); mList.Add(clientObjectAttribute); _count = 0; } else { if (!IsEqual(clientObjectAttribute, mList[mList.Count - 1])) { EnqueueAttributeData(clientObjectAttribute); mList.Add(clientObjectAttribute); _count = 0; Debug.Log(clientObjectAttribute.CameraPosX + " " + clientObjectAttribute.CameraPosY + " " + clientObjectAttribute.CameraPosZ); Debug.Log(clientObjectAttribute.CameraRotX + " " + clientObjectAttribute.CameraRotY + " " + clientObjectAttribute.CameraRotZ); if (!_notPredicted) { //做预测的反馈 double score = Compare(clientObjectAttribute, predictObjectAttribute); // Debug.Log(clientObjectAttribute.CameraPosX+" "+clientObjectAttribute.CameraPosY+" "+ // clientObjectAttribute.CameraPosZ); // Debug.Log(clientObjectAttribute.CameraRotX+" "+clientObjectAttribute.CameraRotY+" "+ // clientObjectAttribute.CameraRotZ); // Debug.Log("偏差值: "+(score/128).ToString("0.00")); // Debug.Log(predictObjectAttribute.CameraPosX+" "+predictObjectAttribute.CameraPosY+" "+ // predictObjectAttribute.CameraPosZ); // Debug.Log(predictObjectAttribute.CameraRotX+" "+predictObjectAttribute.CameraRotY+" "+ // predictObjectAttribute.CameraRotZ); _notPredicted = true; } } //1751578 else { _count++; } if (_count > 5 && _notPredicted) { Debug.Log("!!!!!!!!!!!!!Predict!!!!!!!!!!!!!"); //Record a = Launcher.instance.history.getPredict(ctsMarker.sessionId,clientObjectAttribute); predictObjectAttribute.Param = clientObjectAttribute.Param; //predictObjectAttribute.CameraPosX = (float)a.posX; //predictObjectAttribute.CameraPosY = (float)a.posY; //predictObjectAttribute.CameraPosZ = (float)a.posZ; //predictObjectAttribute.CameraRotX = (float)a.rotX; //predictObjectAttribute.CameraRotY = (float)a.rotY; //predictObjectAttribute.CameraRotZ = (float)a.rotZ; //测试数据 predictObjectAttribute.CameraPosX = (float)-9.745914; predictObjectAttribute.CameraPosY = (float)13.74586; predictObjectAttribute.CameraPosZ = (float)6.888044; predictObjectAttribute.CameraRotX = (float)0.3567473; predictObjectAttribute.CameraRotY = (float)-0.7427009; predictObjectAttribute.CameraRotZ = (float)-0.5666805; //测试结束 predictObjectAttribute.LightPosZ = 66; EnqueueAttributeData(predictObjectAttribute); _notPredicted = false; Debug.Log("!!!!!!!!!!!!!Finish!!!!!!!!!!!!!"); } //1751578 } }
public void QueryForItemsWithOneMissingSucceeds() { var sessionMock = new Mock <IQBSessionManager>(); var msgMock = new Mock <IMsgSetRequest>(); var queryMock = new Mock <ICustomerQuery>(); var requestListMock = new Mock <IRequestList>(); var requestMock = new Mock <IRequest>(); var responseSetMock = new Mock <IMsgSetResponse>(); var responseListMock = new Mock <IResponseList>(); var responseMock = new Mock <IResponse>(); var customerListMock = new Mock <ICustomerRetList>(); var customerMock = new Mock <ICustomerRet>(); var customerNameMock = new Mock <IQBStringType>(); sessionMock.Setup(x => x.CreateMsgSetRequest(It.IsAny <string>(), It.IsAny <short>(), It.IsAny <short>())).Returns(msgMock.Object); //for somre reason we have to explicitly setup these no-op methods on the mock //This only became necessary after the upgrade to QBSDK12 sessionMock.Setup(x => x.EndSession()); sessionMock.Setup(x => x.CloseConnection()); msgMock.Setup(x => x.AppendCustomerQueryRq()).Returns(queryMock.Object); msgMock.Setup(x => x.RequestList).Returns(requestListMock.Object); requestListMock.Setup(x => x.Count).Returns(1); requestListMock.Setup(x => x.GetAt(0)).Returns(requestMock.Object); requestMock.Setup(x => x.Detail).Returns(queryMock.Object); requestMock.Setup(x => x.RequestID).Returns(0); sessionMock.Setup(x => x.DoRequests(msgMock.Object)).Returns(responseSetMock.Object); responseSetMock.Setup(x => x.ResponseList).Returns(responseListMock.Object); responseListMock.Setup(x => x.Count).Returns(1); responseListMock.Setup(x => x.GetAt(0)).Returns(responseMock.Object); responseMock.Setup(x => x.RequestID).Returns("0"); responseMock.Setup(x => x.StatusCode).Returns(500); //500 means some object found, but others not responseMock.Setup(x => x.Detail).Returns(customerListMock.Object); customerListMock.Setup(x => x.Count).Returns(1); customerListMock.Setup(x => x.GetAt(0)).Returns(customerMock.Object); customerMock.Setup(x => x.Name).Returns(customerNameMock.Object); customerNameMock.Setup(x => x.GetValue()).Returns("Kilroy"); using (var cn = ConnectionMgr.GetTestConnection(sessionMock.Object)) { var batch = cn.NewBatch(); var query = batch.MsgSet.AppendCustomerQueryRq(); bool customerFound = false; batch.SetClosures(query, b => { var customers = new QBFCIterator <ICustomerRetList, ICustomerRet>(b); foreach (var customer in customers) { Console.WriteLine(Safe.Value(customer.Name)); customerFound = true; } }, null, true); Assert.Equal(true, batch.Run()); Assert.True(customerFound); } }