Exemplo n.º 1
0
        public static string BuildReport(ReportType reportType, TaskFilter filter, ReportViewType viewType, int templateID)
        {
            //prepare filter
            if (templateID != 0 && !filter.FromDate.Equals(DateTime.MinValue))
            {
                var interval = filter.ToDate.DayOfYear - filter.FromDate.DayOfYear;

                switch (reportType)
                {
                    case ReportType.TasksByUsers:
                    case ReportType.TasksByProjects:
                        {
                            filter.FromDate = TenantUtil.DateTimeNow().Date.AddDays(-interval);
                            filter.ToDate = TenantUtil.DateTimeNow().Date;
                        }
                        break;
                    case ReportType.MilestonesNearest:
                        {
                            filter.FromDate = TenantUtil.DateTimeNow().Date;
                            filter.ToDate = TenantUtil.DateTimeNow().Date.AddDays(interval);
                        }
                        break;
                }
            }

            //exec

            var report = Report.CreateNewReport(reportType, filter);
            var data = report.BuildReport().ToList();

            if (!data.Any())
                report = Report.CreateNewReport(ReportType.EmptyReport, filter);

            return ReportTransformer.Transform(data.ToList(), report, filter.ViewType, viewType, templateID);
        }
Exemplo n.º 2
0
 private void SendMessage(ReportType type, MessageLevel level, string message)
 {
     var encodedMessage = Convert.ToBase64String(Encoding.UTF8.GetBytes(message));
     var report = "{0}|{1}|{2}".FormatWith(type, level, encodedMessage);
     _output.WriteLine(report);
     _output.Flush();
 }
            protected override void Context()
            {
                base.Context();

                sampleDateTime = new DateTime(2012, 01, 02);
                sampleReportType = ReportType.Cost;
            }
Exemplo n.º 4
0
        public Report(ReportType reportType)
        {
            try
            {
                this.reporttype = reportType;

                dal = new Dal();

                switch (this.reporttype)
                {
                    case ReportType.IncomeExpenses:
                        this.reporttitle = "Income & Expenses";
                        updateEntries();
                        break;
                    case ReportType.ProductSales:
                        this.reporttitle = "Product Sales";
                        updateEntries();
                        break;
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Unable to load report " + reportType.ToString(), ex);
            }
        }
Exemplo n.º 5
0
        public void Report(ReportType reportType, ScenarioReportingContext reportingContext)
        {
            // only output current test info if running in R# -- it's not useful in command line builds
            if (reportType == ReportType.CurrentTest)
            {
                var executingProcessName = Process.GetCurrentProcess().ProcessName;

                if (executingProcessName.IndexOf("JetBrains.ReSharper", StringComparison.InvariantCultureIgnoreCase) == -1)
                {
                    return;
                }
            }

            int indentationLevel = 0;
            // avoid repeating the same feature over and over
            var featureKey = GetKey(reportingContext.FeatureReport);
            if (featureKey != null && featureKey == _previousFeatureKey)
            {
                indentationLevel = 1;
                reportingContext.FeatureReport.Clear();
            }

            Trace.WriteLine(reportingContext.CreateReportWithStandardSpacing(indentationLevel));

            _previousFeatureKey = featureKey;
        }
Exemplo n.º 6
0
 public static extern void Report(
         ReportType type,
         string reportContext,
         string fileName,
         int lineNo,
         DDS.ErrorCode reportCode,
         string description);
Exemplo n.º 7
0
 private static string DefinePropertiesOfDevice(ReportType type)
 {
     string deviceInfo = null;
     switch (type)
     {
         case ReportType.pdf:
             deviceInfo = "<DeviceInfo>" +
                          "  <OutputFormat>PDF</OutputFormat>" +
                          "  <PageWidth>8.5in</PageWidth>" +
                          "  <PageHeight>11in</PageHeight>" +
                          "  <MarginTop>0.5in</MarginTop>" +
                          "  <MarginLeft>1in</MarginLeft>" +
                          "  <MarginRight>1in</MarginRight>" +
                          "  <MarginBottom>0.5in</MarginBottom>" +
                          "</DeviceInfo>";
             break;
         case ReportType.image:
             deviceInfo = "<DeviceInfo>" +
                          "  <OutputFormat>jpeg</OutputFormat>" +
                          "  <PageWidth>8.5in</PageWidth>" +
                          "  <PageHeight>11in</PageHeight>" +
                          "  <MarginTop>0.5in</MarginTop>" +
                          "  <MarginLeft>1in</MarginLeft>" +
                          "  <MarginRight>1in</MarginRight>" +
                          "  <MarginBottom>0.5in</MarginBottom>" +
                          "</DeviceInfo>";
             break;
     }
     return deviceInfo;
 }
Exemplo n.º 8
0
        public ReportFiles(DataTable dataTable, string reportName,  ReportType reportType)
        {
            _dt = dataTable;
            _reportName = reportName;
            _reportType = reportType;

        }
		public static void SendMessage(this StreamWriter writer, ReportType type, MessageLevel level, string message)
		{
			var encodedMessage = Convert.ToBase64String(Encoding.UTF8.GetBytes(message));
			var report = "{0}|{1}|{2}".FormatWith(type, level, encodedMessage);
			writer.WriteLine(report);
			writer.Flush();
		}
Exemplo n.º 10
0
 /// <summary>
 /// Initialize repot object with default setting
 /// Copies = 1
 /// ReportType = Printer
 /// Path = 0
 /// </summary>
 public RDLCPrinter(LocalReport report)
 {
     _report = report;
     _Copies = 1;
     _ReportType = ReportType.Printer;
     _path = "";
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initialize report object with default setting
 /// </summary>
 public RDLCPrinter(LocalReport report, ReportType rtype, int nbrPage, string path)
 {
     _report = report;
     _Copies = nbrPage;
     _ReportType = rtype;
     _path = path;
 }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        #region Constructors and Destructors

        /// <summary>
        ///   Initializes a new instance of the <see cref="MetadataReportObjectCore" /> class.
        /// </summary>
        /// <param name="parent"> The parent. </param>
        /// <param name="report"> The dataStructureObject. </param>
        public MetadataReportObjectCore(IMetadataSet parent, ReportType report)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataReport), parent)
        {
            this._reportedAttributes = new List<IReportedAttributeObject>();
            this.id = report.id;
            if (report.Target != null)
            {
                this._target = new TargetObjectCore(this, report.Target);
            }

            if (report.AttributeSet != null)
            {
                if (ObjectUtil.ValidCollection(report.AttributeSet.ReportedAttribute))
                {
                    this._reportedAttributes.Clear();

                    foreach (ReportedAttributeType each in report.AttributeSet.ReportedAttribute)
                    {
                        this._reportedAttributes.Add(new ReportedAttributeObjectObjectCore(this, each));
                    }
                }
            }

            this.Validate();
        }
Exemplo n.º 13
0
        public ReportTemplateWrapper SaveReportTemplate(string name, string period, int periodItem, int hour, bool autoGenerated, ReportType reportType,
                                         int tag, int project, TaskStatus? status, Guid departament, Guid userId, ReportTimeInterval reportTimeInterval,
                                         ApiDateTime fromDate, ApiDateTime toDate, int viewType, bool noResponsible)
        {
            ProjectSecurity.DemandAuthentication();

            if (name == null || name.Trim().Length == 0) throw new ArgumentNullException("name");

            var filter = new TaskFilter
            {
                TagId = tag,
                DepartmentId = departament,
                UserId = userId,
                TimeInterval = reportTimeInterval,
                FromDate = fromDate,
                ToDate = toDate,
                ViewType = viewType,
                NoResponsible = noResponsible
            };

            if (project != 0)
                filter.ProjectIds.Add(project);

            if (status != null)
                filter.TaskStatuses.Add((TaskStatus)status);

            var template = new ReportTemplate(reportType) { Filter = filter };

            SaveOrUpdateTemplate(template, name, period, periodItem, hour, autoGenerated);

            return new ReportTemplateWrapper(template);
        }
        private void SendMessage(ReportType type, MessageLevel level, string message)
        {
            var encodedMessage = Convert.ToBase64String(Encoding.UTF8.GetBytes(message));
            var report = $"{type}|{level}|{encodedMessage}";
            _output.WriteLine(report);
            _output.Flush();

        }
Exemplo n.º 15
0
        public Report GetReportByDateAndType(DateTime reportDate, ReportType reportType)
        {
            getReportByDateAndType.ReportDate = reportDate;
            getReportByDateAndType.ReportType = reportType;
            var reports = getReportByDateAndType.Execute(session);

            return reports.First();
        }
Exemplo n.º 16
0
 public ReportItem(ReportType type = ReportType.Information, long? count = null, string eventname = null, string data = null)
     : this()
 {
     this.Type = type;
     this.Count = count;
     this.EventName = eventname;
     this.Data = data;
 }
 private StatusReport(string text, MessageLevel level, OperationType type, ReportType reportType)
 {
     Message = text;
     MessageLevel = level;
     OperationType = type;
     MessageTime = DateTime.Now;
     ReportType = reportType;
 }
Exemplo n.º 18
0
        public Report(ReportType reportType, IEnumerable<ReportParameter> reportParametres)
        {
            InitializeComponent();
            this.reportType = reportType;
            // this.parametres = parametres;
            this.reportParametres = reportParametres;

            Loaded += new RoutedEventHandler(Report_Loaded);
        }
Exemplo n.º 19
0
        public reportsForm(Context context, ReportType reporttype)
        {
            this.context = context;

            InitializeComponent();

            this.report = new Report(reporttype);
            populateFields();
        }
 /// <summary>
 /// Gets the string based on report type.
 /// </summary>
 /// <param name="type">The report type.</param>
 /// <returns>The string.</returns>
 /// <exception cref="System.ArgumentOutOfRangeException"></exception>
 public static string GetString(ReportType type)
 {
     string stringValue;
     if (EnumStringMapping.TryGetValue(type, out stringValue))
     {
         return stringValue;
     }
     throw new ArgumentOutOfRangeException(nameof(type));
 }
Exemplo n.º 21
0
        internal void SwitchReport(ReportType reportType)
        {
            //this.reportCtrl.LocalReport.ReportPath = reportPath;
            //this.reportCtrl.RefreshReport();
            String reportPath = embededReports[reportType][0];
            String tableName = embededReports[reportType][1];

            ShowReport(tableName, reportPath);
        }
        public bool TryGetReport(ReportType type, byte id, out Report report)
        {
            for (int i = 0; i < Reports.Count; i++)
            {
                report = Reports[i];
                if (report.Type == type && report.ID == id) { return true; }
            }

            report = null; return false;
        }
Exemplo n.º 23
0
 public PrinterJob(ReportType reportType, string filePath, int pageCount, int сopies)
 {
     CodeContract.Requires(!string.IsNullOrEmpty(filePath));
     CodeContract.Requires(pageCount >= 0);
     CodeContract.Requires(сopies >= 0);
     ReportType = reportType;
     FilePath = filePath;
     PageCont = pageCount;
     Copies = сopies;
 }
 public static IReportGenerator GetReportGenerator(ReportType reportType)
 {
     switch (reportType)
     {
         case ReportType.HTML:
             return new HTMLReportGenerator();
         case ReportType.Text:
             return new TextReportGenerator();
     }
 }
Exemplo n.º 25
0
 public void GenerateReport(ReportType type, int no)
 {
     string clubName = Database.GetCurrentClubName();
     string itemName = GetItemName(type, no);
     List<ResultItem> reportItems = GetReportItems(type, no);
     string reportBody = CreateReportBody(clubName, itemName, reportItems);
     string fileName = CreateFileName(itemName, clubName);
     CreateReportFile(fileName, reportBody);
     OpenReportFile(fileName);
 }
 public ReportTemplateWrapper(ReportTemplate reportTemplate)
 {
     Id = reportTemplate.Id;
     Title = reportTemplate.Name;
     Created = (ApiDateTime)reportTemplate.CreateOn;
     CreatedBy = EmployeeWraper.Get(reportTemplate.CreateBy);
     AutoGenerated = reportTemplate.AutoGenerated;
     Cron = reportTemplate.Cron;
     ReportType = reportTemplate.ReportType;
 }
Exemplo n.º 27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strCamID = Request["CampaignID"];
            string rptType = Request["RptType"];

            if (!string.IsNullOrEmpty(strCamID)
                && !string.IsNullOrEmpty(rptType))
            {
                RptType = (ReportType)rptType.ToInt();
                Camp = CampaignBLL.Get(strCamID.ToInt());

                try
                {
                    CoopOrgGeo1ID = Camp.CoopOrg.Geo1.ID;
                }
                catch (Exception)
                {
                }

                CampaignDetail1.CampaignID = Camp.ID;

                switch (RptType)
                {
                    case ReportType.FourPosInCam:
                        LabelTitle1.Text = "Danh sách kết quả xét nghiệm";
                        //LabelTitle2.Text = "Dương tính (Không bao gồm HIV)";
                        foreach (DataControlField item in GridView1.Columns)
                        {
                            if (item.HeaderText == "HIV")
                            { item.Visible = false; }
                        }

                        break;
                    case ReportType.NegInCam:
                        LabelTitle1.Text = "Danh sách kết quả xét nghiệm";
                        //LabelTitle2.Text = "Âm tính";

                        break;
                    case ReportType.HIVInCam:
                        LabelTitle1.Text = "Danh sách kết quả xét nghiệm";
                        //LabelTitle2.Text = "Dương tính (Bao gồm HIV)";

                        break;
                    default:
                        break;
                }
                GridView1.DataBind();

                divNote.Visible = (RptType == ReportType.HIVInCam) && IsSpecialProvince();
            }
        }
    }
        /// <summary>
        /// 請傳入「填報年度」.
        /// </summary>
        public static MemoryStream Execute(int Year, ReportType ReportType)
        {
            Template Template_102 = new Template_102();
            Template Template_103 = new Template_103();

            //  設定責任鏈之關連
            Template_102.SetSuccessor(Template_103);

            //  開始責任鏈之走訪並回傳結果
            return Template_102.ProcessRequest(Year, ReportType);
        }
Exemplo n.º 29
0
        protected ReportTemplate(string shortName, DateTime date, ReportType type)
        {
            this.ReportDate = date;
            this.ShotName = shortName;
            this.ReportType = type;

            this.StartDate = DbWhere.GetStartDate(type, date);
            this.EndDate = DbWhere.GetEndDate(type, date);

            Logger.Debug(string.Format("============================ Start Generate {0}, ReportDate: {1}============================", shortName, ReportDate.ToString("yyyy-MM-dd HH:mm:ss")));
        }
Exemplo n.º 30
0
 public static IReport CreateModel(ReportType r)
 {
     return new 
     {
         ReportID = (uint)r,
         ReportName = System.Enum.GetName(typeof(ReportType), r),
         Report = GetReport(r),
         ParametersView = GetParametersViewName(r),
         SerializedChild = String.Empty,
         FilterString = String.Empty
     }.ActLike<IReport>();
 }
        public List <ReportType> GetReportTypes()
        {
            //errorCode = null;
            List <ReportType> reportTypeCollection = null;
            ReportType        rptType = null;

            try
            {
                using (SqlConnection connection = new SqlConnection(DBConstants.EXPENSECALCULATOR_CONNECTIONSTRING))
                {
                    connection.Open();
                    SqlCommand command = new SqlCommand(DBConstants.GET_REPORT_TYPES, connection);

                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        reportTypeCollection = new List <ReportType>();

                        while (dataReader.Read())
                        {
                            rptType = new ReportType();

                            if (!Convert.IsDBNull(dataReader[DBConstants.REPORT_TYPE_ID_COLUMN]))
                            {
                                rptType.reportTypeId = dataReader[DBConstants.REPORT_TYPE_ID_COLUMN].ToString();
                            }

                            if (!Convert.IsDBNull(dataReader[DBConstants.REPORT_TYPE_NAME_COLUMN]))
                            {
                                rptType.reportTypeName = dataReader[DBConstants.REPORT_TYPE_NAME_COLUMN].ToString();
                            }

                            reportTypeCollection.Add(rptType);
                            rptType = null;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Utilities.HandleError(exception);
                // errorCode = MessageConstants.GET_REPORT_TYPES_ERROR;
            }
            return(reportTypeCollection);
        }
Exemplo n.º 32
0
        // 获取能查的数据的最小时间(给定范围内最接近的时间)
        public DateTime GetMinTime(int softid, int platformid, ReportType Type, DateTime begintime, DateTime endtime)
        {
            ///默认是当前
            DateTime minTime = new DateTime(2009, 9, 1, 0, 0, 0);

            ;
            string sqlstr = string.Empty;
            string field  = string.Empty;

            if (Type == ReportType.UserLifecycle)
            {
                if (platformid != (int)MobileOption.None)
                {
                    sqlstr = @"select min(statdate) from Sjqd_StatLifecycle with(nolock)
                           where softid=@softid  and platform=@platform  and  StatDate between @begindate and @enddate ";
                }
                else
                {
                    sqlstr = @"select min(statdate) from Sjqd_StatLifecycle with(nolock)
                           where softid=@softid  and  StatDate between @begindate and @enddate ";
                }
            }
            SqlParameter[] parameters = new SqlParameter[]
            {
                SqlParamHelper.MakeInParam("@softid", SqlDbType.Int, 4, softid),
                SqlParamHelper.MakeInParam("@platform", SqlDbType.TinyInt, 1, platformid),
                SqlParamHelper.MakeInParam("@begindate", SqlDbType.Int, 4, int.Parse(begintime.ToString("yyyyMMdd")))
                ,
                SqlParamHelper.MakeInParam("@enddate", SqlDbType.Int, 4, int.Parse(endtime.ToString("yyyyMMdd")))
            };

            using (IDataReader dataReader = SqlHelper.ExecuteReader(connString, CommandType.Text, sqlstr, parameters))
            {
                while (dataReader.Read())
                {
                    if (dataReader[0] != null && dataReader[0] != DBNull.Value)
                    {
                        int time = Convert.ToInt32(dataReader[0]);
                        minTime = new DateTime(time / 10000, time / 100 % 100, time % 100, 0, 0, 0);
                    }
                }
            }
            return(minTime);
        }
Exemplo n.º 33
0
        public IErrorsInfo RunReport(ReportType reportType, string outputFile)
        {
            try

            {
                reportOutput            = new ReportOutput();
                reportOutput.Definition = Definition;
                reportOutput.DMEEditor  = DMEEditor;

                if (reportOutput.GetBlockDataIntoTables())
                {
                    CopyReportDefinition2Doodle();
                    switch (reportType)
                    {
                    case ReportType.html:
                        break;

                    case ReportType.xls:
                        break;

                    case ReportType.csv:
                        break;

                    case ReportType.pdf:
                        break;

                    default:
                        break;
                    }
                    FileStream fileStream = new FileStream(outputFile + "." + reportType.ToString(), FileMode.Create);
                    outputstream = fileStream;
                    var writer = new HtmlReportWriter();
                    writer.WriteReport(report, outputstream);
                    OutputFile = outputFile + "." + reportType.ToString();
                    DMEEditor.AddLogMessage("Success", $"Creating Doddle Report", DateTime.Now, 0, null, Errors.Ok);
                }
            }
            catch (Exception ex)
            {
                string errmsg = "Error Saving Function Mapping ";
                DMEEditor.AddLogMessage("Fail", $"{errmsg}:{ex.Message}", DateTime.Now, 0, null, Errors.Failed);
            }
            return(DMEEditor.ErrorObject);
        }
Exemplo n.º 34
0
        public async Task <bool> CreateCustomReport(ReportServiceModel reportServiceModel)
        {
            ReportType reportType = await _context.ReportTypes.SingleOrDefaultAsync(x => x.Name == "Custom");

            reportServiceModel.Name =
                $"Custom_{reportServiceModel.StartYear}_{reportServiceModel.StartMonth}_{reportServiceModel.EndYear}_{reportServiceModel.EndMonth}";

            if (await _context.Reports.AnyAsync(x => x.Name == reportServiceModel.Name && x.IsDeleted == false))
            {
                return(false);
            }

            var report = reportServiceModel.To <Report>();

            if (report.StartYear > report.EndYear)
            {
                return(false);
            }
            else if (report.StartMonth > report.EndMonth)
            {
                return(false);
            }

            report.ReportType = reportType;

            report.VehiclesInReport = GetVehiclesInReport(reportServiceModel.StartMonth, reportServiceModel.StartYear,
                                                          reportServiceModel.EndMonth, reportServiceModel.EndYear);

            report.MonthlySalariesInReport = GetSalariesInReport(reportServiceModel.StartMonth,
                                                                 reportServiceModel.StartYear,
                                                                 reportServiceModel.EndMonth, reportServiceModel.EndYear);

            report.MechanicsBaseCosts  = report.MonthlySalariesInReport.Sum(x => x.BaseSalary);
            report.VehicleBaseCost     = report.VehiclesInReport.Sum(x => x.Depreciation);
            report.ExternalRepairCosts = report.VehiclesInReport.Sum(x => x.ExternalRepairs.Sum(y => y.LaborCost + y.PartsCost));
            report.InternalRepairCosts = report.VehiclesInReport.Sum(x => x.InternalRepairs.Sum(y => (decimal)y.HoursWorked * y.MdmsUser.AdditionalOnHourPayment) +
                                                                     x.InternalRepairs.Sum(y => y.InternalRepairParts.Sum(z => z.Quantity * z.Part.Price)));

            await _context.AddAsync(report);

            var result = await _context.SaveChangesAsync();

            return(result > 0);
        }
Exemplo n.º 35
0
        /// <summary>
        /// Display the report details
        /// GET: ~/Accountant/Accountant/PrintReport?Name=reportName
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public ActionResult PrintReport(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(View("Error"));
            }
            ReportType reportType = (ReportType)Enum.Parse(typeof(ReportType), name);
            var        report     = new List <IMSLogicLayer.Models.ReportRow>();

            if (reportType == ReportType.AverageCostByEngineer)
            {
                report = Accountant.printAverageCostByEngineer().ToList();
                foreach (var reportrow in report)
                {
                    reportrow.Hours = decimal.Round(reportrow.Hours.Value, 2, MidpointRounding.AwayFromZero);
                    reportrow.Costs = decimal.Round(reportrow.Costs.Value, 2, MidpointRounding.AwayFromZero);
                }
            }
            //if report is monthly cost by district redirect to monthly report page
            else if (reportType == ReportType.MonthlyCostByDistrict)
            {
                return(PrintMonthlyReport());
            }
            else if (reportType == ReportType.TotalCostByDistrict)
            {
                report = Accountant.printTotalCostByDistrict().ToList();
                var m = new DistrictReportViewModel()
                {
                    Report = report,
                    Total  = report.Sum(r => r.Costs).ToString()
                };
                return(View("TotalDistrictReport", m));
            }
            else if (reportType == ReportType.TotalCostByEngineer)
            {
                report = Accountant.printTotalCostByEngineer().ToList();
            }
            var model = new ReportViewModel()
            {
                Report = report
            };

            return(View("Report", model));
        }
Exemplo n.º 36
0
        public ActionResult InsertReport(string title, string content, ReportType type, int id, ReportRelateType relateType)
        {
            var user = _workContext.CurrentUser;

            if (user == null)
            {
                return(Json(new PortalResult("请先登录!")));
            }

            if (string.IsNullOrEmpty(content))
            {
                return(Json(new PortalResult("举报内容不能为空!")));
            }


            var report = new Report()
            {
                Title      = title,
                ReportType = type,
                RelateId   = id,
                UserId     = user.Id,
                UserName   = user.Username,
                RelateType = relateType,
                Content    = content,
            };

            if (report.RelateType == ReportRelateType.Question)
            {
                var target = _questionDbService.GetById(report.RelateId);
                report.RelateUserId   = target.UserId;
                report.RelateUserName = target.User.Username;
            }
            if (report.RelateType == ReportRelateType.Comment)
            {
                var target = _questionDbService.GetComentById(report.RelateId);
                report.RelateUserId   = target.CommentUserId;
                report.RelateUserName = target.User.Username;
            }


            var res = _questionDbService.InsertReport(report);

            return(Json(res));
        }
Exemplo n.º 37
0
        public static void Build()
        {
            ReportBuilder rptbuild = new ReportBuilder();
            ReportType    vReport  = rptbuild.Report;
            BodyType      vBody    = vReport.Body;

            // double x = 0, y = 0, wd = 0 , ht = 0;

            vReport.Width.Value = RPT_WIDTH;
            vBody.Height.Value  = RPT_HEIGHT;

            DataSetType dataSet = rptbuild.Report.DataSets[0];

            dataSet.Name = "MyDataSource_Items";

            ReportUtil.AddFields(dataSet.Fields, new string[] {
                PInvoiceitems.INVOICE_ITEM_ID
                , PInvoiceitems.INVOICE_ID
                , PInvoiceitems.SL_NO
                , PInvoiceitems.PO_NO
                , PInvoiceitems.DC_NO
                , PInvoiceitems.PRODUCT_ID
                , PInvoiceitems.HSN_CODE_ID
                , PInvoiceitems.SIZES
                , PInvoiceitems.COLOURS
                , PInvoiceitems.QTY
                , PInvoiceitems.PRICE
                , PInvoiceitems.SUB_TOTAL
                , PInvoiceitems.TAXABLEVALUE
                , PInvoiceitems.CGST_PERCENT
                , PInvoiceitems.CGST_AMOUNT
                , PInvoiceitems.SGST_PERCENT
                , PInvoiceitems.SGST_AMOUNT
                , PInvoiceitems.IGST_PERCENT
                , PInvoiceitems.IGST_AMOUNT
            });



            BuildDetail(vBody);

            ///== END OF REPORT  ===========================================================================///
            rptbuild.SaveAs(PRINT_FOLDER + @"\P_InvoiceItem.rdlc");
        }
Exemplo n.º 38
0
        private static void ReportMissingFindSizes(RvDir dir, RvDat dat, ReportType rt)
        {
            for (int i = 0; i < dir.ChildCount; i++)
            {
                RvBase b = dir.Child(i);
                if (b.Dat != null && b.Dat != dat)
                {
                    continue;
                }

                RvFile f = b as RvFile;

                if (f != null)
                {
                    if (
                        (rt == ReportType.PartialMissing && Partial.Contains(f.RepStatus)) ||
                        (rt == ReportType.Fixing && Fixing.Contains(f.RepStatus))
                        )
                    {
                        int fileNameLength  = f.FileNameInsideGame().Length;
                        int fileSizeLength  = f.Size.ToString().Length;
                        int repStatusLength = f.RepStatus.ToString().Length;

                        if (fileNameLength > _fileNameLength)
                        {
                            _fileNameLength = fileNameLength;
                        }
                        if (fileSizeLength > _fileSizeLength)
                        {
                            _fileSizeLength = fileSizeLength;
                        }
                        if (repStatusLength > _repStatusLength)
                        {
                            _repStatusLength = repStatusLength;
                        }
                    }
                }
                RvDir d = b as RvDir;
                if (d != null)
                {
                    ReportMissingFindSizes(d, dat, rt);
                }
            }
        }
Exemplo n.º 39
0
        private object GetReportData(ReportType reportType, ReportTimePeriod timePeriod, Guid[] managers)
        {
            var crmSettings = _settingsManager.Load <CrmSettings>();

            var reportDao       = _daoFactory.GetReportDao();
            var defaultCurrency = _currencyProvider.Get(crmSettings.DefaultCurrency).Abbreviation;

            switch (reportType)
            {
            case ReportType.SalesByManagers:
                return(reportDao.GetSalesByManagersReportData(timePeriod, managers, defaultCurrency));

            case ReportType.SalesForecast:
                return(reportDao.GetSalesForecastReportData(timePeriod, managers, defaultCurrency));

            case ReportType.SalesFunnel:
                return(reportDao.GetSalesFunnelReportData(timePeriod, managers, defaultCurrency));

            case ReportType.WorkloadByContacts:
                return(reportDao.GetWorkloadByContactsReportData(timePeriod, managers));

            case ReportType.WorkloadByTasks:
                return(reportDao.GetWorkloadByTasksReportData(timePeriod, managers));

            case ReportType.WorkloadByDeals:
                return(reportDao.GetWorkloadByDealsReportData(timePeriod, managers, defaultCurrency));

            case ReportType.WorkloadByInvoices:
                return(reportDao.GetWorkloadByInvoicesReportData(timePeriod, managers));

            case ReportType.WorkloadByVoip:
                return(reportDao.GetWorkloadByViopReportData(timePeriod, managers));

            case ReportType.SummaryForThePeriod:
                return(reportDao.GetSummaryForThePeriodReportData(timePeriod, managers, defaultCurrency));

            case ReportType.SummaryAtThisMoment:
                return(reportDao.GetSummaryAtThisMomentReportData(timePeriod, managers, defaultCurrency));

            default:
                return(null);
            }
        }
Exemplo n.º 40
0
        public ReportAttributeStatus(ReportType reportType, string targetFile, string attributeName, string value, string message, int numPageFeeds)
        {
            ReportType    = reportType;
            Path          = targetFile;
            AttributeName = attributeName;
            Value         = value;

            if (message.ToLower() == "found")
            {
                MessageConsole = attributeName + ": " + ReportOutput.CreatePadding(attributeName) + value;
                MessageLog     = attributeName + ": " + value;
            }
            else
            {
                MessageConsole = attributeName + " " + message + " in file: " + targetFile;
                MessageLog     = attributeName + " " + message + " in file: " + targetFile;
            }
            NumPageFeeds = numPageFeeds;
        }
Exemplo n.º 41
0
        /// <summary>
        /// This method will return a specific report based on the type requested.
        ///
        /// After one has imported data into a project and subsequently called
        /// /reports/generate to create the reports, one can call this method to retrieve them.
        ///
        /// Reports can be retrieved in 2 formats, either as 'json', which will return the data
        /// of the report, or as 'widget', which will return embeddable html.
        ///
        /// in the case of the 'json' format, the data from the report will be placed in
        /// the 'data' property of the JSON response object
        ///
        /// for widgets, the embeddable source html will be contained in a property
        /// called 'widget'
        ///
        /// the options field permit to specify options for widgets only, that apply to the widget you're trying to get.
        /// Unknown options or invalid options will be ignored
        /// More documentation to follow
        /// </summary>
        /// <param name="projectId">the id of the project</param>
        /// <param name="type">the type of analytic to fetch. use /reports/getTypes to get a list of available reports</param>
        /// <param name="format">format in which to receive the report, Either 'json' or 'widget'</param>
        /// <param name="accessibility">could be public for public widget, or private for internal application usage</param>
        /// <param name="options">JSON containing extra options to configure widgets</param>
        public void ReportsGet(int projectId, ReportType type, ReportFormat format, string accessibility = "private", string options = null)
        {
            Require.Argument("projectId", projectId);
            Require.Argument("type", type);
            Require.Argument("format", format);

            var request = new RestRequest {
                Resource = "reports/get"
            };

            request.AddParameter("projectId", projectId);
            request.AddParameter("type", type);
            request.AddParameter("format", format);

            request.AddParameter("accessibility", accessibility);
            request.AddParameter("options", options);

            // return ExecutePost<ReportsGenerateResults>(request);
        }
Exemplo n.º 42
0
        public void ReportType_Controller_GetReportTypeWithID_Test()
        {
            foreach (LanguageEnum LanguageRequest in AllowableLanguages)
            {
                foreach (int ContactID in new List <int>()
                {
                    AdminContactID
                })                                                             //, TestEmailValidatedContactID, TestEmailNotValidatedContactID })
                {
                    ReportTypeController reportTypeController = new ReportTypeController(DatabaseTypeEnum.SqlServerTestDB);
                    Assert.IsNotNull(reportTypeController);
                    Assert.AreEqual(DatabaseTypeEnum.SqlServerTestDB, reportTypeController.DatabaseType);

                    ReportType reportTypeFirst = new ReportType();
                    using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
                    {
                        ReportTypeService reportTypeService = new ReportTypeService(new Query(), db, ContactID);
                        reportTypeFirst = (from c in db.ReportTypes select c).FirstOrDefault();
                    }

                    // ok with ReportType info
                    IHttpActionResult jsonRet = reportTypeController.GetReportTypeWithID(reportTypeFirst.ReportTypeID);
                    Assert.IsNotNull(jsonRet);

                    OkNegotiatedContentResult <ReportType> Ret = jsonRet as OkNegotiatedContentResult <ReportType>;
                    ReportType reportTypeRet = Ret.Content;
                    Assert.AreEqual(reportTypeFirst.ReportTypeID, reportTypeRet.ReportTypeID);

                    BadRequestErrorMessageResult badRequest = jsonRet as BadRequestErrorMessageResult;
                    Assert.IsNull(badRequest);

                    // Not Found
                    IHttpActionResult jsonRet2 = reportTypeController.GetReportTypeWithID(0);
                    Assert.IsNotNull(jsonRet2);

                    OkNegotiatedContentResult <ReportType> reportTypeRet2 = jsonRet2 as OkNegotiatedContentResult <ReportType>;
                    Assert.IsNull(reportTypeRet2);

                    NotFoundResult notFoundRequest = jsonRet2 as NotFoundResult;
                    Assert.IsNotNull(notFoundRequest);
                }
            }
        }
Exemplo n.º 43
0
        public static string Create(ReportType reportType)
        {
            var json = $@"
{{
    ""id"": ""0428b97b-bec1-429e-a94c-59232926778d"",
    ""type"": ""{reportType.ToString().ToLower()}"",
    ""status"": ""pending"",
    ""created_at"": ""2016-12-08T24:00:00Z"",
    ""completed_at"": undefined,
    ""expires_at"": ""2016-12-08T24:00:00Z"",
    ""file_url"": undefined,
    ""params"": {{
        ""start_date"": ""2016-12-08T24:00:00Z"",
        ""end_date"": ""2016-12-08T24:00:00Z""
    }}
}}";

            return(json);
        }
Exemplo n.º 44
0
        public void ReportPawnInteraction(ReportType type, Pawn pawn, bool success, int usedControlIndex)
        {
            if (report == null)
            {
                report = new ScheduledReport {
                    reportType = type
                };
            }
            switch (type)
            {
            case ReportType.SavedPosition:
                report.numPawnsSavedPosition++;
                break;

            case ReportType.SentToSavedPosition:
                if (success)
                {
                    report.numPawnsHadTargetPosition++;
                }
                else
                {
                    report.numPawnsHadNoTargetPosition++;
                    var pawnName = pawn.Name.ToStringShort;
                    if (report.noTargetPositionNames == null)
                    {
                        report.noTargetPositionNames += pawnName;
                    }
                    else
                    {
                        report.noTargetPositionNames += ", " + pawnName;
                    }
                }
                break;

            case ReportType.ClearedPosition:
                if (success)
                {
                    report.numPawnsHadTargetPosition++;
                }
                break;
            }
            report.controlIndex = usedControlIndex;
        }
Exemplo n.º 45
0
        public static void AddCPAMortalityAudit(AspergillosisContext context)
        {
            var report = context.ReportTypes.Where(rt => rt.Code == "cpa-mortality-report").FirstOrDefault();

            if (report == null)
            {
                var newReport = new ReportType {
                    Name          = "CPA Mortality Audit",
                    Discriminator = "CPAMortalityAudit",
                    Code          = "cpa-mortality-report"
                };
                context.ReportTypes.Add(newReport);
                context.SaveChanges();
            }
            else
            {
                return;
            }
        }
        private ReportType GetFilledRandomReportType(string OmitPropName)
        {
            ReportType reportType = new ReportType();

            if (OmitPropName != "TVType")
            {
                reportType.TVType = (TVTypeEnum)GetRandomEnumType(typeof(TVTypeEnum));
            }
            if (OmitPropName != "FileType")
            {
                reportType.FileType = (FileTypeEnum)GetRandomEnumType(typeof(FileTypeEnum));
            }
            if (OmitPropName != "UniqueCode")
            {
                reportType.UniqueCode = GetRandomString("", 5);
            }
            if (OmitPropName != "Language")
            {
                reportType.Language = LanguageRequest;
            }
            if (OmitPropName != "Name")
            {
                reportType.Name = GetRandomString("", 5);
            }
            if (OmitPropName != "Description")
            {
                reportType.Description = GetRandomString("", 5);
            }
            if (OmitPropName != "StartOfFileName")
            {
                reportType.StartOfFileName = GetRandomString("", 5);
            }
            if (OmitPropName != "LastUpdateDate_UTC")
            {
                reportType.LastUpdateDate_UTC = new DateTime(2005, 3, 6);
            }
            if (OmitPropName != "LastUpdateContactTVItemID")
            {
                reportType.LastUpdateContactTVItemID = 2;
            }

            return(reportType);
        }
Exemplo n.º 47
0
        private bool SendErrorReport(
            Exception[] exceptions,
            ReportType errorReportType,
            string description,
            string email,
            UserBase user,
            int logRowsCount
            )
        {
            if (errorReportType == ReportType.Automatic && !AutomaticallySendEnabled)
            {
                return(false);
            }

            var errorRequest = new SubmitErrorRequest
            {
                ReportType = errorReportType,
                App        = new AppInfo
                {
                    Modification = Edition,
                    ProductName  = ProductName,
                    Version      = Version,
                    ProductCode  = 1
                },
                Db = new DatabaseInfo
                {
                    Name = DatabaseName
                },
                User = new UserInfo
                {
                    Name  = user == null ? "" : user.Name,
                    Email = email ?? string.Empty
                },
                Report = new ErrorInfo
                {
                    UserDescription = description ?? string.Empty,
                    Log             = _logService.GetLog(logRowsCount),
                    StackTrace      = GetExceptionText(exceptions)
                }
            };

            return(_reportSender.SubmitErrorReport(errorRequest));
        }
Exemplo n.º 48
0
        private DiagnosticSeverity SeverityFromReportType(ReportType type)
        {
            switch (type)
            {
            case ReportType.Error:
            default:
                return(DiagnosticSeverity.Error);

            case ReportType.Warning:
                return(DiagnosticSeverity.Warning);

            case ReportType.Notice:
            case ReportType.Experimental:
                return(DiagnosticSeverity.Information);

            case ReportType.Deprecated:
                return(DiagnosticSeverity.Hint);
            }
        }
Exemplo n.º 49
0
        /// <summary>
        /// Get the DVD Title 0 attributes.
        /// This is essentially the same as a CD TOC capture.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuDVDTOC_Click(object sender, System.EventArgs e)
        {
            UseWaitCursor = true;
            listView1.Items.Clear();

            lblStatus.Text = "DVD TOC Attributes";

            if (Player.dvd.get_isAvailable("dvdDecoder") == true)
            {
                getMetadataFromPlaylist(AttributeSource.DVDToc);
            }
            else
            {
                lblStatus.Text = "No DVD decoder installed.";
            };

            rtLast        = ReportType.DVDTOC;
            UseWaitCursor = false;
        }
Exemplo n.º 50
0
        public static void report(
            ReportType type,
            string reportContext,
            string fileName,
            DDS.ReturnCode reportCode,
            string description)
        {
            StackFrame callStack = new StackFrame(1, true);

            report(type,
                   reportContext,
                   fileName,
                   callStack.GetFileLineNumber(),
                   reportCode,
                   -1,
                   true,
                   description,
                   IntPtr.Zero);
        }
Exemplo n.º 51
0
        protected static void SaveReport(string filename, ReportType reportType, ReportViewer reportViewer)
        {
            var format = string.Empty;

            switch (reportType)
            {
            case ReportType.Word:
                format = "Word";
                break;

            case ReportType.Pdf:
                format = "PDF";
                break;
            }

            var bytes = RenderReport(filename, format, reportViewer);

            WriteReport(filename, bytes);
        }
Exemplo n.º 52
0
        public static bool CheckReportData(ReportType reportType, ReportTimePeriod timePeriod, Guid[] managers)
        {
            using (var scope = DIHelper.Resolve())
            {
                var reportDao = scope.Resolve <DaoFactory>().ReportDao;

                switch (reportType)
                {
                case ReportType.SalesByManagers:
                    return(reportDao.CheckSalesByManagersReportData(timePeriod, managers));

                case ReportType.SalesForecast:
                    return(reportDao.CheckSalesForecastReportData(timePeriod, managers));

                case ReportType.SalesFunnel:
                    return(reportDao.CheckSalesFunnelReportData(timePeriod, managers));

                case ReportType.WorkloadByContacts:
                    return(reportDao.CheckWorkloadByContactsReportData(timePeriod, managers));

                case ReportType.WorkloadByTasks:
                    return(reportDao.CheckWorkloadByTasksReportData(timePeriod, managers));

                case ReportType.WorkloadByDeals:
                    return(reportDao.CheckWorkloadByDealsReportData(timePeriod, managers));

                case ReportType.WorkloadByInvoices:
                    return(reportDao.CheckWorkloadByInvoicesReportData(timePeriod, managers));

                case ReportType.WorkloadByVoip:
                    return(reportDao.CheckWorkloadByViopReportData(timePeriod, managers));

                case ReportType.SummaryForThePeriod:
                    return(reportDao.CheckSummaryForThePeriodReportData(timePeriod, managers));

                case ReportType.SummaryAtThisMoment:
                    return(reportDao.CheckSummaryAtThisMomentReportData(timePeriod, managers));

                default:
                    return(false);
                }
            }
        }
Exemplo n.º 53
0
        public static string Transform(IList <object[]> report, ReportType type, int subType, ReportViewType view)
        {
            var xml = new StringBuilder()
                      .Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
                      .Append("<reportResult>");

            foreach (var row in report)
            {
                xml.Append("<r ");
                for (int i = 0; i < row.Length; i++)
                {
                    xml.AppendFormat("c{0}=\"{1}\" ", i, ToString(row[i]));
                }
                xml.Append("/>");
            }
            xml.Append("</reportResult>");

            return(Transform(xml.ToString(), type, subType, view));
        }
Exemplo n.º 54
0
        protected void InvokeReport()
        {
            Dictionary <string, dynamic> rparams = new Dictionary <string, dynamic>();
            ReportType rpt = (ReportType)Enum.Parse(typeof(ReportType), GetQueryValue <string>(QueryStringConstants.ReportType));

            switch (rpt)
            {
            case ReportType.RISCaseReport:
                rparams.Add(ReportConstants.RecordID, PageID);
                break;

            case ReportType.RISRecord:
                rparams.Add(ReportConstants.FromDate, GetQueryValue <DateTime>(QueryStringConstants.FromDate));
                rparams.Add(ReportConstants.ToDate, GetQueryValue <DateTime>(QueryStringConstants.ToDate));
                rparams.Add(ReportConstants.RecordStausID, GetQueryValue <int>(QueryStringConstants.RecordStausID));
                break;
            }
            GMWebUtilities.Report.Invoke.Render(this, rpt, GMWebUtilities.Report.Types.PDF, rparams);
        }
Exemplo n.º 55
0
        public static string ReportTypeToPolish(ReportType reportType)
        {
            switch (reportType)
            {
            case ReportType.Daily:
                return("Dzienny");

            case ReportType.Weekly:
                return("Tygodniowy");

            case ReportType.Monthly:
                return("Miesięczny");

            default:
                break;
            }

            throw new Exception("Report translate not implemented.");
        }
Exemplo n.º 56
0
        /// <summary>
        /// Some KPIs has history.
        /// See list of KPI and how to call on github
        /// https://github.com/Borsdata-Sweden/API/wiki/KPI-History
        /// </summary>
        /// <param name="instrumentId">Company Ericsson has instrumentId=77</param>
        /// <param name="KpiId">KPI id. P/E =2</param>
        /// <param name="rt"> What report is KPI calculated with? [year, r12, quarter]</param>
        /// <param name="pt">What stockprice is KPI calculated with? [mean, high, low]</param>
        /// <returns>List of historical KPI values</returns>
        public KpisHistoryRespV1 GetKpiHistory(long instrumentId, int KpiId, ReportType rt, PriceType pt)
        {
            string url    = string.Format(_urlRoot + "/v1/Instruments/{0}/kpis/{1}/{2}/{3}/history", instrumentId, KpiId, rt.ToString(), pt.ToString());
            string urlPar = string.Format(_authKey);
            HttpResponseMessage response = WebbCall(url, urlPar);

            if (response.IsSuccessStatusCode)
            {
                string            json = response.Content.ReadAsStringAsync().Result;
                KpisHistoryRespV1 res  = JsonConvert.DeserializeObject <KpisHistoryRespV1>(json);
                return(res);
            }
            else
            {
                Console.WriteLine("GetStockPrices time  {0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
            }

            return(null);
        }
Exemplo n.º 57
0
        public static DataView GetStatistics(ReportType reporttype, ref DateTime lastchange)
        {
            string reportid = GetReportID(reporttype);

            Debug.Enter();


            //
            // Get Report Header
            //

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "net_report_get";

            sp.Parameters.Add("@reportID", SqlDbType.NVarChar, 128);
            sp.Parameters.Add("@lastChange", SqlDbType.DateTime, ParameterDirection.Output);

            sp.Parameters.SetString("@reportID", reportid);
            sp.ExecuteNonQuery();

            lastchange = (DateTime)sp.Parameters.GetDateTime("@lastChange");

            //
            // Get Report Detail
            //

            DataSet statistics = new DataSet();

            SqlStoredProcedureAccessor sp2 = new SqlStoredProcedureAccessor();

            sp2.ProcedureName = "net_reportLines_get";

            sp2.Parameters.Add("@reportID", SqlDbType.NVarChar, 128);
            sp2.Parameters.SetString("@reportID", reportid);

            sp2.Fill(statistics, "Statistics");

            Debug.Leave();

            return(statistics.Tables["Statistics"].DefaultView);
        }
Exemplo n.º 58
0
        void ListBoxReportTypeSelectedIndexChanged(object sender, EventArgs e)
        {
            int        i            = listBoxReportType.SelectedIndex;
            ReportType r            = (ReportType)(i + 1);
            bool       isTeamOrSolo = r == ReportType.TeamLadder || r == ReportType.SoloLadder;

            scaleGames.Enabled            = r == ReportType.TeamLadder;
            dropGames.Enabled             = isTeamOrSolo || r == ReportType.GameGrid;
            dateFrom.Enabled              = true;
            dateTo.Enabled                = true;
            showColours.Enabled           = r == ReportType.TeamLadder;
            showPoints.Enabled            = r == ReportType.TeamsVsTeams;
            showComments.Enabled          = r == ReportType.SoloLadder;
            chartType.Enabled             = true;
            showTopN.Enabled              = isTeamOrSolo || r == ReportType.MultiLadder;
            numericUpDownTopN.Enabled     = showTopN.Enabled;
            labelTopWhat.Enabled          = showTopN.Enabled;
            atLeastN.Enabled              = isTeamOrSolo;
            numericUpDownAtLeastN.Enabled = isTeamOrSolo;
            labelAtLeastGames.Enabled     = isTeamOrSolo;
            orderBy.Enabled               = isTeamOrSolo;
            labelOrderBy.Enabled          = isTeamOrSolo;
            withDescription.Enabled       = r != ReportType.MultiLadder;
            description.Enabled           = true;
            longitudinal.Enabled          = isTeamOrSolo || r == ReportType.Packs;
            if (r == ReportType.Packs && ReportTemplate?.ReportType == ReportType.Packs)
            {
                longitudinal.Checked = true;
            }

            labelTopWhat.Text = r == ReportType.SoloLadder ? "players" : "teams";
            atLeastN.Text     = r == ReportType.SoloLadder ? "show only players with at least" : "show only teams with at least";

            if (!chartTypeChanged)
            {
                chartType.SelectedIndex =
                    isTeamOrSolo || r == ReportType.TeamsVsTeams ? 3 : // bar with rug
                    r == ReportType.Packs ? 8 :                        // kernel density estimate with rug
                    r == ReportType.Tech ? 6 :                         // histogram
                    1;                                                 // everything else: bar
            }
        }
Exemplo n.º 59
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.Rows.Count <= 0)
            {
                MessageBoxEx.Show("当前没有可打印内容!");
                return;
            }
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            string szReportName = string.Empty;

            if (this.toolcboOrdersType.Text == "全部")
            {
                szReportName = "医嘱内容";
            }
            else if (this.toolcboOrdersType.Text == "长期医嘱")
            {
                szReportName = "长期医嘱单";
            }
            else if (this.toolcboOrdersType.Text == "临时医嘱")
            {
                szReportName = "临时医嘱单";
            }
            ReportType reportType = ReportCache.Instance.GetWardReportType(SystemData.ReportTypeApplyEnv.ORDERS, szReportName);

            if (reportType == null)
            {
                MessageBoxEx.ShowMessage("打印报表还没有制作");
                return;
            }
            byte[] byteReportData = null;
            ReportCache.Instance.GetReportTemplet(reportType, ref byteReportData);
            if (byteReportData != null)
            {
                System.Data.DataTable table        = GlobalMethods.Table.GetDataTable(this.dataGridView1, false, 0);
                ReportExplorerForm    explorerForm = this.GetReportExplorerForm();
                explorerForm.ReportFileData = byteReportData;
                explorerForm.ReportParamData.Add("是否续打", false);
                explorerForm.ReportParamData.Add("打印数据", table);
                explorerForm.ShowDialog();
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Exemplo n.º 60
0
        public static string TopNetworksReport(ReportType type)
        {
            StringBuilder report = new StringBuilder();

            using (var context = DbContextFactory.GetDbContext())
            {
                var networkInfos = context.Networks.Select(n =>
                                                           new
                {
                    Network       = n,
                    AverageRating = n.Shows.Where(s => s.Rating.HasValue).Average(s => s.Rating),
                    TopShow       = n.Shows.Where(s => s.Rating.HasValue).OrderByDescending(s => s.Rating).FirstOrDefault(),
                    ShowCount     = n.Shows.Count(),
                });

                if (type == ReportType.CSV)
                {
                    report.AppendLine("AVERAGE_RATING;NETWORK;TOP_RATED_SHOW;TOP_RATING;SHOW_COUNT");
                }

                foreach (var info in networkInfos.OrderByDescending(s => s.AverageRating))
                {
                    if (info.TopShow == null || !info.AverageRating.HasValue)
                    {
                        continue;
                    }

                    switch (type)
                    {
                    case ReportType.CSV:
                        report.AppendLine(TopNetworksReportCsv(info.Network, info.AverageRating, info.TopShow, info.ShowCount));
                        break;

                    case ReportType.Text:
                        report.AppendLine(TopNetworksReportText(info.Network, info.AverageRating, info.TopShow, info.ShowCount));
                        break;
                    }
                }

                return(report.ToString());
            }
        }