Beispiel #1
0
        private string ImportItem(ImportTargetItem importTarget)
        {
            var resultStatistic = new StringBuilder();
            var waiter          = new OperationWaiter();

            using (waiter)
            {
                try
                {
                    Log.Info($"Импорт \"{importTarget.Name}\"");

                    var importResult = importTarget.Importer.Import();
                    resultStatistic.AppendLine($"Результат импортирования \"{importTarget.Name}\"");
                    resultStatistic.AppendLine($"  Добавлено: {importResult.AddedCount}");
                    resultStatistic.AppendLine($"  Обновлено: {importResult.UpdatedCount}");
                    resultStatistic.AppendLine($"  Удалено: {importResult.DeletedCount}");
                }
                catch (Exception ex)
                {
                    var errorHead = $"Ошибка импортирования \"{importTarget.Name}\"";

                    Log.Error($"{errorHead}", ex);
                    resultStatistic.AppendLine(errorHead);
                }
                finally
                {
                    resultStatistic.AppendLine($"Затрачено времени: {waiter.TimeFromStart}");
                }
            }

            return(resultStatistic.ToString());
        }
 private bool TryPrintChecks(int customerNumber, decimal costWithoutCommission, decimal commissionValue, decimal cost)
 {
     try
     {
         using (var waiter = new OperationWaiter())
         {
             var check = GetCheck(customerNumber, costWithoutCommission, commissionValue, cost);
             CheckPrinter.Print(check);
             return(true);
         }
     }
     catch (Exception ex)
     {
         var errorMessage = "Ошибка печати чека";
         Log.Error(errorMessage, ex);
         Message.Error(errorMessage);
         return(false);
     }
 }
        private bool TryPrintChecks(decimal cost, decimal totalCost, double quantity, string articleName)
        {
            try
            {
                using (var waiter = new OperationWaiter())
                {
                    var check = new ArticleSaleCheck(cost, totalCost, quantity, Settings.CasherName, articleName);

                    CheckPrinter.Print(check);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                var errorMessage = "Ошибка печати чека";
                Log.Error(errorMessage, ex);
                Message.Error(errorMessage);
                return(false);
            }
        }
Beispiel #4
0
        private bool TryPrintChecks(decimal costWithoutCommision, decimal comissionValue,
                                    decimal totalWithCommission, int customerNumber, string customerName, string customerEmail)
        {
            try
            {
                using (var waiter = new OperationWaiter())
                {
                    var check = new HotWaterCheck(customerNumber, customerName,
                                                  Settings.CasherName, costWithoutCommision, totalWithCommission, customerEmail);

                    CheckPrinter.Print(check);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                var errorMessage = "Ошибка печати чека";
                Log.Error(errorMessage, ex);
                Message.Error(errorMessage);
                return(false);
            }
        }
Beispiel #5
0
        private bool TryPrintChecks(decimal cost, string departmentCode, int customerNumber,
                                    string customerName, string paymentReasonName, string customerEmail)
        {
            try
            {
                using (var waiter = new OperationWaiter())
                {
                    var check = new EnergyCustomerCheck(departmentCode, customerNumber, customerName,
                                                        paymentReasonName, Settings.CasherName, cost, customerEmail);

                    CheckPrinter.Print(check);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                var errorMessage = "Ошибка печати чека";
                Log.Error(errorMessage, ex);
                Message.Error(errorMessage);
                return(false);
            }
        }