protected override bool Execute(CodeActivityContext context) { try { var res = ARM_Service.BPS_GetPSBalanceExcelDocument2(BalanceId.Get(context), StartDateTime.Get(context), EndDateTime.Get(context), DiscreteType, DataSourceType, isPower, isOffsetFromMoscowEnbledForDrums, IsPowerEquipmentEnabled, 7, null, false); if (res != null) { var ms = new MemoryStream(); res.CopyTo(ms); ms.Position = 0; Document.Set(context, ms); } } catch (Exception ex) { Error.Set(context, ex.Message); if (!HideException.Get(context)) { throw ex; } } return(string.IsNullOrEmpty(Error.Get(context))); }
protected override bool Execute(CodeActivityContext context) { try { var balanceFreeHierarchyUNs = new List <string> { BalanceId.Get(context) }; var balanceResult = ARM_Service.BL_GetFreeHierarchyBalanceResult(balanceFreeHierarchyUNs, StartDateTime.Get(context), EndDateTime.Get(context), null, TExportExcelAdapterType.toXLSx, true, DiscreteType, EnumUnitDigit.Kilo, false, EnumUnitDigit.Kilo, true, false, 3, 3, false, false, false); if (balanceResult != null) { if (balanceResult.CalculatedValues == null || balanceResult.CalculatedValues.Count == 0) { throw new Exception("Документ не сформирован. Неверный идентификатор или баланс удален."); } var calculatedResult = balanceResult.CalculatedValues.First().Value; if (calculatedResult.CompressedDoc == null) { throw new Exception("Документ пуст. Ошибка формирования"); } var ms = new MemoryStream(); CompressUtility.DecompressGZip(calculatedResult.CompressedDoc).CopyTo(ms); ms.Position = 0; Document.Set(context, ms); } } catch (Exception ex) { Error.Set(context, ex.Message); if (!HideException.Get(context)) { throw ex; } } return(string.IsNullOrEmpty(Error.Get(context))); }
protected override bool Execute(CodeActivityContext context) { try { var res = ARM_Service.BPS_GetBalansPSResultAndHtmlDocument2(BalanceId.Get(context), StartDateTime.Get(context), EndDateTime.Get(context), DiscreteType, //.Get(context), DataSourceType, //.Get(context), isPower, //.Get(context), isOffsetFromMoscowEnbledForDrums, //.Get(context), IsPowerEquipmentEnabled, 7, null, false); if (res.Errors != null) { Error.Set(context, res.Errors.ToString()); } var ms = CompressUtility.DecompressGZip(res.HTMLDocument); if (ms != null) { ms.Position = 0; Document.Set(context, ms); } IsHasUnbalanceValue.Set(context, !res.IsHasUnbalanceValue); } catch (Exception ex) { if (!HideException.Get(context)) { throw ex; } } return(true); }