示例#1
0
        private void SendEmail(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();
                    SendEmail(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);
            //SectionIntegralComplexResults DataReport;

            if (JuridicalPerson_ID.Get(context) != null)
            {
                SendEmail(context, null);
            }
            else
            {
                List <Dict_P> psList = null;
                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)this.PS_ID.Get(context)
                        }
                    };
                }

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

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

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