예제 #1
0
        /// <summary>
        /// 保存通知记录
        /// </summary>
        /// <param name="purchaerId"> </param>
        /// <param name="transferIds"></param>
        /// <param name="inform"></param>
        /// <param name="result"></param>
        /// <param name="remark"></param>
        /// <param name="operatorAccount"> </param>
        /// <param name="operatorName"> </param>
        /// <returns></returns>
        public bool InformPurchaser(Guid purchaerId, List <Guid> transferIds, InformType inform, InformResult result, string remark, string operatorAccount, string operatorName)
        {
            string sql = string.Empty;

            if (transferIds == null)
            {
                sql = @"UPDATE [T_FlightTransfer]
                   SET [InformStatus] = @InformStatus,InformMethod = @InformMethod,
                    InformRemark = @InformRemark,InformTime=@InformTime,
                    InformerAcount =@InformerAccount,InformerName=@InformerName
                 WHERE PurchaserId = @PurchaserId";
            }
            else
            {
                sql  = @"UPDATE [T_FlightTransfer]
                   SET [InformStatus] = @InformStatus,InformMethod = @InformMethod,
                    InformRemark = @InformRemark,InformTime=@InformTime,
                    InformerAcount =@InformerAccount,InformerName=@InformerName
                 WHERE PurchaserId = @PUrchaserId and TransferId in ('";
                sql += string.Join("','", transferIds);
                sql += "')";
            }


            AddParameter("@PurchaserId", purchaerId);
            AddParameter("@InformStatus", (byte)result);
            AddParameter("@InformMethod", (byte)inform);
            AddParameter("@InformTime", DateTime.Now);
            AddParameter("@InformRemark", remark);
            AddParameter("@InformerAccount", operatorAccount);
            AddParameter("@InformerName", operatorName);
            return(ExecuteNonQuery(sql) > 0);
        }
예제 #2
0
파일: QSService.cs 프로젝트: 842549829/Pool
 /// <summary>
 /// 保存通知记录
 /// </summary>
 /// <param name="purchaerId"> </param>
 /// <param name="transferIds"></param>
 /// <param name="inform"></param>
 /// <param name="result"></param>
 /// <param name="remark"></param>
 /// <param name="operatorAccount"> </param>
 /// <param name="operatorName"> </param>
 /// <returns></returns>
 public static bool InformPurchaser(Guid purchaerId, List <Guid> transferIds, InformType inform, InformResult result, string remark, string operatorAccount, string operatorName)
 {
     using (var command = Factory.CreateCommand())
     {
         var transferInfomationRepository = Factory.CreateTransfeRepository(command);
         return(transferInfomationRepository.InformPurchaser(purchaerId, transferIds, inform, result, remark, operatorAccount, operatorName));
     }
 }
예제 #3
0
        public async void Inform(InformType informType, string version, string message, bool isError, string authenticationBearerToken)
        {
            if (isError)
            {
                _logger.LogError($"{DateTimeOffset.Now}, DeployId {_deploySettings.Id} {version}: {message}");
            }
            else
            {
                _logger.LogInformation($"{DateTimeOffset.Now}, DeployId {_deploySettings.Id} {version}: {message}");
            }

            UriBuilder builder;

            builder      = new UriBuilder(new Uri(_workerOptions.ManagerUrl));
            builder.Path = "/api/Update/Inform";

            try
            {
                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authenticationBearerToken);

                    string jsonString = JsonSerializer.Serialize(new InformItem()
                    {
                        Date       = DateTime.UtcNow,
                        InformType = informType,
                        AppId      = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName,
                        DeployId   = _deploySettings.Id,
                        Version    = version,
                        Message    = message,
                        IsError    = isError
                    });
                    var content  = new StringContent(jsonString, Encoding.UTF8, "application/json");
                    var response = await client.PostAsync(builder.Uri, content);

                    if (!response.IsSuccessStatusCode)
                    {
                        _logger.LogError($"{DateTimeOffset.Now}, DeployId {_deploySettings.Id} {version}: post of inform data to {builder.ToString()} failed, returning {response.StatusCode.ToString()} {response.ReasonPhrase}");
                    }
                    else
                    {
                        _logger.LogInformation($"{DateTimeOffset.Now}, DeployId {_deploySettings.Id} {version}: post of inform data to {builder.ToString()} succeeded.");
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"{DateTimeOffset.Now}, DeployId {_deploySettings.Id} {version}: post of inform data to {builder.ToString()} failed with exception {ex.ToString()}");
            }
        }
예제 #4
0
파일: QSService.cs 프로젝트: 842549829/Pool
 /// <summary>
 /// 保存某采购的所有通知记录
 /// </summary>
 /// <param name="purchaerId"> </param>
 /// <param name="inform"></param>
 /// <param name="result"></param>
 /// <param name="remark"></param>
 /// <param name="operatorAccount"> </param>
 /// <param name="operatorName"> </param>
 /// <returns></returns>
 public static bool InformPurchaser(Guid purchaerId, InformType inform, InformResult result, string remark, string operatorAccount, string operatorName)
 {
     return(InformPurchaser(purchaerId, null, inform, result, remark, operatorAccount, operatorName));
 }