Пример #1
0
        public Report Create(ReportData reportData)
        {
            return new Report
            {
                Id = reportData.Id,
                Category = reportData.Category,
                IsVisible = reportData.IsVisible,
                IsDeleted = reportData.IsDeleted,
                Status = reportData.Status,
                Created = reportData.Created,
                Modified = reportData.Modified,
                Description = reportData.Description,
                IsUnconscious = reportData.IsUnconscious,

                Victim = reportData.Victim,
                VictimName = reportData.VictimName,

                WeaponType = reportData.WeaponType,
                WeaponLocation = reportData.WeaponLocation,

                FighterCount = reportData.FighterCount,
                IsWeaponPresent = reportData.IsWeaponPresent,

                DrugsAction = reportData.DrugsAction,

                StolenObject = reportData.StolenObject,
                DateOfTheft = reportData.DateOfTheft,

                Location = reportData.Location != null ? Create(reportData.Location) : null,
                Perpetrator = reportData.Perpetrator != null ? Create(reportData.Perpetrator) : null,
                Contact = reportData.Contact != null ? Create(reportData.Contact) : null,
                Vehicle = reportData.Vehicle != null ? Create(reportData.Vehicle) : null
            };
        }
Пример #2
0
        private ReportData GetData()
        {
            using (var session = SessionProvider.OpenSession())
            {
                var clientRequest = session.Get<ClientRequest>(clientRequestId);
                if (clientRequest == null)
                {
                    throw new FaultException<ObjectNotFoundFault>(
                        new ObjectNotFoundFault(clientRequestId), String.Format("Запрос [{0}] не найден", clientRequestId));
                }

                var result = new ReportData();
                result.Title = clientRequest.ToString();

                ClientRequestEventReportItem dto = null;
                result.Items = session.QueryOver<ClientRequestEvent>()
                                        .Where(e => e.ClientRequest == clientRequest)
                                        .OrderBy(e => e.CreateDate).Asc
                                        .SelectList(list => list
                                           .Select(p => p.CreateDate).WithAlias(() => dto.CreateDate)
                                           .Select(p => p.Message).WithAlias(() => dto.Message))
                                        .TransformUsing(Transformers.AliasToBean<ClientRequestEventReportItem>())
                                        .List<ClientRequestEventReportItem>()
                                        .ToArray();
                return result;
            }
        }
Пример #3
0
		public SplitTableProvider(ISplitTable splitTable, ReportData data)
		{
			_tableProvider = new TableProvider();
			_walker = new DocumentWalker();
			_splitTable = splitTable;
			_data = data;
		}
Пример #4
0
 public JsonResult GetReportByContractor(int monthFromNumber, int yearFromNumber,
     int monthToNumber, int yearToNumber, int managerId)
 {
     ReportData report = new ReportData(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
     var reportData = report.GetSalesReportByContractor(yearFromNumber, yearToNumber, monthFromNumber, monthToNumber, managerId);
     var jsonResult = new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = reportData };
     return jsonResult;
 }
        public FileResult ApplyDetailEvaporate(int Y, int equipment_id)
        {
            string DBConnectionCode = CommSetup.CommWebSetup.DB0_CodeString;
            ReportCenter logicCenter = new ReportCenter(DBConnectionCode);
            db0 = ReportCenter.getDB0;

            Apply_User getUserData = null;
            if (this.UserId != null)
            {
                getUserData = db0.Apply_User.Where(x => x.USERID == this.UserId).FirstOrDefault();
            }

            var getApplyData = db0.Apply.Where(x => x.userid == this.UserId && x.y == Y).FirstOrDefault();
            var Evaporate = db0.Apply_Detail_Evaporate.Where(x => x.y == Y && x.equipment_id == equipment_id).FirstOrDefault();

            ReportData rpt = new ReportData() { ReportName = "Apply.rdlc" };

            List<ReportParameter> rparam = new List<ReportParameter>();
            rparam.Add(new ReportParameter("report_name", "冰水主機蒸發器冰水出、回水溫差報表"));
            rparam.Add(new ReportParameter("applyName", getUserData.USERNAME));
            rparam.Add(new ReportParameter("applyYear", Y.ToString()));

            rparam.Add(new ReportParameter("doc_name", getApplyData.doc_name));
            rparam.Add(new ReportParameter("doc_rank", getApplyData.doc_rank));
            rparam.Add(new ReportParameter("doc_tel", getApplyData.doc_tel));
            rparam.Add(new ReportParameter("mng_name", getApplyData.mng_name));
            rparam.Add(new ReportParameter("mng_rank", getApplyData.mng_rank));
            rparam.Add(new ReportParameter("mng_tel", getApplyData.mng_tel));

            db0.Dispose();

            //rpt.Data = logicCenter.rpt_apply_detailEva(Y, getUserData.USERID);

            ReportViewer rptvw = new ReportViewer();
            rptvw.ProcessingMode = ProcessingMode.Local;
            ReportDataSource rds = new ReportDataSource("MasterData", rpt.Data);

            rptvw.LocalReport.DataSources.Clear();
            rptvw.LocalReport.ReportPath = @"_Code\RPTFile\" + rpt.ReportName;
            rptvw.LocalReport.DataSources.Add(rds);
            foreach (var pa in rparam)
            {
                rptvw.LocalReport.SetParameters(pa);
            }
            rptvw.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
            rptvw.LocalReport.Refresh();

            Warning[] warnings;
            string[] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension = string.Empty;
            byte[] bytes = rptvw.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

            Stream outputStream = new MemoryStream(bytes);
            string setFileName = "申報表-蒸發器" + DateTime.Now.Ticks + ".pdf";
            return File(outputStream, "application/pdf", setFileName);
        }
Пример #6
0
 public MainWindow()
 {
     InitializeComponent();
     //
     reportData = new ReportData();
     //
     loadDatabaseWithUI();
     this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
 }
        /// <summary>
        /// Checks if a condition is fulfilled
        /// </summary>
        /// <param name="reportData">report data</param>
        /// <returns>true, if condition is fulfilled</returns>
        /// <exception cref="ArgumentNullException">reportData</exception>
        public bool CheckConditionFulfilled(ReportData reportData)
        {
            if (reportData == null) throw new ArgumentNullException("reportData");
            if (ConditionPropertyName == null) return false;

            object currentValue;
            if (!reportData.ReportDocumentValues.TryGetValue(ConditionPropertyName, out currentValue)) return false;

            if (currentValue == null)
                return (ConditionPropertyValue == null);
            return (currentValue.ToString().Equals(ConditionPropertyValue));
        }
Пример #8
0
        public JsonResult GetHalfYearReport(
            int monthFromNumber, int yearFromNumber,
            int monthToNumber, int yearToNumber,
            int employeeId)
        {
            ReportData report = new ReportData(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            var reportData = report.GetSalesReport(yearFromNumber, yearToNumber, monthFromNumber, monthToNumber,
                EntityEnum.DocumentTypeEnum.Shipment, EntityEnum.ReportTypeEnum.ByMonth, employeeId);

            var jsonResult = new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = reportData };
            return jsonResult;
        }
        /// <summary>
        /// Convert all fields returned to dynamic Model to be used by the UI
        /// </summary>
        /// <param name="Data">AquariumReportManagement.ReportData Object</param>
        private void ToList(ReportData Data)
        {
            DataTable dt = SDKHelper.GetDataTableFromSdkResult(Data.Columns, Data.Rows);
            ClaimData = new List<ClaimStatus>();

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["Fields"] != null)
                {
                    if (dr["Fields"].ToString() != "")
                    {
                        ClaimData.Add(new ClaimStatus { Fields = dr["Fields"].ToString(), FieldValues = dr["FieldValues"].ToString() });
                    }
                }
            }
        }
Пример #10
0
        private void BindReportDataSet(ReportViewer rv, List<OrganizationStatDetailInfo> dataSource)
        {
            ReportData ds = new ReportData();
            DataTable dt = ds.Tables["CurrencyStat"];
            DataRow dr = dt.NewRow();

            foreach (OrganizationStatDetailInfo item in dataSource)
            {
                dr = dt.NewRow();

                dr["FaceAmount"] = item.FaceAmount;
                dr["Count"] = item.Count;
                dr["Sum"] = item.Sum;

                dt.Rows.Add(dr);
            }

            rv.LocalReport.DataSources.Clear();
            rv.LocalReport.DataSources.Add(new ReportDataSource("dsCurrencyStat", ds.Tables["CurrencyStat"]));
        }
        private byte[] ToPdfReport(ReportData rpt, List<ReportParameter> param)
        {
            Warning[] warnings;
            string[] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension = string.Empty;

            ReportViewer rptvw = new ReportViewer();
            rptvw.ProcessingMode = ProcessingMode.Local;
            ReportDataSource rds = new ReportDataSource("ReportDataSet", rpt.Data);

            rptvw.LocalReport.DataSources.Clear();
            rptvw.LocalReport.ReportPath = @"_Code\RPTFile\" + rpt.ReportName;
            rptvw.LocalReport.DataSources.Add(rds);
            foreach (var pa in param)
            {
                rptvw.LocalReport.SetParameters(pa);
            }
            rptvw.LocalReport.Refresh();

            byte[] bytes = rptvw.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
            return bytes;
        }
        public void Send(ReportData errorContent)
        {
            var formParams = Remap(errorContent);
            formParams.Add("pageNumber", "0");
            formParams.Add("backupCache", "");
            formParams.Add("submit", "Submit");
            try
            {
                Log.Debug(Constants.LOG_TAG, "Sending report # " + errorContent[ReportField.ReportID]);
                Log.Debug(Constants.LOG_TAG, "Connecting to " + _formUrl.Host);
                var request = (HttpWebRequest)WebRequest.Create(_formUrl);
                request.Timeout = _config.ConnectionTimeout;
                request.Method = "POST";
                request.AllowAutoRedirect = true;
                request.ReadWriteTimeout = 10000;
                request.ContentType = "application/x-www-form-urlencoded";
                var parameters = string.Join("&", ToFormData(formParams).ToArray());

                using (var requestStream = request.GetRequestStream())
                {
                    Log.Debug(Constants.LOG_TAG, "Start sending data to " + _formUrl);
                    var bytes = Encoding.UTF8.GetBytes(parameters);
                    requestStream.Write(bytes, 0, bytes.Length);
                    requestStream.Flush();
                    requestStream.Close();

                    using (request.GetResponse())
                    {
                    }
                }
            }
            catch (Exception e)
            {
                throw new ReportSenderException("Error while sending report to Google Form.", e);
            }
        }
Пример #13
0
        public JsonResult GetMonthReport(int monthNumber, int yearNumber, int employeeId)
        {
            // StringBuilder sb = new StringBuilder();
            ReportData report = new ReportData(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
            int monthToNumber = monthNumber;
            int yearToNumber = yearNumber;
            if (monthNumber == 12)
            {
                monthToNumber = 1;
                yearToNumber = yearNumber + 1;
            }
            else {
                monthToNumber = monthNumber + 1;
            }

            var reportData = report.GetSalesReport(yearNumber, yearToNumber, monthNumber, monthToNumber,
                EntityEnum.DocumentTypeEnum.Shipment, EntityEnum.ReportTypeEnum.ByDay, employeeId);
            //foreach (var reportItem in reportData)
            //{

            //}
            var jsonResult = new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = reportData };
            return jsonResult;
        }
Пример #14
0
        public static void BuildSvedReport(IBackgroundContext context, MonthAccountParams args)
        {
            var dateBegin = args.DateBegin;
            var dateEnd = args.DateEnd;
            var miacCode = args.LpuCode;
            using (var dataConext = new VistaMedDataContext(context))
            {
                var smpBills = (from b in dataConext.VistaMed.Accounts
                                where b.Date >= args.DateBegin.AddDays(15) && b.Date < args.NextMonthBegin.AddDays(15)
                                && b.Contract != null && b.Contract.RbFinance != null
                                && b.Contract.RbFinance.Name.ToLower() == "омс"
                                    && (from a in b.AccountItems
                                        from s in dataConext.VistaMed.RbServices
                                        where a.ServiceId == s.Id
                                        && s.Code.StartsWith("162")
                                        select a).Any()
                                select b).ToList();

                smpBills = smpBills.Where(x => x.AccountType == AccountType.Osm18).ToList();
                smpBills = smpBills.Where(x => args.IsValidAccountNumber(x.Number)).ToList();

                if (smpBills.Count == 0)
                    context.ReportError(@"Счета ДД за период с {0} по {1} не найдены", dateBegin, dateEnd);
                else
                {
                    var templateName = Utils.GetReportFileName(@"SvodSpravOsm18.xls");
                    if (File.Exists(templateName))
                    {
                        var excel = new Application();
                        excel.Visible = true;

                        foreach (var smpBill in smpBills)
                        {
                            var newDoc = excel.Workbooks.Add(templateName);
                            excel.ScreenUpdating = false;

                            var ws = ((Worksheet)newDoc.Worksheets[1]);
                            newDoc.Names.Item(@"ОтчетныйПериод").RefersToRange.Value2 =
                                Utils.GetPeriodName(smpBill.SettleDate.BeginOfMonth(), smpBill.SettleDate);

                            var lpu = dataConext.VistaMed.Organisations.FirstOrDefault(x => x.MiacCode == miacCode);
                            if (lpu != null)
                            {
                                newDoc.Names.Item("ЛПУ").RefersToRange.Value2 = lpu.FullName;
                                newDoc.Names.Item("ФИОРуководителя").RefersToRange.Value2 = lpu.Chief;
                                newDoc.Names.Item("ФИОГлавбуха").RefersToRange.Value2 = lpu.Accountant;
                            }

                            var smo =
                                (from payer in dataConext.VistaMed.Organisations
                                 where payer.Id == smpBill.PayerId
                                 select payer).FirstOrDefault();
                            if (smo != null)
                            {
                                newDoc.Names.Item("СМО").RefersToRange.Value2 = smo.FullName;
                            }

                            ReportData colData;

                            var eventList = (from a in smpBill.AccountItems
                                             where !a.Deleted && a.Event != null && a.Event.RbResult != null && a.Action != null && a.Action.ActionType != null
                                             group a by a.Event into e
                                             select e).ToList();

                            var profActionCodes = new[] { "162043", "162044", "162045", "162046", "162002",
                            "162003", "162005", "162006", "162007", "162008", "162009", "162010" };

                            var predActionCodes = new[] { "162040", "162041", "162042" };

                            var txtFileName = Utils.GetOptionsFileName(@"SvedOsm18Services.txt");
                            if (File.Exists(txtFileName))
                            {
                                var allLines = File.ReadAllLines(txtFileName, Encoding.GetEncoding(1251));
                                foreach (var currLine in allLines)
                                {
                                    if (currLine.StartsWith(@"Профилактика"))
                                    {
                                        var lines2 = currLine.Split('=');
                                        profActionCodes = lines2[1].Split(',');
                                    }
                                    if (currLine.StartsWith(@"Предварительные"))
                                    {
                                        var lines2 = currLine.Split('=');
                                        predActionCodes = lines2[1].Split(',');
                                    }
                                }
                            }

                            var profList = (from e in eventList
                                            where e.Any(a => profActionCodes.Any(x => a.Action.ActionType.Code == x))
                                            select e).ToList();

                            var predList = (from e in eventList
                                            where e.Any(a => predActionCodes.Any(x => a.Action.ActionType.Code == x))
                                            select e).ToList();

                            var periodList = eventList.Except(profList).Except(predList).ToList();

                            colData = new ReportData();
                            colData.Prof = profList.Count;
                            colData.Pred = predList.Count;
                            colData.Period = periodList.Count;

                            fillColumn(ws, colData, 2);

                            colData = new ReportData();
                            colData.Prof = (from e in profList from a in e select a).Sum(x => x.Sum);
                            colData.Pred = (from e in predList from a in e select a).Sum(x => x.Sum);
                            colData.Period = (from e in periodList from a in e select a).Sum(x => x.Sum);

                            fillColumn(ws, colData, 3);

                            excel.ScreenUpdating = true;
                            ws.Activate();

                        }
                    }
                }
            }
            context.ProgressSeparator('-');
        }
Пример #15
0
        public static void BuildSvedReport(IBackgroundContext context, MonthAccountParams args)
        {
            var dateBegin = args.DateBegin;
            var dateEnd = args.DateEnd;
            var miacCode = args.LpuCode;
            using (var dataConext = new VistaMedDataContext(context))
            {
                var smpBills = (from b in dataConext.VistaMed.Accounts
                                where b.Date >= args.DateBegin.AddDays(15) && b.Date < args.NextMonthBegin.AddDays(15)
                                && b.Contract != null && b.Contract.RbFinance != null
                                && b.Contract.RbFinance.Name.ToLower() == "омс"
                                    && (from a in b.AccountItems
                                        from s in dataConext.VistaMed.RbServices
                                        where a.ServiceId == s.Id
                                        && (s.Code.StartsWith("161") || s.Code.StartsWith("162"))
                                        select a).Any()
                                select b).ToList();

                smpBills = smpBills.Where(x => x.AccountType == AccountType.Osm18
                    && args.IsValidAccountNumber(x.Number)
                    && !x.Number.StartsWith(PlanExecution.ReserveAccountName)).ToList();

                if (smpBills.Count == 0)
                    context.ReportError(@"Счета ДД за период с {0} по {1} не найдены", dateBegin, dateEnd);
                else
                {
                    var templateName = Utils.GetReportFileName(@"SvedOsm18.xls");
                    if (File.Exists(templateName))
                    {
                        var excel = new Application();
                        excel.Visible = true;

                        var planDataList = loadPlan(excel);

                        var newDoc = excel.Workbooks.Add(templateName);
                        excel.ScreenUpdating = false;

                        var ws = ((Worksheet)newDoc.Worksheets[1]);
                        newDoc.Names.Item(@"ДатаНачала").RefersToRange.Value2 = dateBegin;
                        newDoc.Names.Item(@"ДатаКонца").RefersToRange.Value2 = dateEnd;
                        newDoc.Names.Item(@"ДатаОтчета").RefersToRange.Value2 = DateTime.Today;
                        newDoc.Names.Item(@"ОтчетныйПериод").RefersToRange.Value2 = Utils.GetPeriodName(dateBegin, dateEnd);

                        var lpu = dataConext.VistaMed.Organisations.FirstOrDefault(x => x.MiacCode == miacCode);
                        if (lpu != null)
                        {
                            newDoc.Names.Item("ЛПУ").RefersToRange.Value2 = lpu.FullName;
                            newDoc.Names.Item("ФИОРуководителя").RefersToRange.Value2 = lpu.Chief;
                            newDoc.Names.Item("ФИОГлавбуха").RefersToRange.Value2 = lpu.Accountant;
                        }

                        ReportData colData;

                        colData = new ReportData();
                        colData.Prof = planDataList.Sum(x => x.Prof);
                        colData.Pred = null;
                        colData.Period = planDataList.Sum(x => x.Period); ;
                        fillColumn(ws, colData, 3);

                        colData = new ReportData();
                        colData.Prof = planDataList.Where(y => y.Month <= dateEnd.Month).Sum(x => x.Prof);
                        colData.Pred = null;
                        colData.Period = planDataList.Where(y => y.Month <= dateEnd.Month).Sum(x => x.Period); ;
                        fillColumn(ws, colData, 4);

                        var eventList = (from b in smpBills
                                         from a in b.AccountItems
                                         where !a.Deleted && a.Event != null && a.Event.RbResult != null && a.Action != null && a.Action.ActionType != null
                                         group a by a.Event into e select e).ToList();

                        var profActionCodes = new[] { "162043", "162044", "162045", "162046", "162002",
                            "162003", "162005", "162006", "162007", "162008", "162009", "162010" };

                        var predActionCodes = new[] { "162040", "162041", "162042" };

                        var perActionsCodes = new[] { "162060", "162061", "162062"};

                        var txtFileName = Utils.GetOptionsFileName(@"SvedOsm18Services.txt");
                        if (File.Exists(txtFileName))
                        {
                            var allLines = File.ReadAllLines(txtFileName, Encoding.GetEncoding(1251));
                            foreach (var currLine in allLines)
                            {
                                if (currLine.StartsWith(@"Профилактика"))
                                {
                                    var lines2 = currLine.Split('=');
                                    profActionCodes = lines2[1].Split(',');
                                }
                                if (currLine.StartsWith(@"Предварительные"))
                                {
                                    var lines2 = currLine.Split('=');
                                    predActionCodes = lines2[1].Split(',');
                                }
                                if (currLine.StartsWith(@"Периодические"))
                                {
                                    var lines2 = currLine.Split('=');
                                    perActionsCodes = lines2[1].Split(',');
                                }
                            }
                        }

                        var profList = (from e in eventList
                            where e.Any(a => profActionCodes.Any(x => a.Action.ActionType.Code == x))
                            select e).ToList();

                        var predList = (from e in eventList
                            where e.Any(a => predActionCodes.Any(x => a.Action.ActionType.Code == x))
                            select e).ToList();

                        var periodList = eventList.Except(profList).Except(predList).ToList();

                        colData = new ReportData();
                        colData.Prof = (from e in profList from a in e select a).Sum(x => x.Sum) / 1000;
                        colData.Pred = (from e in predList from a in e select a).Sum(x => x.Sum) / 1000;
                        colData.Period = (from e in periodList from a in e select a).Sum(x => x.Sum) / 1000;
                        fillColumn(ws, colData, 5);

                        colData = new ReportData();
                        colData.Prof = profList.Count;
                        colData.Pred = predList.Count;
                        colData.Period = periodList.Count;

                        fillColumn(ws, colData, 6);

                        string grName = "";
                        int grColIndex = 0;

                        grColIndex = 15;

                        grName = @" I группа";
                        grZd(profList, grName, predList, ws, grColIndex++);
                        grName = @" II группа";
                        grZd(profList, grName, predList, ws, grColIndex++);
                        grName = @" III группа";
                        grZd(profList, grName, predList, ws, grColIndex++);
                        grName = @" IV группа";
                        grZd(profList, grName, predList, ws, grColIndex++);
                        grName = @" V группа";
                        grZd(profList, grName, predList, ws, grColIndex++);

                        excel.ScreenUpdating = true;
                        ws.Activate();
                    }
                }
            }
            context.ProgressSeparator('-');
        }
Пример #16
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     ReportData ds = new ReportData();
     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;
 }
 /// <summary>
 /// Get data feom DB and convert to DiaryPriorityLink Object
 /// </summary>
 /// <param name="Data">AquariumReportManagement.ReportData</param>
 private void ToObject(ReportData Data)
 {
     DataTable dt = SDKHelper.GetDataTableFromSdkResult(Data.Columns, Data.Rows);
     foreach (DataRow dr in dt.Rows)
     {
         if (dr["DiaryPriorityLinkID"] != null)
         {
             if (Convert.ToInt32(dr["DiaryPriorityLinkID"]) != 0)
             {
                 DiaryPriorityLinkID = Convert.ToInt32(dr["DiaryPriorityLinkID"]);
                 DiaryPriorityID = Convert.ToInt32(dr["DiaryPriorityID"]);
                 DiaryAppointmentID = Convert.ToInt32(dr["DiaryAppointmentID"]);
             }
         }
     }
 }
Пример #18
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            int metricId = options.GetIntOption("BCID", 60017);

            var rowData = new List <string>();

            rowData.AddRange(new[] {
                " ",
                Labels.ViolationsCritical + " - " + Labels.ViolationsRemoved,
                Labels.ViolationsCritical + " - " + Labels.ViolationsAdded,
                Labels.ViolationsCritical + " - " + Labels.Total
            });

            DataTable dtDates = new DataTable();

            dtDates.Columns.Add("Quarter", typeof(int));
            dtDates.Columns.Add("Year", typeof(int));
            dtDates.Columns.Add("RemovedCritViol", typeof(double));
            dtDates.Columns.Add("AddedCritViol", typeof(double));
            dtDates.Columns.Add("TotalCritViol", typeof(double));
            dtDates.AcceptChanges();

            #region Fetch SnapshotsPF

            if (reportData?.Applications != null && reportData.Snapshots != null)
            {
                Snapshot[] _allSnapshots = reportData.Snapshots;

                int      generateQuater = 6;
                DateTime _dateNow       = DateTime.Now;
                int      currentYear    = _dateNow.Year;
                int      currentQuater  = DateUtil.GetQuarter(_dateNow);
                for (int i = generateQuater; i > 0; i--)
                {
                    DataRow dr = dtDates.NewRow();
                    dr["Quarter"] = currentQuater;
                    dr["Year"]    = currentYear;
                    dtDates.Rows.InsertAt(dr, 0);

                    currentYear   = DateUtil.GetPreviousQuarterYear(currentQuater, currentYear);
                    currentQuater = DateUtil.GetPreviousQuarter(currentQuater);
                }

                for (int i = 0; i < dtDates.Rows.Count; i++)
                {
                    double?_removedCritViol = 0;
                    double?_addedCritViol   = 0;
                    double?_totalCritViol   = 0;

                    if (_allSnapshots.Length > 0)
                    {
                        foreach (Snapshot snapshot in _allSnapshots.OrderBy(_ => _.Annotation.Date.DateSnapShot))
                        {
                            if (snapshot.Annotation.Date.DateSnapShot == null)
                            {
                                continue;
                            }
                            DateTime _snapshotDate = Convert.ToDateTime(snapshot.Annotation.Date.DateSnapShot.Value);
                            int      intQuarter    = Convert.ToInt32(dtDates.Rows[i]["Quarter"]);
                            int      intYear       = Convert.ToInt32(dtDates.Rows[i]["Year"]);

                            int intSnapshotQuarter = DateUtil.GetQuarter(_snapshotDate);
                            int intSnapshotYear    = _snapshotDate.Year;

                            if (intQuarter != intSnapshotQuarter || intYear != intSnapshotYear)
                            {
                                continue;
                            }
                            ViolationsStatisticsDTO results = RulesViolationUtility.GetBCEvolutionSummary(snapshot, metricId).First();
                            if (results == null)
                            {
                                continue;
                            }
                            _removedCritViol = _removedCritViol + results.RemovedCriticalViolations;
                            _addedCritViol   = _addedCritViol + results.AddedCriticalViolations;
                            _totalCritViol   = _totalCritViol + results.TotalCriticalViolations;
                        }
                    }

                    dtDates.Rows[i]["RemovedCritViol"] = _removedCritViol * -1;
                    dtDates.Rows[i]["AddedCritViol"]   = _addedCritViol;
                    dtDates.Rows[i]["TotalCritViol"]   = _totalCritViol;
                }

                for (int i = 0; i < dtDates.Rows.Count; i++)
                {
                    string strQuarter = dtDates.Rows[i]["Year"] + " Q" + dtDates.Rows[i]["Quarter"];
                    rowData.Add(strQuarter);
                    rowData.Add(dtDates.Rows[i]["RemovedCritViol"].ToString());
                    rowData.Add(dtDates.Rows[i]["AddedCritViol"].ToString());
                    rowData.Add(dtDates.Rows[i]["TotalCritViol"].ToString());
                }
            }
            #endregion Fetch SnapshotsPF

            TableDefinition resultTable = new TableDefinition
            {
                HasRowHeaders    = true,
                HasColumnHeaders = false,
                NbRows           = dtDates.Rows.Count + 1,
                NbColumns        = 4,
                Data             = rowData,
                GraphOptions     = null
            };
            return(resultTable);
        }
 /// <summary>
 /// Changes the visibility of this TextBlock if needed
 /// </summary>
 /// <param name="data">report document data</param>
 public void PerformRenderUpdate(ReportData data)
 {
     bool visible = CheckConditionFulfilled(data);
     if (ConditionInvert) visible = !visible;
     Visibility = visible ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
 }
Пример #20
0
 public string GetContent(ReportData client, Dictionary <string, string> options)
 {
     return(Content(client, options));
 }
Пример #21
0
        public static void BuildSvedReport(IBackgroundContext context, MonthAccountParams args)
        {
            var dateBegin = args.DateBegin;
            var dateEnd = args.DateEnd;
            var miacCode = args.LpuCode;
            using (var dataConext = new VistaMedDataContext(context))
            {
                var smpBills = (from b in dataConext.VistaMed.Accounts
                                where b.Date >= args.DateBegin.AddDays(15) && b.Date < args.NextMonthBegin.AddDays(15)
                                && b.Contract != null && b.Contract.RbFinance != null
                                && b.Contract.RbFinance.Name.ToLower() == "омс"
                                    && (from a in b.AccountItems
                                        from s in dataConext.VistaMed.RbServices
                                        where a.ServiceId == s.Id
                                        && s.Code.StartsWith("062")
                                        select a).Any()
                                select b).ToList();

                smpBills = smpBills.Where(x => x.AccountType == AccountType.ProfOsm).ToList();
                smpBills = smpBills.Where(x => args.IsValidAccountNumber(x.Number)).ToList();

                if (smpBills.Count == 0)
                    context.ReportError(@"Счета ДД за период с {0} по {1} не найдены", dateBegin, dateEnd);
                else
                {
                    var templateName = Utils.GetReportFileName(@"SvodSpravProf.xls");
                    if (File.Exists(templateName))
                    {
                        var excel = new Application();
                        excel.Visible = true;

                        foreach (var smpBill in smpBills)
                        {
                            var newDoc = excel.Workbooks.Add(templateName);
                            excel.ScreenUpdating = false;

                            var ws = ((Worksheet)newDoc.Worksheets[1]);
                            newDoc.Names.Item(@"ОтчетныйПериод").RefersToRange.Value2 =
                                Utils.GetPeriodName(smpBill.SettleDate.BeginOfMonth(), smpBill.SettleDate);

                            var lpu = dataConext.VistaMed.Organisations.FirstOrDefault(x => x.MiacCode == miacCode);
                            if (lpu != null)
                            {
                                newDoc.Names.Item("ЛПУ").RefersToRange.Value2 = lpu.FullName;
                                newDoc.Names.Item("ФИОРуководителя").RefersToRange.Value2 = lpu.Chief;
                                newDoc.Names.Item("ФИОГлавбуха").RefersToRange.Value2 = lpu.Accountant;
                            }

                            var smo =
                                (from payer in dataConext.VistaMed.Organisations
                                 where payer.Id == smpBill.PayerId
                                 select payer).FirstOrDefault();
                            if (smo != null)
                            {
                                newDoc.Names.Item("СМО").RefersToRange.Value2 = smo.FullName;
                            }

                            ReportData colData;

                            var eventList = (from a in smpBill.AccountItems
                                             where !a.Deleted && a.Event != null && a.Event.RbResult != null && a.Action != null && a.Action.ActionType != null
                                             group a by a.Event into e
                                             select e).ToList();

                            colData = new ReportData();
                            colData.Prof = eventList.Count;

                            fillColumn(ws, colData, 2);

                            colData = new ReportData();
                            colData.Prof = (from e in eventList from a in e select a).Sum(x => x.Sum);

                            fillColumn(ws, colData, 3);

                            excel.ScreenUpdating = true;
                            ws.Activate();

                        }
                    }
                }
            }
            context.ProgressSeparator('-');
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            TableDefinition back = new TableDefinition();
            int             parId;

            Constants.QualityDistribution distributionId;
            List <string> rowData = new List <string>();

            double?previousHttVal = null;

            if (null != options && options.ContainsKey("PAR") && int.TryParse(options["PAR"], out parId) && Enum.IsDefined(typeof(Constants.QualityDistribution), parId))
            {
                distributionId = (Constants.QualityDistribution)parId;
            }
            else
            {
                distributionId = Constants.QualityDistribution.CostComplexityDistribution;
            }

            if (null == reportData)
            {
                return(back);
            }

            #region Selected Snapshot

            double?selectedLowVal = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                 distributionId.GetHashCode(), "low");
            double?selectedAveVal = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                 distributionId.GetHashCode(), "average");
            double?selectedHigVal = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                 distributionId.GetHashCode(), "high");
            double?selectedVhiVal = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                 distributionId.GetHashCode(), "very_high");

            double?selectedTotal  = (selectedLowVal.HasValue && selectedAveVal.HasValue && selectedHigVal.HasValue && selectedVhiVal.HasValue) ? selectedLowVal.Value + selectedAveVal.Value + selectedHigVal.Value + selectedVhiVal.Value : (double?)null;
            double?selectedHttVal = (selectedHigVal.HasValue && selectedVhiVal.HasValue) ? selectedHigVal.Value + selectedVhiVal.Value : (double?)null;

            #endregion Selected Snapshot

            #region Previous Snapshot

            if (reportData.PreviousSnapshot != null)
            {
                var previousHigVal = CastComplexityUtility.GetCostComplexityGrade(reportData.PreviousSnapshot,
                                                                                  distributionId.GetHashCode(), "high");
                var previousVhiVal = CastComplexityUtility.GetCostComplexityGrade(reportData.PreviousSnapshot,
                                                                                  distributionId.GetHashCode(), "very_high");

                previousHttVal = previousHigVal.HasValue && previousVhiVal.HasValue ? previousHigVal.Value + previousVhiVal.Value : (double?)null;
            }

            #endregion Previous Snapshot

            #region Data
            int?variation = (selectedHttVal.HasValue && previousHttVal.HasValue) ? (int)(selectedHttVal - previousHttVal) : (int?)null;

            string distributionName = CastComplexityUtility.GetCostComplexityName(reportData.CurrentSnapshot, distributionId.GetHashCode());

            rowData.AddRange(new[] { distributionName, Labels.Current, Labels.Previous, Labels.Evol, Labels.TotalPercent });
            rowData.AddRange(new[]
                             { Labels.ComplexityHighAndVeryHigh
                               , selectedHttVal?.ToString(MetricFormat) ?? Constants.No_Value
                               , previousHttVal?.ToString(MetricFormat) ?? Constants.No_Value
                               , variation.HasValue? FormatEvolution(variation.Value): Constants.No_Value
                               , (selectedHttVal.HasValue && selectedTotal.HasValue && selectedTotal.Value > 0)? FormatPercent(selectedHttVal.Value / selectedTotal.Value, false): Constants.No_Value });


            #endregion Data

            back = new TableDefinition
            {
                Data             = rowData,
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbColumns        = 5,
                NbRows           = 2
            };

            return(back);
        }
Пример #23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public abstract string Content(ReportData client, Dictionary <string, string> options);
Пример #24
0
 public void Select(TReportData data)
 {
     ReportData.CopyFrom(data);
 }
Пример #25
0
 public override string Content(ReportData reportData, Dictionary <string, string> options)
 {
     return(reportData != null ? reportData.Application.SystemNames : Domain.Constants.No_Value);
 }
Пример #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportData"></param>
        protected DocumentBuilderBase(ReportData reportData)
        {
            ReportData = reportData;

            Package = GetPackage(reportData.FileName, ReportData.ReportType);
        }
Пример #27
0
 private void AddHeaderAndFooter(Section section, ReportData data)
 {
     new HeaderAndFooter().Add(section, data);
 }
Пример #28
0
        /// <summary>
        /// Convert Returned Data to Case Object
        /// </summary>
        /// <param name="Data">AquariumReportManagement.ReportData Model</param>
        private void ToObject(ReportData Data)
        {
            DataTable dt = SDKHelper.GetDataTableFromSdkResult(Data.Columns, Data.Rows);
            foreach (DataRow dr in dt.Rows)
            {
                if (Convert.ToInt32(dr["LeadID"]) > 0)
                {
                    if (Convert.ToInt32(dr["LeadTypeID"]) > 0)
                    {
                        LeadID = Convert.ToInt32(dr["LeadID"]);
                        LeadTypeID = Convert.ToInt32(dr["LeadTypeID"]);
                        LeadTypeName = dr["LeadTypeName"].ToString();
                        AssignedTo = Convert.ToInt32(dr["AssignedTo"]);
                        StatusName = dr["StatusName"].ToString();
                        AquariumStatusName = dr["AquariumStatusName"].ToString();
                        CustomerID = Convert.ToInt32(dr["CustomerID"]);

                        if (Convert.ToInt32(dr["LeadTypeID"]) == 261)
                        {
                            Insurer = dr["Insurer"].ToString();
                            InsurerRef = dr["InsurerReference"].ToString();
                            CaseOutcome = dr["CaseOutcome"].ToString();
                            Referrer = null;
                            OriginalSolName = null;
                            MedicalOverview = null;
                            Liabiliy = null;
                        }
                        else if (Convert.ToInt32(dr["LeadTypeID"]) == 600)
                        {
                            Insurer = null;
                            InsurerRef = null;
                            CaseOutcome = null;
                            Referrer = dr["Referrer"].ToString();
                            OriginalSolName = dr["OriginalSolName"].ToString();
                            MedicalOverview = dr["MedicalOverview"].ToString();
                            Liabiliy = dr["Liabiliy"].ToString();
                        }
                    }
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            List <string> rowData = new List <string>();

            bool displayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);

            if (reportData?.CurrentSnapshot != null)
            {
                //Compute nb objectives
                int?nbObjectives = RulesViolationUtility.GetNbRuleWithViolations(reportData.CurrentSnapshot, Constants.RulesViolation.CriticalRulesViolation, 0, false);

                //Compute nb acchiveemnt for the whole applcation
                int?nbRuleWithViolations = RulesViolationUtility.GetNbRuleWithViolations(reportData.CurrentSnapshot, Constants.RulesViolation.CriticalRulesViolation, 0, true);
                int?nbAchievement        = (nbObjectives.HasValue && nbRuleWithViolations.HasValue) ? (nbObjectives.Value - nbRuleWithViolations.Value) : (int?)null;

                double?achievementRatio = (nbAchievement.HasValue && nbObjectives.Value != 0) ? (double)nbAchievement.Value / nbObjectives.Value : (double?)null;

                //Compute nb acchiveemnt add in the last delivery
                int?nbAddedCriticalViolations = MeasureUtility.GetAddedCriticalViolations(reportData.CurrentSnapshot);
                if (!nbAddedCriticalViolations.HasValue)
                {
                    nbAddedCriticalViolations = 0;
                }
                int?nbAchievementAdded = (nbObjectives.HasValue) ? nbObjectives.Value - nbAddedCriticalViolations.Value : (int?)null;

                double?achievementAddedRatio = (nbAchievementAdded.HasValue && nbObjectives.Value != 0) ? (double)nbAchievementAdded.Value / nbObjectives.Value : (double?)null;

                //BuildContent header
                rowData.AddRange(displayShortHeader ? new[] { " ", Labels.Obj, Labels.Achiev, Labels.AchievRatio }
                                                    : new[] { " ", Labels.Objectives, Labels.Achievement, Labels.AchievementRatio });


                //BuildContent "Entire Application" row
                rowData.AddRange(new[] {
                    Labels.DeliveryWhole,
                    (nbObjectives.HasValue)?nbObjectives.Value.ToString(MetricFormat):string.Empty,
                    (nbAchievement.HasValue)?nbAchievement.Value.ToString(MetricFormat):string.Empty,
                    FormatPercent(MathUtility.GetRound(achievementRatio), false)
                });


                //BuildContent "Last Delivery" row
                rowData.AddRange(new[] {
                    Labels.DeliveryLast,
                    (nbObjectives.HasValue)?nbObjectives.Value.ToString(MetricFormat):string.Empty,
                    (nbAchievementAdded.HasValue)?nbAchievementAdded.Value.ToString(MetricFormat):string.Empty,
                    FormatPercent(MathUtility.GetRound(achievementAddedRatio), false)
                });
            }

            TableDefinition resultTable = new TableDefinition
            {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = 3,
                NbColumns        = 4,
                Data             = rowData
            };


            return(resultTable);
        }
Пример #30
0
        public static ReportData GetReportData(Grammar g)
        {
            ReportData data = new ReportData();
            data.version = Version;
            data.gname = g.name;

            data.gtype = g.GrammarTypeString;

            data.language = (string)g.GetOption("language");
            data.output = (string)g.GetOption("output");
            if (data.output == null)
            {
                data.output = "none";
            }

            string k = (string)g.GetOption("k");
            if (k == null)
            {
                k = "none";
            }
            data.grammarLevelk = k;

            string backtrack = (string)g.GetOption("backtrack");
            if (backtrack == null)
            {
                backtrack = "false";
            }
            data.grammarLevelBacktrack = backtrack;

            int totalNonSynPredProductions = 0;
            int totalNonSynPredRules = 0;
            ICollection<Rule> rules = g.Rules;
            foreach (Rule r in rules)
            {
                if (!r.Name.StartsWith(Grammar.SynpredRulePrefix, StringComparison.OrdinalIgnoreCase))
                {
                    totalNonSynPredProductions += r.NumberOfAlts;
                    totalNonSynPredRules++;
                }
            }

            data.numRules = totalNonSynPredRules;
            data.numOuterProductions = totalNonSynPredProductions;

            int numACyclicDecisions =
                g.NumberOfDecisions - g.GetNumberOfCyclicDecisions();
            List<int> depths = new List<int>();
            int[] acyclicDFAStates = new int[numACyclicDecisions];
            int[] cyclicDFAStates = new int[g.GetNumberOfCyclicDecisions()];
            int acyclicIndex = 0;
            int cyclicIndex = 0;
            int numLL1 = 0;
            int blocksWithSynPreds = 0;
            int dfaWithSynPred = 0;
            int numDecisions = 0;
            int numCyclicDecisions = 0;
            for (int i = 1; i <= g.NumberOfDecisions; i++)
            {
                Grammar.Decision d = g.GetDecision(i);
                if (d.dfa == null)
                {
                    //System.out.println("dec "+d.decision+" has no AST");
                    continue;
                }
                Rule r = d.dfa.NFADecisionStartState.enclosingRule;
                if (r.Name.StartsWith(Grammar.SynpredRulePrefix, StringComparison.OrdinalIgnoreCase))
                {
                    //System.out.println("dec "+d.decision+" is a synpred");
                    continue;
                }

                numDecisions++;
                if (BlockHasSynPred(d.blockAST))
                    blocksWithSynPreds++;
                //if (g.decisionsWhoseDFAsUsesSynPreds.contains(d.dfa))
                //    dfaWithSynPred++;
                if (d.dfa.HasSynPred)
                    dfaWithSynPred++;
                //			NFAState decisionStartState = g.getDecisionNFAStartState(d.decision);
                //			int nalts = g.getNumberOfAltsForDecisionNFA(decisionStartState);
                //			for (int alt = 1; alt <= nalts; alt++) {
                //				int walkAlt =
                //					decisionStartState.translateDisplayAltToWalkAlt(alt);
                //				NFAState altLeftEdge = g.getNFAStateForAltOfDecision(decisionStartState, walkAlt);
                //			}
                //			int nalts = g.getNumberOfAltsForDecisionNFA(d.dfa.decisionNFAStartState);
                //			for (int a=1; a<nalts; a++) {
                //				NFAState altStart =
                //					g.getNFAStateForAltOfDecision(d.dfa.decisionNFAStartState, a);
                //			}
                if (!d.dfa.IsCyclic)
                {
                    if (d.dfa.IsClassicDFA)
                    {
                        int maxk = d.dfa.MaxLookaheadDepth;
                        //System.out.println("decision "+d.dfa.decisionNumber+" k="+maxk);
                        if (maxk == 1)
                            numLL1++;
                        depths.Add(maxk);
                    }
                    else
                    {
                        acyclicDFAStates[acyclicIndex] = d.dfa.NumberOfStates;
                        acyclicIndex++;
                    }
                }
                else
                {
                    //System.out.println("CYCLIC decision "+d.dfa.decisionNumber);
                    numCyclicDecisions++;
                    cyclicDFAStates[cyclicIndex] = d.dfa.NumberOfStates;
                    cyclicIndex++;
                }
            }

            data.numLL1 = numLL1;
            data.numberOfFixedKDecisions = depths.Count;
            data.mink = depths.DefaultIfEmpty(int.MaxValue).Min();
            data.maxk = depths.DefaultIfEmpty(int.MinValue).Max();
            data.avgk = depths.DefaultIfEmpty(0).Average();

            data.numberOfDecisionsInRealRules = numDecisions;
            data.numberOfDecisions = g.NumberOfDecisions;
            data.numberOfCyclicDecisions = numCyclicDecisions;

            //		Map synpreds = g.getSyntacticPredicates();
            //		int num_synpreds = synpreds!=null ? synpreds.Count : 0;
            //		data.num_synpreds = num_synpreds;
            data.blocksWithSynPreds = blocksWithSynPreds;
            data.decisionsWhoseDFAsUsesSynPreds = dfaWithSynPred;

            //
            //		data. = Stats.stddev(depths);
            //
            //		data. = Stats.min(acyclicDFAStates);
            //
            //		data. = Stats.max(acyclicDFAStates);
            //
            //		data. = Stats.avg(acyclicDFAStates);
            //
            //		data. = Stats.stddev(acyclicDFAStates);
            //
            //		data. = Stats.sum(acyclicDFAStates);
            //
            //		data. = Stats.min(cyclicDFAStates);
            //
            //		data. = Stats.max(cyclicDFAStates);
            //
            //		data. = Stats.avg(cyclicDFAStates);
            //
            //		data. = Stats.stddev(cyclicDFAStates);
            //
            //		data. = Stats.sum(cyclicDFAStates);

            data.numTokens = g.TokenTypes.Length;

            data.DFACreationWallClockTimeInMS = g.DFACreationWallClockTimeInMS;

            // includes true ones and preds in synpreds I think; strip out.
            data.numberOfSemanticPredicates = g.numberOfSemanticPredicates;

            data.numberOfManualLookaheadOptions = g.numberOfManualLookaheadOptions;

            data.numNonLLStarDecisions = g.numNonLLStar;
            data.numNondeterministicDecisions = g.setOfNondeterministicDecisionNumbers.Count;
            data.numNondeterministicDecisionNumbersResolvedWithPredicates =
                g.setOfNondeterministicDecisionNumbersResolvedWithPredicates.Count;

            data.errors = ErrorManager.GetErrorState().errors;
            data.warnings = ErrorManager.GetErrorState().warnings;
            data.infos = ErrorManager.GetErrorState().infos;

            data.blocksWithSemPreds = g.blocksWithSemPreds.Count;

            data.decisionsWhoseDFAsUsesSemPreds = g.decisionsWhoseDFAsUsesSemPreds.Count;

            return data;
        }
Пример #31
0
        public void TestAETPCountUnlimited()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\CurrentBCTCmodules.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new AETPList();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COUNT", "-1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Object Name", "Object full name", "Object Type", "Status", "Effort complexity", "Equivalence ratio", "AEP"
            });
            expectedData.AddRange(new List <string> {
                "browserid.js", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\browserid.js]", "eFile", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "browserID", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\browserid.js].browserID", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "drawCal", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].drawCal", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "fnInit", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].fnInit", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "getDays", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].getDays", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "getMonthName", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].getMonthName", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "leapYear", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].leapYear", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "setCal", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\calendar.htc].setCal", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "onclick", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].COMPONENT.onclick", "eEvent", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "start", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].COMPONENT.start", "eMethod", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "stop", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].COMPONENT.stop", "eMethod", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "getDir", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].getDir", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "onClick", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].onClick", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "putDir", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].putDir", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "setDir", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].setDir", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "start", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].start", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            expectedData.AddRange(new List <string> {
                "stop", "[C:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\IFPUG\\Sol2005\\solution_complete_for_stats\\WebApplicationVB\\appli_web_asp\\composant.htc].stop", "eFunction", "added", "0.05", "45.43", "2.27"
            });
            TestUtility.AssertTableContent(table, expectedData, 7, 18);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 public PowerpointDocumentBuilder(ReportData client) : base(client)
 {
 }
 public override string Content(ReportData reportData, Dictionary <string, string> options)
 {
     return((reportData != null) ? reportData.Category ?? "All" : Domain.Constants.No_Value);
 }
Пример #34
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            #region METHODS

            const string metricFormat = "N2";

            bool displayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);

            int param;

            bool showEvol = false;
            if (options != null && options.ContainsKey("SHOW_EVOL") && int.TryParse(options["SHOW_EVOL"], out param))
            {
                showEvol = (param != 0);
            }

            bool showEvolPercent = true;
            if (options != null && options.ContainsKey("SHOW_EVOL_PERCENT") && int.TryParse(options["SHOW_EVOL_PERCENT"], out param))
            {
                showEvolPercent = (param != 0);
            }

            if (reportData?.CurrentSnapshot?.BusinessCriteriaResults == null)
            {
                return(null);
            }
            bool hasPreviousSnapshot = null != reportData.PreviousSnapshot;

            #region currSnapshot
            string currSnapshotLabel = SnapshotUtility.GetSnapshotVersionNumber(reportData.CurrentSnapshot);
            BusinessCriteriaDTO currSnapshotBisCriDTO = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(reportData.CurrentSnapshot, false);
            #endregion  currSnapshot

            #region prevSnapshot
            string prevSnapshotLabel = hasPreviousSnapshot ? SnapshotUtility.GetSnapshotVersionNumber(reportData.PreviousSnapshot) : Constants.No_Value;
            BusinessCriteriaDTO prevSnapshotBisCriDTO = hasPreviousSnapshot ? BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(reportData.PreviousSnapshot, false) : null;
            #endregion  prevSnapshot

            List <string> rowData = new List <string>();
            rowData.AddRange(displayShortHeader
                ? new[] { " ", Labels.TQI, Labels.Robu, Labels.Efcy, Labels.Secu, Labels.Trans, Labels.Chang }
                : new[] { " ", Labels.TQI, Labels.Robustness, Labels.Efficiency, Labels.Security, Labels.Transferability, Labels.Changeability });
            rowData.AddRange(
                new[] {
                currSnapshotLabel,
                currSnapshotBisCriDTO.TQI?.ToString(metricFormat) ?? Constants.No_Value,
                currSnapshotBisCriDTO.Robustness?.ToString(metricFormat) ?? Constants.No_Value,
                currSnapshotBisCriDTO.Performance?.ToString(metricFormat) ?? Constants.No_Value,
                currSnapshotBisCriDTO.Security?.ToString(metricFormat) ?? Constants.No_Value,
                currSnapshotBisCriDTO.Transferability?.ToString(metricFormat) ?? Constants.No_Value,
                currSnapshotBisCriDTO.Changeability?.ToString(metricFormat) ?? Constants.No_Value
            });

            if (hasPreviousSnapshot)
            {
                #region variation
                BusinessCriteriaDTO _businessCriteriaGradesEvol        = (currSnapshotBisCriDTO - prevSnapshotBisCriDTO);
                BusinessCriteriaDTO _businessCriteriaGradesEvolPercent = (_businessCriteriaGradesEvol / prevSnapshotBisCriDTO);
                #endregion  variation

                rowData.AddRange(
                    new[] {
                    prevSnapshotLabel,
                    prevSnapshotBisCriDTO.TQI?.ToString(metricFormat) ?? Constants.No_Value,
                    prevSnapshotBisCriDTO.Robustness?.ToString(metricFormat) ?? Constants.No_Value,
                    prevSnapshotBisCriDTO.Performance?.ToString(metricFormat) ?? Constants.No_Value,
                    prevSnapshotBisCriDTO.Security?.ToString(metricFormat) ?? Constants.No_Value,
                    prevSnapshotBisCriDTO.Transferability?.ToString(metricFormat) ?? Constants.No_Value,
                    prevSnapshotBisCriDTO.Changeability?.ToString(metricFormat) ?? Constants.No_Value,
                });

                if (showEvol)
                {
                    rowData.AddRange(
                        new[] {
                        Labels.Evol,
                        _businessCriteriaGradesEvol.TQI.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.TQI.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvol.Robustness.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.Robustness.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvol.Performance.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.Performance.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvol.Security.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.Security.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvol.Transferability.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.Transferability.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvol.Changeability.HasValue ? FormatEvolution(_businessCriteriaGradesEvol.Changeability.Value) : Constants.No_Value
                    });
                }

                if (showEvolPercent)
                {
                    rowData.AddRange(
                        new[] {
                        Labels.EvolPercent,
                        _businessCriteriaGradesEvolPercent.TQI.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.TQI.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvolPercent.Robustness.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.Robustness.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvolPercent.Performance.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.Performance.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvolPercent.Security.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.Security.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvolPercent.Transferability.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.Transferability.Value) : Constants.No_Value,
                        _businessCriteriaGradesEvolPercent.Changeability.HasValue ? FormatPercent(_businessCriteriaGradesEvolPercent.Changeability.Value) : Constants.No_Value
                    });
                }
            }

            var resultTable = new TableDefinition {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = hasPreviousSnapshot ? 4 : 2,
                NbColumns        = 7,
                Data             = rowData
            };
            return(resultTable);
        }
Пример #35
0
 private void AddContents(Section section, ReportData data)
 {
     AddPatientInfo(section, data);
     AddDVHTable(section, data);
 }
Пример #36
0
        public void TestAllRules()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData = TestUtility.AddSameCriticalRuleViolationsForAllBC(reportData, @".\Data\cc60017extract.json", null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new CastReporting.Reporting.Block.Table.MetricTopArtifact();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Sample Violating Artefacts for Rule 'Avoid instantiations inside loops'", "# 8 of 8"
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.BLL.Computing.RulesViolationUtility.GetNbViolationByRule", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Block.Graph.PieModuleArtifact.Content", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Block.Table.MetricTopArtifact.Content", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Builder.BlockProcessing.GraphBlock.ApplyContent", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Builder.ExcelDocumentBuilder.UpdateMergedCellReferences", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Helper.GenericContent.Content", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Helper.OptionsHelper.GetIntListOption", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.UnitTest.Reporting.TestUtility.PrepaPortfolioReportData", ""
            });
            expectedData.AddRange(new List <string> {
                "Sample Violating Artefacts for Rule 'Avoid declaring public Fields'", "# 5 of 5"
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.BLL.Computing.DTO.EvolutionResult.type", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Builder.ExcelDocumentBuilder.reportData", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.Helper.GenericContent.ObjConfig.Parameters", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.Reporting.ReportingModel.ReportData.RuleExplorer", ""
            });
            expectedData.AddRange(new List <string> {
                "CastReporting.UI.WPF.Commands.MenuCommand.OpenHelp", ""
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 14);
        }
        /// <summary>
        /// Converts data returned from DB to a List of DiaryTitles
        /// </summary>
        /// <param name="Data">AquariumReportManagement.ReportData</param>
        /// <returns>List of DiaryTitles</returns>
        private List<DiaryTitle> ToList(ReportData Data)
        {
            List<DiaryTitle> TempList = new List<DiaryTitle>();

            DataTable dt = SDKHelper.GetDataTableFromSdkResult(Data.Columns, Data.Rows);
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["DiaryTitleID"] != null)
                {
                    if (Convert.ToInt32(dr["DiaryTitleID"]) != 0)
                        TempList.Add(new DiaryTitle { DiaryTitleID = Convert.ToInt32(dr["DiaryTitleID"]), Title = dr["DiaryTitle"].ToString() });
                }
            }

            return TempList;
        }
        public void TestNocountMetric()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);
            reportData.RuleExplorer     = new RuleBLLStub();

            var component = new CastReporting.Reporting.Block.Table.RulesListViolationsBookmarks();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "METRICS", "7846" }
            };
            var table = component.Content(reportData, config);

            Assert.AreEqual(1, table.NbColumns);
            Assert.AreEqual(65, table.NbRows);
            Assert.AreEqual("Violations", table.Data.ElementAt(0));
            Assert.AreEqual("Objects in violation for rule Avoid Methods with a very low comment/code ratio", table.Data.ElementAt(2));
            Assert.AreEqual("# Violations: 128", table.Data.ElementAt(3));
            Assert.AreEqual("Violation #5    Avoid Methods with a very low comment/code ratio", table.Data.ElementAt(55));
            Assert.AreEqual("Object Name: com.castsoftware.aed.common.AedCommandLine.getFormattedMsg", table.Data.ElementAt(56));
            Assert.AreEqual("Object Type: MyObjType", table.Data.ElementAt(57));
            Assert.AreEqual("File path: C:\\jenkins6_slave\\workspace\\CAIP_8.3.3_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Dream Team\\DssAdmin\\DssAdmin\\MetricTree.cpp", table.Data.ElementAt(58));

            var cellsProperties = table.CellsAttributes;

            Assert.AreEqual(58, cellsProperties.Count);
            Assert.AreEqual(Color.Gray, cellsProperties[0].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[1].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[2].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[3].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[4].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[5].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[6].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[7].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[8].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[9].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[10].BackgroundColor);
            Assert.AreEqual(Color.Lavender, cellsProperties[11].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[12].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[13].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[14].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[15].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[16].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[17].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[18].BackgroundColor);

            Assert.AreEqual(Color.White, cellsProperties[57].BackgroundColor);
        }
Пример #39
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();
     ReportData ds = new ReportData();
     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 = "QUALIFIELDRESULTDataTable";
     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;
 }
        public void TestMetricsStdTag()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);
            reportData.RuleExplorer     = new RuleBLLStub();

            var component = new CastReporting.Reporting.Block.Table.RulesListViolationsBookmarks();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "METRICS", "CWE" },
                { "COUNT", "-1" }
            };
            var table = component.Content(reportData, config);

            Assert.AreEqual(1, table.NbColumns);
            Assert.AreEqual(206, table.NbRows);
            Assert.AreEqual("Violations", table.Data.ElementAt(0));
            Assert.AreEqual("Objects in violation for rule Avoid using SQL queries inside a loop", table.Data.ElementAt(2));
            Assert.AreEqual("# Violations: 86", table.Data.ElementAt(3));
            Assert.AreEqual("Violation #7    Avoid using SQL queries inside a loop", table.Data.ElementAt(179));
            Assert.AreEqual("Object Name: aedtst_exclusions_central.adgc_delta_debt_removed", table.Data.ElementAt(180));
            Assert.AreEqual("Object Type: MyObjType", table.Data.ElementAt(181));
            Assert.AreEqual("File path: D:\\CASTMS\\TST834\\Deploy\\Team\\AADAED\\SQL\\central.sql", table.Data.ElementAt(182));
            Assert.AreEqual("File path: D:\\CASTMS\\TST834\\Deploy\\Team\\AADAED\\Java\\AADAdmin\\AadSite\\sources\\com\\castsoftware\\aad\\site\\AadSite.java", table.Data.ElementAt(198));
            Assert.AreEqual("1203 :         }", table.Data.ElementAt(205));

            var cellsProperties = table.CellsAttributes;

            Assert.AreEqual(197, cellsProperties.Count);
            Assert.AreEqual(Color.Gray, cellsProperties[0].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[1].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[2].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[3].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[4].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[5].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[6].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[7].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[8].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[9].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[10].BackgroundColor);
            Assert.AreEqual(Color.Lavender, cellsProperties[11].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[12].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[13].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[14].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[15].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[16].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[17].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[18].BackgroundColor);

            Assert.AreEqual(Color.Gainsboro, cellsProperties[35].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[170].BackgroundColor);
        }
        /// <summary>
        /// Collects crash data.
        /// </summary>
        /// <param name="context"><see cref="Context"/> for the application being reported.</param>
        /// <param name="reportFields"><see cref="Array"/> of <see cref="ReportField"/> to include in report</param>
        /// <param name="appStartDate"><see cref="Time"/> of application start</param>
        /// <param name="initialConfiguration">Application initial configuration</param>
        /// <param name="th"><see cref="Java.Lang.Throwable"/> that caused the crash.</param>
        /// <param name="isSilentReport">Whether to report this report as being sent silently.</param>
        /// <returns>Builded report data</returns>
        public static ReportData BuildReportData(Context context, ReportField[] reportFields, Time appStartDate, string initialConfiguration, Java.Lang.Throwable th, bool isSilentReport)
        {
            var crashReportData = new ReportData();
            try
            {
                crashReportData.Add(ReportField.StackTrace, th.StackTrace);
                crashReportData.Add(ReportField.UserAppStartDate, appStartDate.Format3339(false));

                if (isSilentReport)
                {
                    crashReportData.Add(ReportField.IsSilent, "true");
                }

                if (reportFields.Contains(ReportField.ReportID))
                {
                    crashReportData.Add(ReportField.ReportID, Guid.NewGuid().ToString());
                }

                if (reportFields.Contains(ReportField.InstallationID))
                {
                    crashReportData.Add(ReportField.InstallationID, Installation.Id(context));
                }

                if (reportFields.Contains(ReportField.InitialConfiguration))
                {
                    crashReportData.Add(ReportField.InitialConfiguration, initialConfiguration);
                }

                if (reportFields.Contains(ReportField.CrashConfiguration))
                {
                    crashReportData.Add(ReportField.CrashConfiguration, ReportUtils.GetCrashConfiguration(context));
                }

                if (reportFields.Contains(ReportField.DumpsysMeminfo))
                {
                    crashReportData.Add(ReportField.DumpsysMeminfo, DumpSysCollector.CollectMemInfo());
                }

                if (reportFields.Contains(ReportField.PackageName))
                {
                    crashReportData.Add(ReportField.PackageName, context.PackageName);
                }

                if (reportFields.Contains(ReportField.Build))
                {
                    crashReportData.Add(ReportField.Build, ReflectionCollector.CollectStaticProperties(typeof(Build)));
                }

                if (reportFields.Contains(ReportField.PhoneModel))
                {
                    crashReportData.Add(ReportField.PhoneModel, Build.Model);
                }

                if (reportFields.Contains(ReportField.AndroidVersion))
                {
                    crashReportData.Add(ReportField.AndroidVersion, Build.VERSION.Release);
                }

                if (reportFields.Contains(ReportField.Brand))
                {
                    crashReportData.Add(ReportField.Brand, Build.Brand);
                }

                if (reportFields.Contains(ReportField.Product))
                {
                    crashReportData.Add(ReportField.Product, Build.Product);
                }

                if (reportFields.Contains(ReportField.TotalMemSize))
                {
                    crashReportData.Add(ReportField.TotalMemSize, ReportUtils.TotalInternalMemorySize.ToString());
                }

                if (reportFields.Contains(ReportField.AvailableMemSize))
                {
                    crashReportData.Add(ReportField.AvailableMemSize, ReportUtils.AvailableInternalMemorySize.ToString());
                }

                if (reportFields.Contains(ReportField.FilePath))
                {
                    crashReportData.Add(ReportField.FilePath, ReportUtils.GetApplicationFilePath(context));
                }

                if (reportFields.Contains(ReportField.Display))
                {
                    crashReportData.Add(ReportField.Display, ReportUtils.GetDisplayDetails(context));
                }

                if (reportFields.Contains(ReportField.UserCrashDate))
                {
                    var curDate = new Time();
                    curDate.SetToNow();
                    crashReportData.Add(ReportField.UserCrashDate, curDate.Format3339(false));
                }

                if (reportFields.Contains(ReportField.DeviceFeatures))
                {
                    crashReportData.Add(ReportField.DeviceFeatures, DeviceFeaturesCollector.GetFeatures(context));
                }

                if (reportFields.Contains(ReportField.Environment))
                {
                    crashReportData.Add(ReportField.Environment, ReflectionCollector.CollectStaticProperties(typeof(Environment)));
                }

                if (reportFields.Contains(ReportField.SettingsSystem))
                {
                    crashReportData.Add(ReportField.SettingsSystem, SettingsCollector.CollectSystemSettings(context));
                }

                if (reportFields.Contains(ReportField.SettingsSecure))
                {
                    crashReportData.Add(ReportField.SettingsSecure, SettingsCollector.CollectSecureSettings(context));
                }

                if (reportFields.Contains(ReportField.SharedPreferences))
                {
                    crashReportData.Add(ReportField.SharedPreferences, SharedPreferencesCollector.Collect(context));
                }

                var pm = new PackageManagerWrapper(context);
                var pi = pm.GetPackageInfo();
                if (pi != null)
                {
                    if (reportFields.Contains(ReportField.AppVersionCode))
                    {
                        crashReportData.Add(ReportField.AppVersionCode, pi.VersionCode.ToString());
                    }
                    if (reportFields.Contains(ReportField.AppVersionName))
                    {
                        crashReportData.Add(ReportField.AppVersionName, pi.VersionName ?? "not set");
                    }
                }
                else
                {
                    crashReportData.Add(ReportField.AppVersionName, "Package info unavailable");
                }

                if (reportFields.Contains(ReportField.DeviceID) && pm.HasPermission(Manifest.Permission.ReadPhoneState))
                {
                    var deviceId = ReportUtils.GetDeviceId(context);
                    if (deviceId != null)
                    {
                        crashReportData.Add(ReportField.DeviceID, deviceId);
                    }
                }

                if (pm.HasPermission(Manifest.Permission.ReadLogs))
                {
                    Log.Info(Constants.LOG_TAG, "READ_LOGS granted! Crasher can include LogCat and DropBox data.");
                    if (reportFields.Contains(ReportField.Logcat))
                    {
                        crashReportData.Add(ReportField.Logcat, LogCatCollector.CollectLogCat(null));
                    }
                    if (reportFields.Contains(ReportField.Eventslog))
                    {
                        crashReportData.Add(ReportField.Eventslog, LogCatCollector.CollectLogCat("events"));
                    }
                    if (reportFields.Contains(ReportField.Radiolog))
                    {
                        crashReportData.Add(ReportField.Radiolog, LogCatCollector.CollectLogCat("radio"));
                    }
                }
                else
                {
                    Log.Info(Constants.LOG_TAG, "READ_LOGS not allowed. Crasher will not include LogCat and DropBox data.");
                }

            }
            catch (Java.Lang.RuntimeException e)
            {
                Log.Error(Constants.LOG_TAG, e, "Error while retrieving crash data");
            }
            return crashReportData;
        }
        public void TestBCmetrics()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);
            reportData.RuleExplorer     = new RuleBLLStub();

            var component = new CastReporting.Reporting.Block.Table.RulesListViolationsBookmarks();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "METRICS", "60011" },
                { "COUNT", "2" }
            };
            var table = component.Content(reportData, config);

            Assert.AreEqual(1, table.NbColumns);
            Assert.AreEqual(194, table.NbRows);
            Assert.AreEqual("Violations", table.Data.ElementAt(0));
            Assert.AreEqual("Objects in violation for rule Action Mappings should have few forwards", table.Data.ElementAt(2));
            Assert.AreEqual("# Violations: 77", table.Data.ElementAt(3));
            Assert.AreEqual("Violation #1    Action Mappings should have few forwards", table.Data.ElementAt(9));
            Assert.AreEqual("Violation #2    Action Mappings should have few forwards", table.Data.ElementAt(37));
            Assert.AreEqual("Objects in violation for rule Avoid accessing data by using the position and length", table.Data.ElementAt(65));
            Assert.AreEqual("# Violations: 6", table.Data.ElementAt(66));
            Assert.AreEqual("Objects in violation for rule Avoid artifacts having recursive calls", table.Data.ElementAt(130));
            Assert.AreEqual("# Violations: 12", table.Data.ElementAt(131));
            Assert.AreEqual("1203 :         }", table.Data.ElementAt(193));


            var cellsProperties = table.CellsAttributes;

            Assert.AreEqual(184, cellsProperties.Count);
            Assert.AreEqual(Color.Gray, cellsProperties[0].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[1].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[2].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[3].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[4].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[5].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[6].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[7].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[8].BackgroundColor);
            Assert.AreEqual(Color.Lavender, cellsProperties[9].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[10].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[11].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[12].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[13].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[14].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[15].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[16].BackgroundColor);

            Assert.AreEqual(Color.Gray, cellsProperties[60].BackgroundColor);
            Assert.AreEqual(Color.Gray, cellsProperties[122].BackgroundColor);
        }
Пример #43
0
 private static void grZd(List<IGrouping<Event, AccountItem>> profList, string grName, 
     List<IGrouping<Event, AccountItem>> predList, Worksheet ws, int grColIndex)
 {
     ReportData colData;
     colData = new ReportData();
     colData.Prof = profList.Count(x => x.Key.RbResult.Name.Contains(grName));
     colData.Pred = predList.Count(x => x.Key.RbResult.Name.Contains(grName));
     fillColumn(ws, colData, grColIndex);
 }
        public void TestTCmetrics()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);
            reportData.RuleExplorer     = new RuleBLLStub();

            var component = new CastReporting.Reporting.Block.Table.RulesListViolationsBookmarks();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "METRICS", "61028" },
                { "COUNT", "1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>
            {
                "Violations",
                "",
                "Objects in violation for rule Avoid using SQL queries inside a loop",
                "# Violations: 86",
                "Rationale: ",
                "Having an SQL query inside a loop is usually the source of performance and scalability problems especially if the number of iterations become very high (for example if it is dependent on the data returned from the database).\nThis iterative pattern has proved to be very dangerous for application performance and scalability. Database servers perform much better in set-oriented patterns rather than pure iterative ones.",
                "Description: ",
                "This metric retrieves all artifacts using at least one SQL query inside a loop statement.",
                "Remediation: ",
                "The remediation is often to replace the iterative approach based on a loop with a set-oriented one and thus modify the query.",
                "",
                "Violation #1    Avoid using SQL queries inside a loop",
                "Object Name: aedtst_exclusions_central.adg_central_grades_std",
                "Object Type: MyObjType",
                "File path: D:\\CASTMS\\TST834\\Deploy\\Team\\AADAED\\SQL\\central.sql",
                "1197 : PreparedStatement statement = null;",
                "1198 :         try",
                "1199 :         {",
                "1200 :             statement = consolidatedConn.prepareStatement(insertMessage); ",
                "1201 :             statement.setString(1, message); ",
                "1202 :             statement.executeUpdate(); ",
                "1203 :         }",
                "File path: D:\\CASTMS\\TST834\\Deploy\\Team\\AADAED\\Java\\AADAdmin\\AadSite\\sources\\com\\castsoftware\\aad\\site\\AadSite.java",
                "1197 : PreparedStatement statement = null;",
                "1198 :         try",
                "1199 :         {",
                "1200 :             statement = consolidatedConn.prepareStatement(insertMessage); ",
                "1201 :             statement.setString(1, message); ",
                "1202 :             statement.executeUpdate(); ",
                "1203 :         }",
                "File path: D:\\CASTMS\\TST834\\Deploy\\Team\\AADAED\\Java\\AADAdmin\\AadSite\\sources\\com\\castsoftware\\aad\\site\\AadSite.java",
                "1197 : PreparedStatement statement = null;",
                "1198 :         try",
                "1199 :         {",
                "1200 :             statement = consolidatedConn.prepareStatement(insertMessage); ",
                "1201 :             statement.setString(1, message); ",
                "1202 :             statement.executeUpdate(); ",
                "1203 :         }",
                "",
                "Objects in violation for rule Avoid Methods with a very low comment/code ratio",
                "# Violations: 128",
                "Rationale: ",
                "Maintainability of the code is facilitated if there is documentation in the code. This rule will ensure there are comments within the Artifact",
                "Description: ",
                "Methods should have at least a ratio comment/code > X %\nThe threshold is a parameter and can be changed at will.",
                "Remediation: ",
                "Enrich Artifact code with comments",
                "",
                "Violation #1    Avoid Methods with a very low comment/code ratio",
                "Object Name: com.castsoftware.aad.common.AadCommandLine.dumpStack",
                "Object Type: MyObjType",
                "File path: C:\\jenkins6_slave\\workspace\\CAIP_8.3.3_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Dream Team\\DssAdmin\\DssAdmin\\MetricTree.cpp",
                "4904 :      m_bGridModified = FALSE;",
                "4905 :  }",
                "4906 : ",
                "4907 :  void CMetricTreePageDet::Validate()",
                "4908 :  {",
                "4909 :      int i, index, nAggregate, nAggregateCentral, nType, nLastLine;"
            };

            TestUtility.AssertTableContent(table, expectedData, 1, 58);

            var cellsProperties = table.CellsAttributes;

            Assert.AreEqual(53, cellsProperties.Count);
            Assert.AreEqual(Color.Gray, cellsProperties[0].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[1].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[2].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[3].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[4].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[5].BackgroundColor);
            Assert.AreEqual(Color.LightGray, cellsProperties[6].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[7].BackgroundColor);
            Assert.AreEqual(Color.Gainsboro, cellsProperties[8].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[9].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[10].BackgroundColor);
            Assert.AreEqual(Color.Lavender, cellsProperties[11].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[12].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[13].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[14].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[15].BackgroundColor);
            Assert.AreEqual(Color.LightYellow, cellsProperties[16].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[17].BackgroundColor);
            Assert.AreEqual(Color.White, cellsProperties[18].BackgroundColor);

            Assert.AreEqual(Color.White, cellsProperties[52].BackgroundColor);
        }
        public FileResult Apply(int Y, int user_id, int equipment_category_id)
        {
            string DBConnectionCode = CommSetup.CommWebSetup.DB0_CodeString;
            ReportCenter logicCenter = new ReportCenter(DBConnectionCode);
            db0 = ReportCenter.getDB0;

            var getUserIdCK = Request.Cookies["user_id"];
            string getUserId = string.Empty;

            Apply_User getUserData = null;
            if (getUserIdCK == null)
            {
                getUserData = db0.Apply_User.Find(user_id);
            }
            else
            {
                getUserId = getUserIdCK.Value;
                getUserData = db0.Apply_User.Where(x => x.USERID == getUserId).FirstOrDefault();
            }

            var getApplyData = db0.Apply.Where(x => x.USERID == getUserData.USERID && x.Y == Y).FirstOrDefault();
            var getEquipmentCategory = db0.Equipment_Category.Find(equipment_category_id);

            ReportData rpt = new ReportData() { ReportName = "Apply.rdlc" };

            List<ReportParameter> rparam = new List<ReportParameter>();
            rparam.Add(new ReportParameter("applyYear", Y.ToString()));
            rparam.Add(new ReportParameter("applyName", getUserData.USERNAME));

            rparam.Add(new ReportParameter("doc_name", getApplyData.doc_name));
            rparam.Add(new ReportParameter("doc_rank", getApplyData.doc_rank));
            rparam.Add(new ReportParameter("doc_tel", getApplyData.doc_tel));
            rparam.Add(new ReportParameter("mng_name", getApplyData.mng_name));
            rparam.Add(new ReportParameter("mng_rank", getApplyData.mng_rank));
            rparam.Add(new ReportParameter("mng_tel", getApplyData.mng_tel));
            rparam.Add(new ReportParameter("equipment_category_name", getEquipmentCategory.category_name));

            db0.Dispose();

            rpt.Data = logicCenter.reportAply_Detail(getApplyData.apply_id);

            ReportViewer rptvw = new ReportViewer();
            rptvw.ProcessingMode = ProcessingMode.Local;
            ReportDataSource rds = new ReportDataSource("MasterData", rpt.Data);

            rptvw.LocalReport.DataSources.Clear();
            rptvw.LocalReport.ReportPath = @"_Code\RPTFile\" + rpt.ReportName;
            rptvw.LocalReport.DataSources.Add(rds);
            foreach (var pa in rparam)
            {
                rptvw.LocalReport.SetParameters(pa);
            }
            rptvw.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
            rptvw.LocalReport.Refresh();

            Warning[] warnings;
            string[] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension = string.Empty;
            byte[] bytes = rptvw.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

            Stream outputStream = new MemoryStream(bytes);
            string setFileName = "申報表" + DateTime.Now.Ticks + ".pdf";
            return File(outputStream, "application/pdf", setFileName);
        }
Пример #46
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            List <string> rowData = new List <string>();

            bool   shortName  = options.GetOption("NAME", "FULL") == "SHORT";
            int    nbLimitTop = options.GetOption("COUNT") == "ALL" ? -1 : options.GetIntOption("COUNT", 10);
            string filter     = options.GetOption("FILTER", "ALL");
            int    nbRows;

            rowData.Add(Labels.RuleName);
            rowData.Add(Labels.ObjectName);
            rowData.Add(Labels.Comment);
            rowData.Add(Labels.Priority);
            rowData.Add(Labels.Status);
            rowData.Add(Labels.LastUpdated);

            IEnumerable <Violation> results = reportData.SnapshotExplorer.GetViolationsInActionPlan(reportData.CurrentSnapshot.Href, nbLimitTop);

            if (results != null)
            {
                switch (filter)
                {
                case "ADDED":
                    results = results.Where(_ => _.RemedialAction.Status.Equals("added"));
                    break;

                case "PENDING":
                    results = results.Where(_ => _.RemedialAction.Status.Equals("pending"));
                    break;

                case "SOLVED":
                    results = results.Where(_ => _.RemedialAction.Status.Equals("solved"));
                    break;
                }

                var _violations = results as IList <Violation> ?? results.ToList();
                if (_violations.Count != 0)
                {
                    foreach (Violation _violation in _violations)
                    {
                        rowData.Add(_violation.RulePattern.Name ?? Constants.No_Value);
                        rowData.Add(shortName ? _violation.Component.ShortName : _violation.Component.Name ?? Constants.No_Value);
                        rowData.Add(_violation.RemedialAction.Comment ?? Constants.No_Value);
                        rowData.Add(_violation.RemedialAction.Priority ?? Constants.No_Value);
                        rowData.Add(_violation.RemedialAction.Status ?? Constants.No_Value);
                        rowData.Add(_violation.RemedialAction.Dates.Updated.DateSnapShot?.ToString(Labels.FORMAT_LONG_DATE) ?? Constants.No_Value);
                    }
                    nbRows = _violations.Count + 1;
                }
                else
                {
                    rowData.Add(Labels.NoItem);
                    for (int i = 1; i < 6; i++)
                    {
                        rowData.Add(string.Empty);
                    }
                    nbRows = 2;
                }
            }
            else
            {
                rowData.Add(Labels.NoItem);
                for (int i = 1; i < 6; i++)
                {
                    rowData.Add(string.Empty);
                }
                nbRows = 2;
            }

            var table = new TableDefinition
            {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = nbRows,
                NbColumns        = 6,
                Data             = rowData
            };

            return(table);
        }
Пример #47
0
 public override void generateReport(ReportData data)
 {
     setReportContent("JSON Report. Name: " + data.getName());
 }
Пример #48
0
 public void Export(string path, ReportData data)
 {
     ExportPdf(path, CreateReport(data));
 }
Пример #49
0
        private static void fillColumn(Worksheet ws, ReportData columnData, int columnNumber)
        {
            var newCol = ((Range)ws.Columns[columnNumber]);
            var rowIndex = 10;

            if (columnData.Prof != null)
                ((Range)newCol.Cells[rowIndex, 1]).Value2 = columnData.Prof;

            rowIndex += 3;
            if (columnData.Pred != null)
                ((Range)newCol.Cells[rowIndex, 1]).Value2 = columnData.Pred;

            rowIndex += 2;
            if (columnData.Period != null)
                ((Range)newCol.Cells[rowIndex, 1]).Value2 = columnData.Period;
        }
Пример #50
0
        string ExportDataTableToPdf()
        {
            string folderPath = "E:\\PDF\\";

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            //File Name
            int    fileCount   = Directory.GetFiles("E:\\PDF").Length;
            string strFileName = "Programmes" + (fileCount + 1) + ".pdf";

            System.IO.FileStream fs       = new FileStream(folderPath + strFileName, FileMode.Create, FileAccess.Write, FileShare.None);
            Document             document = new Document(PageSize.A4, 55f, 30f, 45f, 0f);

            PdfWriter writer = PdfWriter.GetInstance(document, fs);

            document.Open();

            //Enseignant
            CurrentDataReportEnseignant = new Dal_Enseignant().GetAllEnseignantsDataTable();
            CurrentDataReportEnseignant = ReportData.AdaptDataTableEnseignant(CurrentDataReportEnseignant);

            foreach (DataRow row in CurrentDataReportEnseignant.Rows)
            {
                #region Section-Image

                BaseFont bfntHead         = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                Font     fntHead          = new Font(bfntHead, 16, 1, BaseColor.GRAY);
                string   imageURL         = @"C:\Users\LMIJ\Documents\Visual Studio 2015\Projects\Mini_Projet\Mini_Projet\Logo FSM - Small.png";
                iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageURL);

                //Resize image depend upon your need
                jpg.ScaleToFit(90f, 80f);
                //Give space before image
                jpg.SpacingBefore   = 45f;
                jpg.IndentationLeft = 55f;
                //Give some space after the image
                jpg.SpacingAfter = 20f;
                document.Add(jpg);
                document.Add(new Chunk("\n", fntHead));
                document.Add(new Chunk("\n", fntHead));
                jpg.Alignment = Element.ALIGN_LEFT;
                #endregion
                //Report Header

                Paragraph prgHeading = new Paragraph();
                prgHeading.Alignment = Element.ALIGN_CENTER;
                prgHeading.Add(new Chunk("Programme de surveillance".ToUpper(), fntHead));
                document.Add(prgHeading);

                document.Add(new Chunk("\n", fntHead));
                document.Add(new Chunk("\n", fntHead));
                //Author
                Paragraph prgAuthor = new Paragraph();
                BaseFont  btnAuthor = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                Font      fntAuthor = new Font(btnAuthor, 12, 2, BaseColor.GRAY);
                prgAuthor.Alignment       = Element.ALIGN_LEFT;
                prgAuthor.IndentationLeft = 45f;
                prgAuthor.Add(new Chunk("NOM & PRENOM :" + row[1].ToString(), fntAuthor));
                prgAuthor.Add(new Chunk("\nDEPARTEMENT :" + row[2].ToString(), fntAuthor));
                document.Add(prgAuthor);


                document.Add(new Chunk("\n", fntHead));
                Paragraph prgMsg = new Paragraph();
                prgMsg.Alignment = Element.ALIGN_CENTER;
                prgMsg.Add(new Chunk("Vous êtes prié de vous présenter aux séances de surveillances ci-dessous", fntAuthor));
                document.Add(prgMsg);

                //Add line break
                document.Add(new Chunk("\n", fntHead));

                //programme data

                CurrentDataReportProgrammes = new Dal_Surveillance().GetSurveillancesByEnseignant(Int32.Parse(row[0].ToString()));

                CurrentDataReportProgrammes = ReportData.AdaptDataTableProgrammes(CurrentDataReportProgrammes);

                //Write the table
                PdfPTable table = new PdfPTable(CurrentDataReportProgrammes.Columns.Count);
                //Table header
                BaseFont btnColumnHeader = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                Font     fntColumnHeader = new iTextSharp.text.Font(btnColumnHeader, 10, 1, BaseColor.WHITE);
                for (int i = 0; i < CurrentDataReportProgrammes.Columns.Count; i++)
                {
                    PdfPCell cell = new PdfPCell();
                    cell.BackgroundColor = BaseColor.GRAY;
                    cell.AddElement(new Chunk(CurrentDataReportProgrammes.Columns[i].ColumnName.ToUpper(), fntColumnHeader));
                    table.AddCell(cell);
                }
                //table Data
                for (int i = 0; i < CurrentDataReportProgrammes.Rows.Count; i++)
                {
                    for (int j = 0; j < CurrentDataReportProgrammes.Columns.Count; j++)
                    {
                        table.AddCell(CurrentDataReportProgrammes.Rows[i][j].ToString());
                    }
                }

                // Footer Section
                Paragraph prgfooter = new Paragraph();
                BaseFont  btnfooter = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                Font      fntfooter = fntAuthor;
                prgfooter.Alignment       = Element.ALIGN_RIGHT;
                prgfooter.IndentationLeft = 45f;
                prgfooter.Add(new Chunk("Fait le " + DateTime.Now.ToShortDateString(), fntAuthor));

                //End Of Footer Section

                document.Add(table);
                document.AddCreationDate();
                document.Add(prgfooter);
                document.NewPage();
            }

            document.Close();
            writer.Close();
            fs.Close();
            return(folderPath + strFileName);
        }
Пример #51
0
 protected override string Content(ReportData reportData, Dictionary <string, string> options)
 {
     return(DateTime.Now.ToString(Labels.FORMAT_LONG_DATE));
 }
Пример #52
0
 private void AddDVHTable(Section section, ReportData data)
 {
     new DVHTableContent().Add(section, data);
 }
Пример #53
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            int count = 0;

            var rowData = new List <string>();

            rowData.AddRange(new[] {
                " ",
                Labels.DebtRemoved + " (" + reportData.CurrencySymbol + ")",
                Labels.DebtAdded + " (" + reportData.CurrencySymbol + ")",
                Labels.Debt + " (" + reportData.CurrencySymbol + ")"
            });

            #region Fetch Snapshots
            int nbSnapshots = reportData.Application?.Snapshots.Count() ?? 0;
            if (nbSnapshots > 0)
            {
                var _snapshots = reportData.Application?.Snapshots.OrderBy(_ => _.Annotation.Date.DateSnapShot);
                if (_snapshots != null)
                {
                    foreach (Snapshot snapshot in _snapshots)
                    {
                        double?prevDoubleSnapshotDate   = snapshot.Annotation.Date.DateSnapShot?.ToOADate() ?? 0;
                        double?prevRemovedTechDebtValue = MeasureUtility.GetRemovedTechDebtMetric(snapshot) * -1;
                        double?prevAddedTechDebtValue   = MeasureUtility.GetAddedTechDebtMetric(snapshot);
                        double?prevTotalTechDebtValue   = MeasureUtility.GetTechnicalDebtMetric(snapshot);

                        rowData.Add(prevDoubleSnapshotDate.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(prevRemovedTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(prevAddedTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(prevTotalTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                    }
                }
                count = nbSnapshots;
            }
            #endregion Previous Snapshots

            #region just 1 snapshot
            if (reportData.Application?.Snapshots != null && nbSnapshots == 1 && reportData.CurrentSnapshot != null)
            {
                double?prevDoubleSnapshotDate   = reportData.CurrentSnapshot.Annotation.Date.DateSnapShot?.ToOADate() ?? 0;
                double?prevRemovedTechDebtValue = MeasureUtility.GetRemovedTechDebtMetric(reportData.CurrentSnapshot) * -1;
                double?prevAddedTechDebtValue   = MeasureUtility.GetAddedTechDebtMetric(reportData.CurrentSnapshot);
                double?prevTotalTechDebtValue   = MeasureUtility.GetTechnicalDebtMetric(reportData.CurrentSnapshot);
                rowData.AddRange(new[] {
                    prevDoubleSnapshotDate.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    prevRemovedTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    prevAddedTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    prevTotalTechDebtValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                });
                count = count + 1;
            }
            #endregion just 1 snapshot

            TableDefinition resultTable = new TableDefinition {
                HasRowHeaders    = true,
                HasColumnHeaders = false,
                NbRows           = count + 1,
                NbColumns        = 4,
                Data             = rowData,
                GraphOptions     = null
            };
            return(resultTable);
        }
Пример #54
0
 private void AddPatientInfo(Section section, ReportData data)
 {
     new PlanInfo().Add(section, data);
 }
Пример #55
0
        protected override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            #region METHODS

            TableDefinition resultTable = null;
            if (reportData != null && reportData.CurrentSnapshot != null)
            {
                double?criticalViolation = MeasureUtility.GetSizingMeasure(reportData.CurrentSnapshot, Constants.SizingInformations.ViolationsToCriticalQualityRulesNumber);
                double?numCritPerFile    = MeasureUtility.GetSizingMeasure(reportData.CurrentSnapshot, Constants.SizingInformations.ViolationsToCriticalQualityRulesPerFileNumber);
                double?numCritPerKLOC    = MeasureUtility.GetSizingMeasure(reportData.CurrentSnapshot, Constants.SizingInformations.ViolationsToCriticalQualityRulesPerKLOCNumber);

                double?veryHighCostComplexityViolations = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot, Constants.
                                                                                                       QualityDistribution.DistributionOfViolationsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                                                                                                       Constants.ViolationsToCriticalDiagnosticBasedMetricsPerCostComplexity.ComplexityViolations_VeryHigh.GetHashCode());

                double?highCostComplexityViolations = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                                   Constants.QualityDistribution.DistributionOfViolationsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                                                                                                   Constants.ViolationsToCriticalDiagnosticBasedMetricsPerCostComplexity.ComplexityViolations_HighCost.GetHashCode());

                double?veryHighCostComplexityArtefacts = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                                      Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                                                                                                      Constants.CostComplexity.CostComplexityArtifacts_VeryHigh.GetHashCode());

                double?highCostComplexityArtefacts = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                                                                                                  Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                                                                                                  Constants.CostComplexity.CostComplexityArtifacts_High.GetHashCode());


                double?nbComplexityArtefacts          = MathUtility.GetSum(veryHighCostComplexityArtefacts, highCostComplexityArtefacts);
                double?nbComplexityArtefactsViolation = MathUtility.GetSum(veryHighCostComplexityViolations, highCostComplexityViolations);



                const string metricFormat          = "N0";
                const string metricFormatPrecision = "N2";

                string numCritPerFileIfNegative = string.Empty;
                if (numCritPerFile == -1)
                {
                    numCritPerFileIfNegative = "N/A";
                }
                else
                {
                    numCritPerFileIfNegative = (numCritPerFile.HasValue) ? numCritPerFile.Value.ToString(metricFormatPrecision) : Constants.No_Value;
                }

                var rowData = new List <string>()
                {
                    Labels.Name
                    , Labels.Value

                    , Labels.ViolationsCritical
                    , (criticalViolation.HasValue) ? criticalViolation.Value.ToString(metricFormat):Constants.No_Value

                    , "  " + Labels.PerFile
                    , numCritPerFileIfNegative

                    , "  " + Labels.PerkLoC
                    , (numCritPerKLOC.HasValue)? numCritPerKLOC.Value.ToString(metricFormatPrecision):Constants.No_Value

                    , Labels.ComplexObjects
                    , (nbComplexityArtefacts.HasValue)?  nbComplexityArtefacts.Value.ToString(metricFormat):Constants.No_Value

                    , "  " + Labels.WithViolations
                    , (nbComplexityArtefactsViolation.HasValue)? nbComplexityArtefactsViolation.Value.ToString(metricFormat):Constants.No_Value
                };

                resultTable = new TableDefinition
                {
                    HasRowHeaders    = true,
                    HasColumnHeaders = false,
                    NbRows           = 6,
                    NbColumns        = 2,
                    Data             = rowData
                };
            }
            return(resultTable);
        }
Пример #56
0
        public IActionResult clientReportGet()
        {
            var _creports = ReportData.getClientReportData();

            return(Ok(_creports));
        }
Пример #57
0
 private void importReport(String reportName)
 {
     ReportData reportdata = Session.FindObject<ReportData>(new BinaryOperator("Name", reportName));
     if (reportdata == null)
     {
         reportdata = new ReportData(Session);
     }
     reportdata.IsInplaceReport = false;
     using (XafReport rep = new XafReport { ReportName = reportName, ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance) })
     {
         rep.LoadLayout(GetType().Assembly.GetManifestResourceStream(String.Format("AIR_ERP.Module.AR.Reports.{0}.repx", reportName)));
         reportdata.SaveXtraReport(rep);
     }
     reportdata.Save();
     //XafReport rep = new XafReport();
     //rep.ReportName = reportName;
     //rep.ObjectSpace = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance);
     //rep.LoadLayout(GetType().Assembly.GetManifestResourceStream("AIR_ERP.Module.AR.Reports." + reportName + ".repx"));
     //reportdata.SaveXtraReport(rep);
     //reportdata.Save();
 }
Пример #58
0
        private void OnCommencing(object sender, EventArgs e)
        {
            int lossModifier = 1;

            if (ReportLossesAsNegative)
            {
                lossModifier = -1;
            }

            // check if running from a CLEM.Market
            bool market = (FindAncestor <Zone>().GetType() == typeof(Market));

            dataToWriteToDb = null;
            // sanitise the variable names and remove duplicates
            List <string> variableNames = new List <string>
            {
                "[Clock].Today as Date"
            };

            if (VariableNames != null && VariableNames.Count() > 0)
            {
                if (VariableNames.Count() > 1)
                {
                    Summary.WriteWarning(this, String.Format("Multiple resource groups not permitted in ReportResourceLedger [{0}]\r\nAdditional entries have been ignored", this.Name));
                }

                for (int i = 0; i < 1; i++)
                {
                    // each variable name is now a ResourceGroup
                    bool isDuplicate = StringUtilities.IndexOfCaseInsensitive(variableNames, this.VariableNames[i].Trim()) != -1;
                    if (!isDuplicate && this.VariableNames[i] != string.Empty)
                    {
                        // check it is a ResourceGroup
                        CLEMModel model = Resources.GetResourceGroupByName(this.VariableNames[i]) as CLEMModel;
                        if (model == null)
                        {
                            Summary.WriteWarning(this, String.Format("Invalid resource group [{0}] in ReportResourceBalances [{1}]\r\nEntry has been ignored", this.VariableNames[i], this.Name));
                        }
                        else
                        {
                            bool pricingIncluded = false;
                            if (model.GetType() == typeof(RuminantHerd))
                            {
                                pricingIncluded = model.FindAllDescendants <AnimalPricing>().Where(a => a.Enabled).Count() > 0;

                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.ID as uID");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.Breed as Breed");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.Gender as Sex");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.Age as Age");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.Weight as Weight");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.AdultEquivalent as AE");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.SaleFlag as Category");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.HerdName as RelatesTo");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ExtraInformation.PopulationChangeDirection as Change");

                                // ToDo: add pricing for ruminants including buy and sell pricing
                                // Needs update in CLEMResourceTypeBase and link between ResourcePricing and AnimalPricing.
                            }
                            else
                            {
                                pricingIncluded = model.FindAllDescendants <ResourcePricing>().Where(a => a.Enabled).Count() > 0;

                                if (ReportStyle == ReportTransactionStyle.GainAndLossColumns)
                                {
                                    variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.Gain as Gain");
                                    variableNames.Add("[Resources]." + this.VariableNames[i] + $".LastTransaction.Loss * {lossModifier} as Loss");
                                }
                                else
                                {
                                    variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.TransactionType as Type");
                                    variableNames.Add("[Resources]." + this.VariableNames[i] + $".LastTransaction.AmountModifiedForLoss({ReportLossesAsNegative}) as Amount");
                                }

                                // get all converters for this type of resource
                                if (IncludeConversions)
                                {
                                    var converterList = model.FindAllDescendants <ResourceUnitsConverter>().Select(a => a.Name).Distinct();
                                    if (converterList != null)
                                    {
                                        foreach (var item in converterList)
                                        {
                                            if (ReportStyle == ReportTransactionStyle.GainAndLossColumns)
                                            {
                                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ConvertTo(" + item + $",\"gain\",{ReportLossesAsNegative}) as " + item + "_Gain");
                                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ConvertTo(" + item + $",\"loss\",{ReportLossesAsNegative}) as " + item + "_Loss");
                                            }
                                            else
                                            {
                                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ConvertTo(" + item + $"\", {ReportLossesAsNegative}) as " + item + "_Amount");
                                            }
                                        }
                                    }
                                }

                                // add pricing
                                if (IncludePrice && pricingIncluded)
                                {
                                    if (ReportStyle == ReportTransactionStyle.GainAndLossColumns)
                                    {
                                        variableNames.Add("[Resources]." + this.VariableNames[i] + $".LastTransaction.ConvertTo(\"$gain\",\"gain\", {ReportLossesAsNegative}) as Price_Gain");
                                        variableNames.Add("[Resources]." + this.VariableNames[i] + $".LastTransaction.ConvertTo(\"$loss\",\"loss\", {ReportLossesAsNegative}) as Price_Loss");
                                    }
                                    else
                                    {
                                        variableNames.Add("[Resources]." + this.VariableNames[i] + $".LastTransaction.ConvertTo(\"$gain\", {ReportLossesAsNegative}) as Price_Amount");
                                    }
                                }

                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.ResourceType.Name as Resource");
                                // if this is a multi CLEM model simulation then add a new column with the parent Zone name
                                if (FindAncestor <Simulation>().FindChild <Market>() != null)
                                {
                                    variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.Activity.CLEMParentName as Source");
                                }
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.Activity.Name as Activity");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.RelatesToResource as RelatesTo");
                                variableNames.Add("[Resources]." + this.VariableNames[i] + ".LastTransaction.Category as Category");
                            }
                        }
                    }
                }
                events.Subscribe("[Resources]." + this.VariableNames[0] + ".TransactionOccurred", DoOutputEvent);
            }
            // Tidy up variable/event names.
            base.VariableNames = variableNames.ToArray();
            VariableNames      = variableNames.ToArray();
            base.VariableNames = TidyUpVariableNames();
            VariableNames      = base.VariableNames;
            base.EventNames    = TidyUpEventNames();
            EventNames         = base.EventNames;
            this.FindVariableMembers();
        }
Пример #59
0
 public void GenerateBattleReport(ReportData data)
 {
     m_reportData = data;
     m_reportList.GetComponentsInChildren<MogoListImproved>(true)[0].SetGridLayout<BattleReportUnit>((int)Math.Ceiling((double)data.Items.Count / RowNum) + 2, m_reportList.transform, ReportResourceLoaded);
 }
Пример #60
0
        public void FillReportProgrames(int IdEns, string Name, string Dept)
        {
            CurrentDataReportProgrammes = new Dal_Surveillance().GetSurveillancesByEnseignant(IdEns);

            CurrentDataReportProgrammes = ReportData.AdaptDataTableProgrammes(CurrentDataReportProgrammes);
        }