Example #1
0
        protected override void OnStart(string[] args)
        {
            Log.i("OnStart");


            // TODO: test
            ZhiRenHandler.init();
            //string time = String.Format("{0}-{1}-{2} {3}:{4}", 2017, 3, 22, 11, 06);
            //ZhiRenHandler.sendUserVerified("2",time);
            //ZhiRenHandler.GetSubCompany();

            manager.Start();
            Log.i("OnStart End");
        }
Example #2
0
        //newlogs和singlelogs参数二选一
        private void SendToZHIREN_SaveInLOCAL(System.Data.Linq.Table <TFTAttLog> table, LinkedList <TFTAttLog> newLogs, TFTAttLog singlelog)
        {
            //sqlCmd.ExecuteNonQuery();
            if (singlelog != null)
            {
                newLogs = new LinkedList <TFTAttLog>();
                newLogs.AddFirst(singlelog);
            }

            ZhiRenHandler.sendUserVerified(newLogs, response =>
            {
                if (response == null || response.Length == 0)
                {
                    return;
                }

                if (response[0].Code != null)
                {
                    //todo:调试模式下依然按照成功处理 等之人后端搞定之后去除isDebugging判断
                    if (!Log.isDebugging() && response[0].Code.Contains("error"))
                    {
                        Log.e("ZHIREN error" + response[0].ErrorMessage);
                        return;
                    }

                    lock (myObject)
                    {
                        foreach (var log in newLogs)
                        {
                            try
                            {
                                //success
                                table.InsertOnSubmit(log);
                                Log.d("SAVE:" + table.Contains(log));
                                table.Context.SubmitChanges();
                                Log.d("SAVED:" + log);
                            }
                            catch (Exception e)
                            {
                                Log.e(e.Message);
                                if (Log.isDebugging())
                                {
                                    throw new Exception("ERROR");
                                }
                            }
                        }
                    }
                }
            });
        }