Пример #1
0
        private void PutReportToFtp(CodeActivityContext context, int?psId)
        {
            try
            {
                var repF = ARM_Service.REP_Export_ReportObjectClass(User_ID, ReportFormat, Report_id.Get(context), null,
                                                                    HierLev1_ID.Get(context),
                                                                    HierLev2_ID.Get(context),
                                                                    HierLev3_ID.Get(context),
                                                                    psId, JuridicalPerson_ID.Get(context),
                                                                    StartDateTime.Get(context), EndDateTime.Get(context), null, WcfTimeOut.Get(context));

                var doc = LargeData.DownloadData(repF.Key);


                if (!string.IsNullOrEmpty(repF.Value.Error))
                {
                    Error.Set(context, repF.Value.Error);
                }
                else
                {
                    //var fs = new FileStream("C:\\777\\1\\rep_"+p.PS_ID.ToString()+".xls", FileMode.Create, FileAccess.Write);
                    //DataReport.Document.CopyTo(fs);
                    //fs.Close();
                    PutReportToFtp(context, doc);
                }
            }
            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }
        }
Пример #2
0
        protected override bool Execute(CodeActivityContext context)
        {
            Error.Set(context, null);
            var result = new List <int>();

            try
            {
                var hiers     = new List <List <int> >();
                var hiers1Str = new[] { (HierLev1_ID.Get(context) ?? "").ToString(), (HierLev2_ID.Get(context) ?? "").ToString(), (HierLev3_ID.Get(context) ?? "").ToString() };

                for (var level = 0; level < 3; level++)
                {
                    var h   = new List <int>();
                    var str = hiers1Str[level];
                    if (!string.IsNullOrEmpty(str))
                    {
                        str = hiers1Str[level].Replace(",", ";");
                        foreach (var s in str.Split(';'))
                        {
                            int id;
                            if (int.TryParse(s, out id))
                            {
                                h.Add(id);
                            }
                        }
                    }

                    hiers.Add(h);
                }

                var psList = ARM_Service.Tree_GetListPSForHierLevels(hiers[0], hiers[1], hiers[2]);
                if (psList == null || psList.Count == 0)
                {
                    var err = "Не найдено ни одной ПС";
                    Error.Set(context, err);
                    if (!HideException.Get(context))
                    {
                        throw new Exception(err);
                    }
                }

                foreach (var p in psList)
                {
                    result.Add(p.PS_ID);
                }
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            PS_List.Set(context, result);
            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Пример #3
0
        protected override bool Execute(CodeActivityContext context)
        {
            Error.Set(context, null);
            //SectionIntegralComplexResults DataReport;

            if (JuridicalPerson_ID.Get(context) != null)
            {
                PutReportToFtp(context, null);
            }
            else
            {
                List <Dict_P> psList;
                if (PS_ID.Get(context) == null)
                {
                    var hier1 = HierLev1_ID.Get(context);
                    var hier2 = HierLev2_ID.Get(context);
                    var hier3 = HierLev3_ID.Get(context);

                    psList = ARM_Service.Tree_GetListPSForHierLevels(hier1.HasValue ? new List <int> {
                        hier1.Value
                    } : null,
                                                                     hier2.HasValue ? new List <int> {
                        hier2.Value
                    } : null, hier3.HasValue ? new List <int> {
                        hier3.Value
                    } : null);
                }
                else
                {
                    psList = new List <Dict_P> {
                        new Dict_P {
                            PS_ID = (int)PS_ID.Get(context)
                        }
                    };
                }

                if (psList == null || psList.Count == 0)
                {
                    var err = "Не найдено ни одной ПС";
                    Error.Set(context, err);
                    if (!HideException.Get(context))
                    {
                        throw new Exception(err);
                    }
                }


                foreach (var p in psList)
                {
                    PutReportToFtp(context, p.PS_ID);
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }