Beispiel #1
0
        public void reportcall()
        {
            ReportView rv = new ReportView();
            ReportSet ds = new ReportSet();

            foreach (ReportContainerClass rc in GPData.reportlist)
            {
                if (rc.soptype == 4)
                {
                    valuecontainer = (rc.quantity - (rc.quantity * 2));
                    valuecontainer2 = (rc.price - (rc.price * 2));
                }
                else
                {
                    valuecontainer = rc.quantity;
                    valuecontainer2 = rc.price;
                }
                DataRow cRow = ds.ReportViewer.NewRow();
                cRow["SOPNUMBER"] = rc.sopnumber;
                cRow["ITEMNUMBER"] = rc.itemnumber;
                cRow["ITEMDESCRIPTION"] = rc.itemDescription;
                cRow["CUSTOMERNAME"] = rc.custname;
                cRow["QUANTITY"] = valuecontainer;
                cRow["DOCDATE"] = rc.docdate;
                cRow["PRICE"] = valuecontainer2;
                ds.ReportViewer.Rows.Add(cRow);

            }
            rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + date1 + "\"";
            rv.DataDefinition.FormulaFields["End Date"].Text = "\"" + date2 + "\"";
            rv.DataDefinition.FormulaFields["Customer"].Text = "\"" + customer + "\"";
            rv.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rv;
            crystalReportViewer1.Refresh();
        }
Beispiel #2
0
        private void CleanAdditionalFilters(ReportSet reportSet)
        {
            FilterCollection filters = new FilterCollection();

            foreach (Filter filter in reportSet.Filters)
            {
                if (!(filter is AdditionalFilter))
                {
                    filters.Add(filter);
                }
            }
            reportSet.Filters.Clear();
            reportSet.Filters.AddRange(filters.ToArray());


            // Make sure accessing reportSet.ReportName does not throw an exception.
            string reportName = null;

            try
            {
                reportName = Utility.GetWebReportName(reportSet);
            }
            catch (Exception)
            {
                // Do nothing.
            }

            if (reportName != null)
            {
                AdditionalFiltersStorage.CleanAdditionalFilterFromSession(reportName);
            }
        }
Beispiel #3
0
        public void reportcall()
        {
            ReportView rv = new ReportView();
            ReportSet  ds = new ReportSet();

            foreach (ReportContainerClass rc in GPData.reportlist)
            {
                if (rc.soptype == 4)
                {
                    valuecontainer  = (rc.quantity - (rc.quantity * 2));
                    valuecontainer2 = (rc.price - (rc.price * 2));
                }
                else
                {
                    valuecontainer  = rc.quantity;
                    valuecontainer2 = rc.price;
                }
                DataRow cRow = ds.ReportViewer.NewRow();
                cRow["SOPNUMBER"]       = rc.sopnumber;
                cRow["ITEMNUMBER"]      = rc.itemnumber;
                cRow["ITEMDESCRIPTION"] = rc.itemDescription;
                cRow["CUSTOMERNAME"]    = rc.custname;
                cRow["QUANTITY"]        = valuecontainer;
                cRow["DOCDATE"]         = rc.docdate;
                cRow["PRICE"]           = valuecontainer2;
                ds.ReportViewer.Rows.Add(cRow);
            }
            rv.DataDefinition.FormulaFields["startDate"].Text = "\"" + date1 + "\"";
            rv.DataDefinition.FormulaFields["End Date"].Text  = "\"" + date2 + "\"";
            rv.DataDefinition.FormulaFields["Customer"].Text  = "\"" + customer + "\"";
            rv.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rv;
            crystalReportViewer1.Refresh();
        }
Beispiel #4
0
        public override global::System.Data.DataSet Clone()
        {
            ReportSet cln = ((ReportSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #5
0
 private void ResetDescription(ReportSet reportSet)
 {
     if (reportSet.GetVolatileOption("DefaultDescription") != null)
     {
         reportSet.Description = reportSet.GetVolatileOption("DefaultDescription") as string;
         reportSet.RemoveVolatileOption("DefaultDescription");
     }
 }
Beispiel #6
0
        private static ReportSet CreateReport(ArgsProcessor argProc)
        {
            var reportSet = new ReportSet();

            reportSet.OverallResult = CompareResult.Similar;
            reportSet.Created       = DateTime.Now;
            reportSet.CsvFileName   = Path.GetFileName(argProc.GetArg(ArgsProcessor.Args.CSV_FILE_PATH));
            return(reportSet);
        }
Beispiel #7
0
        public void PreExecuteReportSet(ReportSet reportSet)
        {
            var reportName        = Utility.GetWebReportName(reportSet);
            var additionalFilters = AdditionalFiltersStorage.GetAdditionalFiltersFromSession(reportName);

            RsDuncan.AddRangeSafe(reportSet.Filters, additionalFilters);

            PopulateFiltersDescription(reportSet);
        }
Beispiel #8
0
        private void AppendResultToCombinedReport(ReportSet reportSet, ArgsProcessor argProc)
        {
            var dirManager      = new DirectoryManager(argProc);
            var combinedPersist = new CombinedReportPersistance(dirManager);

            combinedPersist.AddReportSet(reportSet);

            var htmlCreator = new CombinedHtmlReportCreator();

            htmlCreator.CreateReport(argProc);
        }
Beispiel #9
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            ReportSet ds = new ReportSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Beispiel #10
0
        private void CreateReports(ArgsProcessor argProc, ReportSet reports)
        {
            var reporters = ReportCreatorFactory.CreateReporters(argProc);

            foreach (var reporter in reporters)
            {
                if (reporter.HasSaveCapability())
                {
                    reporter.SaveReport(reports);
                }

                reporter.ShowReport(reports, argProc.IsOptionOn(ArgsProcessor.Options.QuietNotShowResults));
            }
        }
Beispiel #11
0
        internal static Report ReportSetToSaleLog(this ReportSet report)
        {
            Mapper.Initialize(cfg => cfg.CreateMap <ICollection <SaleLogSet>, ICollection <SaleLog> >());
            var result = new Report()
            {
                Id      = report.Id,
                Date    = report.Date,
                Manager = report.Manager.ManagerSetToManager(),
                SaleLog = new List <SaleLog>()
            };

            result.SaleLog = Mapper.Map <ICollection <SaleLogSet>, ICollection <SaleLog> >(report.SaleLogSet);

            return(result);
        }
Beispiel #12
0
        private void CleanAdditionalFilters(ReportSet reportSet)
        {
            var reportName = Utility.GetWebReportName(reportSet);
            var filters    = new FilterCollection();

            foreach (Filter filter in reportSet.Filters)
            {
                if (!(filter is AdditionalFilter))
                {
                    filters.Add(filter);
                }
            }
            reportSet.Filters.Clear();
            reportSet.Filters.AddRange(filters.ToArray());
            AdditionalFiltersStorage.CleanAdditionalFilterFromSession(reportName);
        }
Beispiel #13
0
        internal CompareResult RunTests(List <TestDescription> testsToRun, ArgsProcessor argProc)
        {
            ReportSet reportSet = CreateReport(argProc);

            try
            {
                var watch = Stopwatch.StartNew();

                using (_driver = new BrowserDriver())
                {
                    foreach (var test in testsToRun)
                    {
                        Outputter.Output("Running test: " + test.Name + " - " + test.Description);
                        reportSet.OverallResult = RunTest(argProc, reportSet.OverallResult, reportSet, test);
                        Outputter.OutputSeparator();
                    }

                    watch.Stop();
                    reportSet.Duration = watch.Elapsed;

                    if (argProc.IsOptionOn(ArgsProcessor.Options.Run))
                    {
                        CreateReports(argProc, reportSet);
                    }
                }
            }
            catch (Exception ex)
            {
                reportSet.Exception = ex.Message;

                throw;
            }
            finally
            {
                _driver = null;
                //try to log the exception in the combined report:
                AppendResultToCombinedReport(reportSet, argProc);
            }

            return(reportSet.OverallResult);
        }
Beispiel #14
0
        public void PreExecuteReportSet(ReportSet reportSet)
        {
            // Make sure accessing reportSet.ReportName does not throw an exception.
            string reportName = null;

            try
            {
                reportName = Utility.GetWebReportName(reportSet);
            }
            catch (Exception)
            {
                // Do nothing.
            }

            if (reportName != null)
            {
                FilterCollection additionalFilters = AdditionalFiltersStorage.GetAdditionalFiltersFromSession(reportName);
                RsDuncan.AddRangeSafe(reportSet.Filters, additionalFilters);
            }

            PopulateFiltersDescription(reportSet);
        }
Beispiel #15
0
        private void PopulateFiltersDescription(ReportSet reportSet)
        {
            reportSet.ShowReportParameters = false;
            ResetDescription(reportSet);
            if (reportSet.Filters.Count > 0)
            {
                reportSet.SetVolatileOption("DefaultDescription", reportSet.Description);

                var result = reportSet.Description ?? "";
                foreach (Izenda.AdHoc.Filter filter in reportSet.Filters)
                {
                    if (filter != null && !filter.Hidden && !string.IsNullOrEmpty(filter.Column) && (filter.Value != null && filter.Value != "..." && filter.Value != "" || filter.Values.GetValue(0) != null && filter.Values.GetValue(1) != null))
                    {
                        string columnAlias = null;

                        if (reportSet.Detail != null && reportSet.Detail.Fields != null)
                        {
                            foreach (Field field in reportSet.Detail.Fields)
                            {
                                if (field.ColumnName == filter.dbColumn.FullName)
                                {
                                    columnAlias = field.ClearDescription;
                                }
                            }
                        }
                        columnAlias = filter.Description;

                        if (filter.dbColumn != null && columnAlias == null)
                        {
                            columnAlias = AdHocSettings.FieldAliases[filter.dbColumn.Name] ?? AdHocSettings.FieldAliases[filter.dbColumn.FullName];
                            if (columnAlias == null)
                            {
                                columnAlias = filter.dbColumn.Name;
                                foreach (string str in AdHocSettings.FieldAliases.AllKeys)
                                {
                                    if (columnAlias.Contains(str))
                                    {
                                        columnAlias = columnAlias.Replace(str, AdHocSettings.FieldAliases[str]);
                                    }
                                }
                            }
                        }
                        if (columnAlias == null)
                        {
                            columnAlias = filter.dbColumn == null ? filter.Description : filter.dbColumn.Name;
                        }
                        result += Environment.NewLine;
                        result += columnAlias;
                        result += "  ";
                        var operatorName = Utility.GetOperatorName(filter.Operator, filter.Not);

                        result += operatorName;
                        if (filter.Value != null)
                        {
                            var val = filter.Value.ToString();
                            switch (filter.Operator)
                            {
                            case OperatorTypes.InTimePeriod:
                                var lic = ResponseServer.GetPeriodListCollection();
                                foreach (ListItem li in lic)
                                {
                                    if (li.Value == val)
                                    {
                                        result += "  " + li.Text;
                                    }
                                }
                                break;

                            default:
                                result += "  " + StringifyFilterValue(filter.Value);
                                break;
                            }
                        }
                        else if (filter.Values.Length == 2 && filter.Values.GetValue(0) != null && filter.Values.GetValue(1) != null)
                        {
                            result += "  " + StringifyFilterValue(filter.Values.GetValue(0)) + "     " + StringifyFilterValue(filter.Values.GetValue(1));
                        }
                    }
                }
                reportSet.Description = result;
            }
        }
Beispiel #16
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     ReportSet ds = new ReportSet();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "ReportViewerDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Beispiel #17
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     ReportSet ds = new ReportSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Beispiel #18
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                ReportSet ds = new ReportSet();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "ReportViewerDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
    protected static void RunSchedulerForTenant(TextWriter log, DateTime dateTime, string tenantId)
    {
        AdHocSettings.CurrentUserIsAdmin  = true;
        AdHocSettings.CurrentUserTenantId = tenantId;
        if (System.Web.HttpContext.Current.Items.Contains("ListReportsWasCalledOnce"))
        {
            System.Web.HttpContext.Current.Items.Remove("ListReportsWasCalledOnce");
        }
        AdHocContext.SetSchedulerExecuting(true);
        try
        {
            string delimiter    = HttpContext.Current == null ? Environment.NewLine : "<br/>";
            bool   reportsFound = false;

            // Send all emails using the same SmtpClient
            SmtpClient client = new SmtpClient(AdHocSettings.SmtpServer);

            ReportInfo[] reports = AdHocSettings.AdHocConfig.ListReports();
            foreach (ReportInfo reportInfo in reports)
            {
                if (string.IsNullOrEmpty(reportInfo.Name) || reportInfo.TenantID.ToUpperInvariant() != tenantId.ToUpperInvariant())
                {
                    continue;
                }
                ReportSet reportSet = null;
                try
                {
                    reportSet = AdHocSettings.AdHocConfig.LoadFilteredReportSet(reportInfo.FullName);
                }
                catch { }
                if (reportSet == null)
                {
                    continue;
                }

                DateTime schedule    = reportSet.Schedule;
                DateTime scheduleUtc = reportSet.ScheduleUtc;
                string   reportName  = reportInfo.Name;
                if (!string.IsNullOrEmpty(reportInfo.Category))
                {
                    reportName = reportInfo.Category + AdHocSettings.CategoryCharacter + reportInfo.Name;
                }
                reportsFound = true;
                if (scheduleUtc == Utility.NullDateTime || string.IsNullOrEmpty(reportSet.Recipients))
                {
                    log.Write(string.Format("{1}{0} - No Schedule{1}", reportName, delimiter));
                    continue;
                }
                if (schedule.Year == DateTime.MaxValue.Year)
                {
                    log.Write(string.Format("{1}{0} - Scheduled For Past {1}", reportName, delimiter));
                    continue;
                }
                if (scheduleUtc > dateTime.ToUniversalTime())
                {
                    log.Write(string.Format("{1}{0} - Scheduled In Future({2} @ {3}){1}", reportName, delimiter, schedule.ToShortDateString(), schedule.ToShortTimeString()));
                    continue;
                }
                try
                {
                    log.Write(string.Format("{1}{0} - Scheduled For This Interval ({2} @ {3}){1}", reportName, delimiter, schedule.ToShortDateString(), schedule.ToShortTimeString()));
                    string[]    recipients = reportSet.Recipients.Split(',', ';');
                    MailMessage message    = null;

                    #region Preparing mail

                    if (recipients.Length > 0)
                    {
                        DateTime nextScheduleUtc = Utility.GetNextTime(scheduleUtc, reportSet.RepeatType).DateTime;
                        DateTime nowUtc          = DateTime.UtcNow;
                        while (nextScheduleUtc < nowUtc)
                        {
                            nextScheduleUtc = Utility.GetNextTime(nextScheduleUtc, reportSet.RepeatType).DateTime;
                        }
                        reportSet.ScheduleUtc = nextScheduleUtc;
                        AdHocSettings.AdHocConfig.SaveReportSet(reportInfo, reportSet);

                        log.Write("Preparing mail - ");
                        if (!Utility.CheckCondition(reportSet))
                        {
                            log.WriteLine("Condition is false" + delimiter);
                            continue;
                        }
                        SchedulerOutput sh = AdHocSettings.SchedulerOutputTypes[reportSet.SendEmailAs];

                        message = sh.GenerateMessage(reportSet, reportSet.IsDashBoard);

                        message.Subject = string.Format(AdHocSettings.EmailSubjectFormatString, reportName);
                        message.From    = new MailAddress(AdHocSettings.EmailFromAddress);

                        log.Write(string.Format("success{0}", delimiter));
                    }

                    #endregion

                    log.Write(string.Format("Sending To:{0}", delimiter));
                    foreach (string recipient in recipients)
                    {
                        try
                        {
                            log.Write(string.Format("{0} - ", recipient));
                            Utility.SendEmailEx(client, recipient, message, AdHocSettings.SmtpSecureConnection, AdHocSettings.SmtpPort);
                            log.Write(string.Format("success{0}", delimiter));
                        }
                        catch (Exception ex)
                        {
                            StringBuilder emessage = new StringBuilder();
                            while (ex != null)
                            {
                                emessage.Append(ex.Message + " ");
                                ex = ex.InnerException;
                            }
                            log.Write(string.Format("failure ({0}){1}", emessage, delimiter));
                        }
                    }
                    log.Write("Done.{0}", delimiter);
                }
                catch (Exception ex)
                {
                    StringBuilder emessage = new StringBuilder();
                    while (ex != null)
                    {
                        emessage.Append(ex.Message + " ");
                        ex = ex.InnerException;
                    }
                    log.Write(string.Format("failure ({0}){1}", emessage, delimiter));
                }
            }
            if (!reportsFound)
            {
                log.Write(string.Format("Reports Not Found {0}", delimiter));
            }
        }
        catch { }
        finally
        {
            AdHocContext.SetSchedulerExecuting(false);
        }
    }
Beispiel #20
0
        private CompareResult RunTest(ArgsProcessor argProc, CompareResult overallResult, ReportSet reportSet, TestDescription test)
        {
            _driver.SetWindowSize(test.WindowSize);

            _driver.OpenUrl(test.Url, test.DivSelector, test.TitleContains);

            var dirManager = new DirectoryManager(argProc);

            if (argProc.IsOptionOn(ArgsProcessor.Options.Run))
            {
                var reportThisTest = CompareActualPageVersusExpected(argProc, dirManager, test, _driver);
                var resultThisTest = reportThisTest.Result.Result;
                if (resultThisTest != CompareResult.Similar)
                {
                    overallResult = resultThisTest;
                }
                reportSet.Reports.Add(reportThisTest);
            }
            else if (argProc.IsOptionOn(ArgsProcessor.Options.Save))
            {
                SaveExpectedPage(dirManager, test, _driver);
            }
            else
            {
                throw new InvalidOperationException("Not a supported set of options");
            }
            return(overallResult);
        }
Beispiel #21
0
 public void PostExecuteReportSet(ReportSet reportSet)
 {
     CleanAdditionalFilters(reportSet);
 }
Beispiel #22
0
 public void PreSaveReportSet(string name, ReportSet reportSet)
 {
     CleanAdditionalFilters(reportSet);
     ResetDescription(reportSet);
 }
Beispiel #23
0
 public void PostSaveReportSet(string name, ReportSet reportSet)
 {
 }
Beispiel #24
0
    protected static void RunSchedulerForTenant(TextWriter log, DateTime dateTime, string tenantId)
    {
        AdHocSettings.CurrentUserIsAdmin  = true;
        AdHocSettings.CurrentUserTenantId = tenantId;
        try {
            string delimiter    = HttpContext.Current == null ? Environment.NewLine : "<br/>";
            bool   reportsFound = false;

            ReportInfo[] reports = AdHocSettings.AdHocConfig.ListReports();
            foreach (ReportInfo reportInfo in reports)
            {
                if (string.IsNullOrEmpty(reportInfo.Name))
                {
                    continue;
                }
                ReportSet reportSet = null;
                try {
                    reportSet = AdHocSettings.AdHocConfig.LoadFilteredReportSet(reportInfo.FullName);
                } catch { }
                if (reportSet == null)
                {
                    continue;
                }

                DateTime schedule   = reportSet.Schedule;
                string   reportName = reportInfo.Name;
                if (!string.IsNullOrEmpty(reportInfo.Category))
                {
                    reportName = reportInfo.Category + "\\" + reportInfo.Name;
                }
                reportSet.ReportName = reportName;
                reportsFound         = true;
                if (schedule == Utility.NullDateTime || string.IsNullOrEmpty(reportSet.Recipients))
                {
                    log.Write(string.Format("{1}{0} - No Schedule{1}", reportName, delimiter));
                    continue;
                }
                if (schedule.Year == DateTime.MaxValue.Year)
                {
                    log.Write(string.Format("{1}{0} - Scheduled For Past {1}", reportName, delimiter));
                    continue;
                }
                if (schedule > dateTime)
                {
                    log.Write(
                        string.Format("{1}{0} - Scheduled In Future({2} @ {3}){1}", reportName, delimiter, schedule.ToShortDateString(),
                                      schedule.ToShortTimeString()));
                    continue;
                }
                try {
                    log.Write(
                        string.Format("{1}{0} - Scheduled For This Interval ({2} @ {3}){1}", reportName, delimiter,
                                      schedule.ToShortDateString(), schedule.ToShortTimeString()));
                    string[]    recipients = reportSet.Recipients.Split(',', ';');
                    MailMessage message    = null;

                    #region Preparing mail

                    if (recipients.Length > 0)
                    {
                        DateTime nextSchedule = Utility.GetNextTime(schedule, reportSet.RepeatType).DateTime;
                        while (nextSchedule < DateTime.Now)
                        {
                            nextSchedule = Utility.GetNextTime(nextSchedule, reportSet.RepeatType).DateTime;
                        }
                        reportSet.Schedule = nextSchedule;

                        log.Write("Preparing mail - ");
                        if (!Utility.CheckCondition(reportSet))
                        {
                            log.WriteLine("Condition is false" + delimiter);
                            continue;
                        }
                        SchedulerOutput sh = AdHocSettings.SchedulerOutputTypes[reportSet.SendEmailAs];

                        message         = sh.GenerateMessage(reportSet);
                        message.Subject = string.Format(AdHocSettings.EmailSubjectFormatString, reportName);
                        message.From    = new MailAddress(AdHocSettings.EmailFromAddress);

                        log.Write(string.Format("success{0}", delimiter));
                    }

                    #endregion

                    log.Write(string.Format("Sending To:{0}", delimiter));
                    foreach (string recipient in recipients)
                    {
                        try {
                            log.Write(string.Format("{0} - ", recipient));
                            Utility.SendEmailEx(recipient, message);
                            log.Write(string.Format("success{0}", delimiter));
                        } catch (Exception ex) {
                            StringBuilder emessage = new StringBuilder();
                            while (ex != null)
                            {
                                emessage.Append(ex.Message + " ");
                                ex = ex.InnerException;
                            }
                            log.Write(string.Format("failure ({0}){1}", emessage, delimiter));
                        }
                    }
                    log.Write("Done.{0}", delimiter);
                } catch (Exception ex) {
                    StringBuilder emessage = new StringBuilder();
                    while (ex != null)
                    {
                        emessage.Append(ex.Message + " ");
                        ex = ex.InnerException;
                    }
                    log.Write(string.Format("failure ({0}){1}", emessage, delimiter));
                }
            }
            if (!reportsFound)
            {
                log.Write(string.Format("Reports Not Found {0}", delimiter));
            }
        } catch { }
    }
Beispiel #25
0
 public void PostLoadReportSet(string name, ReportSet reportSet)
 {
 }