示例#1
0
        public void HandleCarStep(CarState cs)
        {
            try
            {
                //Save Database
                IDBCarState db = DataAccess.DataAccess.GetDBCarState();
                db.Add(cs);

                CarStepManagerDelegateClient client = new CarStepManagerDelegateClient();
                client.addCarStepCompleted += new EventHandler <addCarStepCompletedEventArgs>(Service_Completed);
                CredentialSoapHeader header = new CredentialSoapHeader();
                header.Username = SysParameters.AppAPIUsername;
                header.Password = SysParameters.AppAPIPassword;
                string strJson = ConvertModelToJson(cs);

                WebserviceUserState UserState = new WebserviceUserState();
                UserState.TIMES   = 1;
                UserState.MESSAGE = strJson;

                //{"caseId":"a07aa295-e5f0-41bb-858d-277b1e3479ff","lsh":"2016061300000000005","sj":"2016-06-13 17:19:41","zt":"病人上车","reason":"","clid":"101","cccc":2}
                client.addCarStepAsync(header, strJson, UserState);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("", ex);
            }
        }
示例#2
0
        /// <summary>
        /// 重发消息
        /// </summary>
        /// <param name="UserState"></param>
        private void ReSendCarStep(WebserviceUserState UserState)
        {
            try
            {
                Thread.Sleep(SysParameters.APIErrorReSendInterval * 1000);

                string strJson = UserState.MESSAGE;

                CarStepManagerDelegateClient client = new CarStepManagerDelegateClient();
                client.addCarStepCompleted += new EventHandler <addCarStepCompletedEventArgs>(Service_Completed);
                CredentialSoapHeader header = new CredentialSoapHeader();
                header.Username = SysParameters.AppAPIUsername;
                header.Password = SysParameters.AppAPIPassword;

                client.addCarStepAsync(header, strJson, UserState);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("", ex);
            }
        }