public ReportModel SaveReport(ReportModel reportModel)
        {
            var report = Mapper.Map<ReportModel, Report>(reportModel);

            report.Id = 0;
            report.ReportDate = DateTime.Now;

            return Mapper.Map<Report, ReportModel>(Repository.SaveReport(report));
        }
예제 #2
0
		public void RunReport(ReportModel reportModel, System.Collections.IList dataSource, ReportParameters parameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataSource == null) {
				throw new ArgumentNullException("dataSource");
			}
			ReportEngine.CheckForParameters(reportModel, parameters);
			IDataManager dataManager = DataManagerFactory.CreateDataManager(reportModel, dataSource);
			RunReport(reportModel, dataManager);
		}
예제 #3
0
		public void RunReport(ReportModel reportModel, ReportParameters parameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			this.SetupViewer(reportModel);
			if (reportModel.DataModel == GlobalEnums.PushPullModel.FormSheet) {
				RunFormSheet(reportModel);
			} else {
				var dataManager = DataManagerFactory.CreateDataManager(reportModel, parameters);
				RunReport(reportModel,dataManager);
			}
		}
        private void WriteExamples(StringBuilder report, ReportModel.Scenario exampleScenario, IEnumerable<ReportModel.Scenario> scenarioGroup)
        {
            report.AppendLine("### Examples: ");
            report.AppendLine();
            var scenarios = scenarioGroup.ToArray();
            var allPassed = scenarios.All(s => s.Result == Result.Passed);
            var exampleColumns = exampleScenario.Example.Headers.Length;
            var numberColumns = allPassed ? exampleColumns : exampleColumns + 2;
            var maxWidth = new int[numberColumns];
            var rows = new List<string[]>();

            Action<IEnumerable<string>, string, string> addRow = (cells, result, error) =>
            {
                var row = new string[numberColumns];
                var index = 0;

                foreach (var cellText in cells)
                    row[index++] = cellText;

                if (!allPassed)
                {
                    row[numberColumns - 2] = result;
                    row[numberColumns - 1] = error;
                }

                for (var i = 0; i < numberColumns; i++)
                {
                    var rowValue = row[i];
                    if (rowValue != null && rowValue.Length > maxWidth[i])
                        maxWidth[i] = rowValue.Length;
                }

                rows.Add(row);
            };

            addRow(exampleScenario.Example.Headers, "Result", "Errors");
            foreach (var scenario in scenarios)
            {
                var failingStep = scenario.Steps.FirstOrDefault(s => s.Result == Result.Failed);
                var error = failingStep == null
                    ? null
                    : string.Format("Step: {0} failed with exception: {1}", HttpUtility.HtmlEncode(failingStep.Title), CreateExceptionMessage(failingStep));

                addRow(scenario.Example.Values.Select(e => e.GetValueAsString()), scenario.Result.ToString(), error);
            }

            foreach (var row in rows)
                WriteExampleRow(report, row, maxWidth);
        }
예제 #5
0
		public void RunReport(ReportModel reportModel, ReportParameters parameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			Pages.Clear();
			if (reportModel.DataModel == GlobalEnums.PushPullModel.FormSheet)
			{
				RunFormSheet(reportModel);
			} else {
				ReportEngine.CheckForParameters(reportModel, parameters);
				var dataManager = DataManagerFactory.CreateDataManager(reportModel, parameters);
				RunReport(reportModel, dataManager);
			}
		}
예제 #6
0
 public async Task SaveReport(ReportModel report)
 {
     report.Approved = true;
     if (report.HasScaled)
     {
         report.HasScaled = false;
         this.PublishToAll(report, "approvedReport");
     }
     else
     {
         await _reportStorage.UpsertAsync(report);
         await Task.Delay(5000);
         this.PublishToAll(report, "approvedReport");
     }
 }
예제 #7
0
        void WriteOutHtmlReport(ReportModel reportModel)
        {
            Model = new HtmlReportModel(_configuration, reportModel);
            LoadCustomScripts();
            string report;

            try
            {
                report = ReportBuilder.CreateReport(Model);
            }
            catch (Exception ex)
            {
                report = ex.Message + ex.StackTrace;
            }

            _writer.OutputReport(report, _configuration.OutputFileName, _configuration.OutputPath);
        }
예제 #8
0
		public void RunReport(ReportModel reportModel, DataTable dataTable, ReportParameters parameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataTable == null) {
				throw new ArgumentNullException("dataTable");
			}
			ReportEngine.CheckForParameters(reportModel, parameters);
			IDataManager dataManager = DataManagerFactory.CreateDataManager(reportModel, dataTable);
			IReportCreator reportCreator = DataPageBuilder.CreateInstance(reportModel, dataManager);
//			reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
//			reportCreator.GroupHeaderRendering += new EventHandler<GroupHeaderEventArgs>(GroupHeaderRendering);
//			reportCreator.GroupFooterRendering += GroupFooterRendering;
//
//			reportCreator.RowRendering += new EventHandler<RowRenderEventArgs>(RowRendering);
			reportCreator.BuildExportList();
		}
        public ReportResponse Report(ReportModel reportModel)
        {
            var comment = _session.Get <Comment>(reportModel.CommentId);

            if (comment == null)
            {
                return(new ReportResponse
                {
                    Type = CommentResponseType.Error,
                    Message = "Could not find comment to report, it may have already been deleted"
                });
            }

            EventContext.Instance.Publish <IOnCommentReported, CommentReportedEventArgs>(
                new CommentReportedEventArgs(comment));

            return(new ReportResponse
            {
                Type = CommentResponseType.Info,
                Message = "The comment has been reported, and will be dealt with by site admin",
                RedirectUrl = "~/" + comment.Webpage.LiveUrlSegment
            });
        }
예제 #10
0
        /// <summary>
        /// 取得報表清單
        /// </summary>
        /// <param name="ProgramList">登入的作業權限</param>
        /// <returns></returns>
        public List <ReportModel> GetReportList(List <ProgramModel> ProgramList)
        {
            //前置碼
            string PreStr = "RG";


            List <ReportModel> ReportList = new List <ReportModel>();

            for (int i = 0; i < ProgramList.Count; i++)
            {
                if (ProgramList[i].ProgID.IndexOf(PreStr) != -1)
                {
                    ReportModel tmpReport = new ReportModel();
                    tmpReport.ReportId  = ProgramList[i].ProgID;
                    tmpReport.URL       = ProgramList[i].Url;
                    tmpReport.ViewLevel = ProgramList[i].ViewLevel;
                    tmpReport.Title     = ProgramList[i].ProgName;
                    ReportList.Add(tmpReport);
                }
            }

            return(ReportList);
        }
예제 #11
0
        public IActionResult ReadOfAgent(string[] Month, ReportModel m)
        {
            if (Month.Length == 0)
            {
                TempData["ErrorLack"] = "Вы не выбрали месяц";
                return(RedirectToAction("Report"));
            }
            var           FileName = m.puth + $"ReportMonth{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf";
            List <string> list     = new List <string> {
                "Номер", "Дата", "Агент", "Сумма"
            };
            DateTime date = AgentController.PeriodDate(Month[0]);

            SaveToPdf.ZpMonth(new Info
            {
                FileName  = FileName,
                Title     = $"Отчет зп за месяц {DateTime.Now.Month} года {DateTime.Now.Year}",
                Colon     = list,
                zarplatas = _zarplata.Read(null).Where(rec => rec.data.Month == date.Month).ToList()
            }, date);;
            Mail.SendMail(m.SendMail, FileName, $"Отчет за месяц {DateTime.Now.Month} года {DateTime.Now.Year}");
            return(RedirectToAction("Report"));
        }
예제 #12
0
        public async Task getAllReportModelFromServerAndUpdate(
            string startDate,       //format 15/12/2017
            string endDate,         //format 15/2/2018
            Action <NetworkResponse> cbSuccessSent = null,
            Action <string> cbError = null
            )
        {
            Action <NetworkResponse> newCBSuccessSent = delegate(NetworkResponse networkResponse) {
                if (networkResponse.Successful)
                {
                    _report = JsonConvert.DeserializeObject <ReportModel>(networkResponse.Data.ToString());
                }
                cbSuccessSent?.Invoke(networkResponse);
            };
            string uri = API_CONTROLLER;

            uri += (startDate == endDate ? "?reportDate=" + startDate : "?startDate=" + startDate + "&endDate=" + endDate);
            await RequestManager.getInstance().getAsync(
                uri,
                newCBSuccessSent,
                cbError
                );
        }
예제 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportId"></param>
        /// <returns></returns>
        public ReportModel GetReportById(int reportId)
        {
            log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution start.");
            ReportModel reportModel = null;

            try
            {
                using (ReportDB reportDB = new ReportDB())
                {
                    reportModel = reportDB.GetReportById(reportId);
                }
                return(reportModel);
            }
            catch (Exception exception)
            {
                errorLog.Fatal("Exception " + exception.Message + "\n" + exception.StackTrace);
                throw;
            }
            finally
            {
                log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution end.");
            }
        }
예제 #14
0
        public ActionResult Edit(ReportModel model)
        {
            var report = _reportRepository.GetById(model.Id);

            if (ModelState.IsValid)
            {
                report = model.ToEntity(report);
                //always set IsNew to false when saving
                report.IsNew = false;
                _reportRepository.Update(report);

                //commit all changes
                this._dbContext.SaveChanges();

                //notification
                SuccessNotification(_localizationService.GetResource("Record.Saved"));
                return(new NullJsonResult());
            }
            else
            {
                return(Json(new { Errors = ModelState.SerializeErrors() }));
            }
        }
예제 #15
0
        public DataTable GetDailyTotalCostEverySubject(ReportModel objReportModel)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            var dt = new DataTable();

            try
            {
                objDbCommand.AddInParameter("FromDate", ReportObject.FromDate);
                objDbCommand.AddInParameter("ToDate", ReportObject.ToDate);
                dt = objDataAccess.ExecuteTable(objDbCommand, "[dbo].uspGetDailyTotalCostEverySubjectReport", CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }

            return(dt);
        }
예제 #16
0
        public static void UpdateReport(ReportModel reportModel)
        {
            using (ctaDBEntities entities = new ctaDBEntities())
            {
                Report report = entities.Reports.Where(s => s.Id == reportModel.Id).FirstOrDefault();
                if (report != null)
                {
                    report.Id          = reportModel.Id;
                    report.active      = reportModel.active;
                    report.description = reportModel.description;
                    report.title       = reportModel.title;
                    report.type        = reportModel.type;
                    report.url         = reportModel.url;

                    entities.SaveChanges();
                }

                if (!(entities.Database.Connection.State == ConnectionState.Closed))
                {
                    entities.Database.Connection.Close();
                }
            }
        }
        /// <summary>
        ///		Obtiene el nodo de un <see cref="ReportModel"/>
        /// </summary>
        private MLNode GetNodeReport(ReportModel report)
        {
            MLNode rootML = new MLNode(TagReport);

            // Asigna las propiedades
            rootML.Attributes.Add(TagId, report.Id);
            rootML.Nodes.Add(TagDescription, report.Description);
            // Añade las expresiones
            foreach (ReportDataSourceModel dataSource in report.ReportDataSources)
            {
                MLNode nodeML = rootML.Nodes.Add(TagDataSource);

                // Asigna las propiedades
                nodeML.Attributes.Add(TagSourceId, dataSource.DataSource.Id);
                // Añade las relaciones
                foreach (DimensionRelationModel relation in dataSource.Relations)
                {
                    nodeML.Nodes.Add(GetNodeRelation(relation));
                }
            }
            // Devuelve los datos del nodo
            return(rootML);
        }
예제 #18
0
        public CasePreviewViewModel BindCaseModelToCasePreviewViewModel(ReportModel rm, int caller_id)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();
            CasePreviewViewModel vm_case = new CasePreviewViewModel();

            this.report_id                = rm._report.id;
            this.case_dt                  = rm.IncidentDateString();
            this.reported_dt              = rm.ReportedDateString();
            this.case_number              = rm._report.display_name;
            this.location                 = rm.LocationString();
            this.case_secondary_types     = rm.SecondaryTypeString();
            this.case_secondary_types_all = rm.SecondaryTypeStringAll();
            this.case_color_code          = rm.ColorCode();
            this.days_left                = rm.GetThisStepDaysLeft();
            this.current_status           = rm.InvestigationStatusString();


            this.tasks_number    = rm.ReportTasks(0).Count().ToString();
            this.messages_number = rm.UserMessagesCountNotSecure(caller_id, 0).ToString();

            //?
            return(vm_case);
        }
예제 #19
0
        public void Print()
        {
            ReportModel model = new ReportModel();

            model.Parameters = new List <ReportParameter> {
                new ReportParameter("dtFrom", startDate.Value.ToString("d")),
                new ReportParameter("dtTo", EndDate.Value.ToString("d")),
                new ReportParameter("Company", model.Company.ToUpper()),
                new ReportParameter("Address", model.Address),
                new ReportParameter("Ledger", searchLookUpEdit1.Text),
            };
            model.ReportDataSource.Name = "Commission";

            if (string.IsNullOrEmpty(RefferedId))
            {
                RefferedId = "All";
            }
            CommissionView();
            model.ReportDataSource.Value = data;

            model.ReportPath = "GHospital_Care.Report.rptComissionStatus.rdlc";
            model.Show(model, this);
        }
예제 #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <returns></returns>
        public OperationDetails AddEditReport(ReportModel reportModel)
        {
            log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution start.");
            OperationDetails operationDetails = null;

            try
            {
                using (ReportDB reportDB = new ReportDB())
                {
                    operationDetails = reportDB.AddEditReport(reportModel);
                }
                return(operationDetails);
            }
            catch (Exception exception)
            {
                errorLog.Fatal("Exception " + exception.Message + "\n" + exception.StackTrace);
                throw;
            }
            finally
            {
                log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution end.");
            }
        }
예제 #21
0
        public ActionResult ExportToKml(SearchReportViewModel vm)
        {
            ReportModel rm     = new ReportModel();
            var         report = rm.GetVesselReports(vm, false);

            //convert to Placemark list
            double latitude;
            double longitude;
            var    loc = report.Select(s => new Placemark
            {
                Name        = s.IMO.ToString(),
                Description = "",
                Point       = new Location
                {
                    Latitude  = Double.TryParse(s.Lat, out latitude) ? latitude : 0,
                    Longitude = Double.TryParse(s.Lon, out longitude) ? longitude : 0
                }
            }).ToList();

            string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmm");

            return(new KmlFileResult(loc, string.Format("report_{0}.kml", dateTimeNow)));
        }
예제 #22
0
        public void InitView(ReportModel model)
        {
            try
            {
                _model = model;

                tbExpense.DataBindings.Add("Text", _model, "Expense", true, DataSourceUpdateMode.OnPropertyChanged);
                tbRevenue.DataBindings.Add("Text", _model, "Revenue", true, DataSourceUpdateMode.OnPropertyChanged);
                tbProfit.DataBindings.Add("Text", _model, "Profit", true, DataSourceUpdateMode.OnPropertyChanged);
                tbSubPayment.DataBindings.Add("Text", _model, "SubPayment", true, DataSourceUpdateMode.OnPropertyChanged);
                tbSubQuantity.DataBindings.Add("Text", _model, "SubCost", true, DataSourceUpdateMode.OnPropertyChanged);

                _dtpFromDate.DataBindings.Add("Value", _model, "ReportDateFrom", true, DataSourceUpdateMode.OnPropertyChanged);
                _dtpToDate.DataBindings.Add("Value", _model, "ReportDateTo", true, DataSourceUpdateMode.OnPropertyChanged);
                dgvOrders.DataBindings.Add("DataSource", _model, "OrderDisplay", true, DataSourceUpdateMode.OnPropertyChanged);
                dgvOrderItem.DataBindings.Add("DataSource", _model, "OrderItems", true, DataSourceUpdateMode.OnPropertyChanged);
                _cbQuarter.DataBindings.Add("DataSource", _model, "Quarters", true, DataSourceUpdateMode.OnPropertyChanged);
            }
            catch (Exception exc)
            {
                AppLogger.logError(this.ToString(), exc);
            }
        }
예제 #23
0
        public object AgentInformation(ReportModel model)
        {
            StringBuilderService builder = new StringBuilderService();
            string accCategorySub        = builder.ExtractText(Convert.ToString(model.ReportOption), "subAccCategory", ",");
            string fromDate    = builder.ExtractText(Convert.ToString(model.ReportOption), "fromDate", ",");
            string toDate      = builder.ExtractText(Convert.ToString(model.ReportOption), "toDate", ",");
            string options     = builder.ExtractText(Convert.ToString(model.ReportOption), "options", ",");
            string accCategory = builder.ExtractText(Convert.ToString(model.ReportOption), "accCategory", "}");


            List <AgentInformation> registrationReports = service.GetAgentInfo(fromDate, toDate, options, accCategory, accCategorySub);
            ReportViewer            reportViewer        = new ReportViewer();

            reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTAgentInformation.rdlc");              //Request.RequestUri("");
            reportViewer.LocalReport.SetParameters(GetKycInformationRptParameter(fromDate, toDate, options, accCategory));
            ReportDataSource A = new ReportDataSource("AgentInformation", registrationReports);

            reportViewer.LocalReport.DataSources.Add(A);
            ReportUtility  reportUtility = new ReportUtility();
            MFSFileManager fileManager   = new MFSFileManager();

            return(reportUtility.GenerateReport(reportViewer, model.FileType));
        }
예제 #24
0
        /// <summary>
        /// Compares 2 cells arrays
        /// </summary>
        public static int CompareCells(ResultCell[] a, ResultCell[] b)
        {
            if (a.Length == 0 || a.Length != b.Length)
            {
                return(0);
            }
            ReportModel model = a[0].Element.Model;

            foreach (ReportElement element in model.Elements.Where(i => !string.IsNullOrEmpty(i.FinalSortOrder)).OrderBy(i => i.FinalSortOrder))
            {
                ResultCell aCell = a.FirstOrDefault(i => i.Element == element);
                ResultCell bCell = b.FirstOrDefault(i => i.Element == element);
                if (aCell != null && bCell != null)
                {
                    int result = CompareCell(aCell, bCell);
                    if (result != 0)
                    {
                        return((element.FinalSortOrder.Contains(ReportElement.kAscendantSortKeyword) ? 1 : -1) * result);
                    }
                }
            }
            return(0);
        }
예제 #25
0
        public object KycBalance(ReportModel model)
        {
            StringBuilderService builder = new StringBuilderService();
            string regStatus             = builder.ExtractText(Convert.ToString(model.ReportOption), "regStatus", "}");
            string fromDate    = builder.ExtractText(Convert.ToString(model.ReportOption), "fromDate", ",");
            string toDate      = builder.ExtractText(Convert.ToString(model.ReportOption), "toDate", ",");
            string accNo       = builder.ExtractText(Convert.ToString(model.ReportOption), "accNo", ",");
            string options     = builder.ExtractText(Convert.ToString(model.ReportOption), "options", ",");
            string accCategory = builder.ExtractText(Convert.ToString(model.ReportOption), "accCategory", ",");

            List <KycBalance> kycBalances  = service.GetKycBalance(regStatus, fromDate, toDate, accNo, options, accCategory);
            ReportViewer      reportViewer = new ReportViewer();

            reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTKycBalance.rdlc");              //Request.RequestUri("");
            reportViewer.LocalReport.SetParameters(GetKycBalanceRptParameter(regStatus, fromDate, toDate, accNo, options, accCategory));
            ReportDataSource A = new ReportDataSource("KycBalance", kycBalances);

            reportViewer.LocalReport.DataSources.Add(A);
            ReportUtility  reportUtility = new ReportUtility();
            MFSFileManager fileManager   = new MFSFileManager();

            return(reportUtility.GenerateReport(reportViewer, model.FileType));
        }
예제 #26
0
        public ActionResult ReportByYear(ReportModel rp)
        {
            var result = new List <ReportByDate_Result>();
            int year   = rp.Year;

            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

            result = _reportService.ReportByYear(year);

            var model = _mapper.Map <IEnumerable <ReportModel> >(result);

            foreach (var item in model)
            {
                item.Year        = year;
                item.TotalTicked = model.Sum(t => t.TOTAL_TICKED);
                item.TotalPrice  = model.Sum(t => t.TOTAL_PRICE);
            }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
예제 #27
0
        private void btnPrintView_Click(object sender, EventArgs e)
        {
            chkValue();
            //rdlcIndoorPatientFinalBilling.rdlc
            ReportModel model = new ReportModel();

            model.Parameters = new List <ReportParameter>
            {
                new ReportParameter("dtFrom", FromDate.Value.ToString("d")),
                new ReportParameter("dtTo", ToDate.Value.ToString("d")),
                new ReportParameter("Company", model.Company.ToUpper()), new ReportParameter("Address", model.Address),
                new ReportParameter("reportName", reportName),
            };
            model.ReportDataSource.Name = "IndoorPatientFinalBilling";

            chkValue();
            DataTable dt = new BedHistoryManager().GetIpInfo(FromDate.Value, ToDate.Value, check);

            model.ReportDataSource.Value = dt;

            model.ReportPath = "GHospital_Care.Report.rdlcIndoorPatientFinalBilling.rdlc";
            model.Show(model, this);
        }
예제 #28
0
        public IEnumerable <ReportModel> UpdatePatientReport(ReportModel patientReport)
        {
            IEnumerable <ReportModel> result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(Utils.Url());

                    client.DefaultRequestHeaders.Clear();

                    var jsonData = JsonConvert.SerializeObject(patientReport);

                    var buffer = System.Text.Encoding.UTF8.GetBytes(jsonData);

                    var byteContent = new ByteArrayContent(buffer);

                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                    HttpResponseMessage Res = client.PostAsync(Utils.Url() + "LabIncharge/UpdatePatientReport", byteContent).Result;

                    if (Res.IsSuccessStatusCode && Res != null)
                    {
                        var res = (Res.Content.ReadAsAsync <IEnumerable <ReportModel> >().Result);

                        result = res;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                Utils.Logging(ex, 2);
                return(result);
            }
        }
예제 #29
0
        public object DailySumReport(ReportModel model)
        {
            try
            {
                StringBuilderService builder = new StringBuilderService();
                string mphone   = builder.ExtractText(Convert.ToString(model.ReportOption), "mphone", ",");
                string fromDate = builder.ExtractText(Convert.ToString(model.ReportOption), "fromDate", ",");
                string toDate   = builder.ExtractText(Convert.ToString(model.ReportOption), "toDate", ",");
                string dateType = builder.ExtractText(Convert.ToString(model.ReportOption), "dateType", "}");
                //var clientInfo = (Reginfo)kycService.GetClientInfoByMphone(mphone);
                var childMerchantCode = chainMerchantService.GetChainMerchantCodeByMphone(mphone);


                List <OutletDailySummaryTransaction> merchantTransactionList = new List <OutletDailySummaryTransaction>();

                merchantTransactionList = childMerchantService.ChildMerDailySumReport(mphone, childMerchantCode, fromDate, toDate, dateType).ToList();

                string       merchantName = merchantTransactionList[0].OutletName;
                string       merchantCode = merchantTransactionList[0].OutletId;
                ReportViewer reportViewer = new ReportViewer();

                reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/RPTChildOutletDailySummaryTrans.rdlc");
                reportViewer.LocalReport.SetParameters(GetReportParameterDailySumReport(mphone, fromDate, toDate, merchantName, merchantCode));
                ReportDataSource A = new ReportDataSource("OutletDailyTransaction", merchantTransactionList);
                reportViewer.LocalReport.DataSources.Add(A);


                ReportUtility  reportUtility = new ReportUtility();
                MFSFileManager fileManager   = new MFSFileManager();

                return(reportUtility.GenerateReport(reportViewer, model.FileType));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #30
0
        /// <summary>
        /// 获取教练员学员考试信息 和工资
        /// </summary>
        /// <param name="time"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public WebResult <ReportModel> Get_ExpendReport(DateTime?searchTime)
        {
            //赋值本月
            if (searchTime == null)
            {
                searchTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
            }
            //表单model
            var model = new ReportModel();

            model.x            = new List <string>();
            model.expendSeries = new List <Series>();

            //本月结束时间
            var endTime = DateTime.Parse(searchTime.Value.AddMonths(1).ToString("yyyy-MM")).AddDays(-1);// && x.Code == ThemeCode.Two

            var query = Cache_Get_CarList().Where(x => (x.Flag & (long)GlobalFlag.Removed) == 0).AsQueryable();


            var expendThingList = Get_DataDictorySelectItem(GroupCode.ExpendThing);
            var list            = query.ToList();
            var expendDic       = Cache_Get_ExpendList().Where(x => x.CreatedTime > searchTime && x.CreatedTime < endTime && (x.Flag & (long)GlobalFlag.Removed) == 0).GroupBy(x => x.ThingID).ToDictionary(x => x.Key, x => x.Sum(y => y.Money));
            var expendSeries    = new Series();

            expendSeries.data = new List <decimal>();
            expendSeries.name = "支出统计";
            Get_DataDictorySelectItem(GroupCode.ExpendThing).ForEach(item =>
            {
                model.x.Add(item.Text);
                if (expendDic.ContainsKey(item.Value))
                {
                    expendSeries.data.Add(expendDic[item.Value]);
                }
            });
            model.expendSeries.Add(expendSeries);
            return(Result(model));
        }
예제 #31
0
        private SubscriptionVM GetModelEdit(SubscriptionModel subscriptionModel)
        {
            IEnumerable <Subreport> subscriptions = new List <Subreport>();
            int    partnerId = Convert.ToInt32(Session["partnerId"]);
            int    userId    = subscriptionModel.User.Id;
            string usern     = "";
            IEnumerable <ReportModel> listrepost = _repoReport.All();

            User user = subscriptionModel.User;

            subscriptions = _repo.GetSubscriptionsIncluding(userId);
            string bussinesname = "";

            if (user.Partner != null)
            {
                bussinesname = user.Partner.BusinessName;
            }
            usern = user.UserName + " - " + user.Name + " - " + bussinesname;
            // listrepost = user.Reports.ToList();
            ReportModel report = subscriptionModel.ReportFilters.First().Report;

            SubscriptionVM vmodel = new SubscriptionVM()
            {
                List     = ProcessSubscription(subscriptions),
                User     = usern,
                UserId   = userId,
                ReportId = new SelectList(listrepost, "Id", "Name", report.Id)
            };

            IEnumerable <Schedule> listscheduled = _repoScheduled.GetScheduleByUser(userId);

            vmodel.ScheduledId  = new SelectList(listscheduled, "Id", "Name", subscriptionModel.ScheduleId);
            vmodel.Description  = subscriptionModel.Description;
            vmodel.Email        = subscriptionModel.Email;
            vmodel.EmailComment = subscriptionModel.EmailComment;
            return(vmodel);
        }
예제 #32
0
        public async void TestLogicCreateTicket()
        {
            string   userID      = "USERID123";
            string   description = "report description";
            DateTime time        = DateTime.Now;

            using (var context = new Cinephiliacs_AdmintoolsContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                AdminRepository repo  = new AdminRepository(context);
                ReportingLogic  logic = new ReportingLogic(repo, new Mapper());
                ReportModel     model = new ReportModel()
                {
                    ReportEntityType  = "Review",
                    ReportEnitityId   = userID,
                    ReportDescription = description,
                };
                bool success = await logic.CreateReportTicket(model);
            }

            using (var context1 = new Cinephiliacs_AdmintoolsContext(options))
            {
                context1.Database.EnsureCreated();
                var tickets = context1.Tickets.ToList();
                tickets.ForEach(t =>
                {
                    System.Console.WriteLine(t.ItemId);
                    System.Console.WriteLine(t.AffectedService);
                    System.Console.WriteLine(t.Descript);
                    System.Console.WriteLine(t.TimeSubmitted);
                    System.Console.WriteLine(t.TicketId);
                });
                var ticket = context1.Tickets.Where(t => t.ItemId == userID && t.Descript == description).FirstOrDefault();
                Assert.NotNull(ticket);
            }
        }
예제 #33
0
        public IHttpActionResult GetReport(dynamic str)
        {
            try
            {
                string userName = str.ToString();
                var    result   = new ReportModel();
                var    Comments = new List <Comment>();
                var    posts    = _context.POSTs.AsQueryable().Where(x => x.USER_ID == userName).Select(x => new PostModel {
                    Post_Id = x.POST_ID, Post_Content = x.POST_CONTENT, UserId = x.USER_ID, Post_Time = x.POST_TIME
                }).ToList();
                foreach (var item in posts)
                {
                    Comments = _context.COMMENTs.AsQueryable().Where(x => x.POST_ID == item.Post_Id).
                               Select(x => new Comment
                    {
                        Comment_Id      = x.COMMENT_ID,
                        Comment_Time    = x.COMMENT_TIME,
                        Like_count      = x.LIKE_COUNT,
                        Dislike_Count   = x.DISLIKE_COUNT,
                        User_Id         = x.USER_ID,
                        Comment_Content = x.COMMNET_CONTENT
                    }).ToList();
                    item.CommentList = Comments;
                }

                result.Posts    = posts;
                result.Comments = Comments;
                _return.IsError = false;
                _return.ApiData = result;
                return(Ok(result));
            }
            catch (Exception e)
            {
                Error.ErrorLog("Something", e.Message);
                return(Json(_return));
            }
        }
예제 #34
0
        public void Calculate_Page_If_Firstpage()
        {
            Size         defSize = new Size(727, 60);
            IReportModel model   = ReportModel.Create();

            model.ReportHeader.Size     = defSize;
            model.ReportHeader.Location = new Point(50, 50);


            model.PageHeader.Size     = defSize;
            model.PageHeader.Location = new Point(50, 125);

            model.DetailSection.Size     = defSize;
            model.DetailSection.Location = new Point(50, 200);

            model.PageFooter.Size       = defSize;
            model.ReportFooter.Location = new Point(50, 275);

            model.ReportFooter.Size     = defSize;
            model.ReportFooter.Location = new Point(50, 350);

            var        s  = new SectionBounds(new ReportSettings(), true);
            SinglePage sp = new SinglePage(s, 0);

            sp.CalculatePageBounds(model);
            Console.WriteLine();
            Console.WriteLine("ReportHeader {0} - {1}", sp.SectionBounds.ReportHeaderRectangle, sp.SectionBounds.ReportHeaderRectangle.Location.Y + sp.SectionBounds.ReportHeaderRectangle.Height);
            Console.WriteLine("PageHeader {0} - {1}", sp.SectionBounds.PageHeaderRectangle, sp.SectionBounds.PageHeaderRectangle.Location.Y + sp.SectionBounds.PageHeaderRectangle.Height);
            Console.WriteLine("DetailSection {0} - {1} ", sp.SectionBounds.DetailSectionRectangle, sp.SectionBounds.DetailSectionRectangle.Location.Y + sp.SectionBounds.DetailSectionRectangle.Height);

            Console.WriteLine("\tDetailStart {0} ", sp.SectionBounds.DetailStart);
            Console.WriteLine("\tDetailEnd {0} ", sp.SectionBounds.DetailEnds);
            Console.WriteLine("\tDetailArea {0} ", sp.SectionBounds.DetailArea);
            Console.WriteLine("PageFooter {0} - {1} ", sp.SectionBounds.PageFooterRectangle, sp.SectionBounds.PageFooterRectangle.Location.Y + sp.SectionBounds.PageFooterRectangle.Height);
            Console.WriteLine("ReportFooter {0} - {1}", sp.SectionBounds.ReportFooterRectangle, sp.SectionBounds.ReportFooterRectangle.Location.Y + sp.SectionBounds.ReportFooterRectangle.Height);
            Console.WriteLine();
        }
예제 #35
0
        public List <ReportModel> GetReports()
        {
            List <ReportModel> output = new List <ReportModel>();
            var conn = @"Server=USHYDYMANIDEE12;Database=Aetna;Integrated Security=SSPI;";

            using (var con = new SqlConnection(conn))
            {
                using (SqlCommand cmd = new SqlCommand("sp_SEC_Reports"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = con;
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        ReportModel repObj = new ReportModel();
                        repObj.REPORT_CD        = Convert.ToString(reader["REPORT_CD"]);
                        repObj.REPORT_DESC      = Convert.ToString(reader["REPORT_DESC"]);
                        repObj.APP_RTGRP_ACC_CD = Convert.ToString(reader["APP_RTGRP_ACC_CD"]);
                        repObj.CREAT_BY_ID      = Convert.ToString(reader["CREAT_BY_ID"]);
                        repObj.CREAT_TMSTMP     = Convert.ToDateTime(reader["CREAT_TMSTMP"]);
                        repObj.UPDT_BY_ID       = Convert.ToString(reader["UPDT_BY_ID"]);
                        repObj.UPDT_TMSTMP      = Convert.ToDateTime(reader["UPDT_TMSTMP"]);
                        repObj.SEL_RPT_ACRONYM  = Convert.ToString(reader["SEL_RPT_ACRONYM"]);
                        if (!DBNull.Value.Equals(reader["REPORT_SORT_ORDER"]))
                        {
                            repObj.REPORT_SORT_ORDER = Convert.ToInt32(reader["REPORT_SORT_ORDER"]);
                        }
                        output.Add(repObj);
                    }
                    reader.NextResult();
                    con.Close();
                }
            }
            return(output);
        }
예제 #36
0
        protected override void LoadFromPrimary()
        {
            Pages.Clear();
            ReportModel model      = designerLoader.CreateRenderableModel();
            var         collectCmd = new CollectParametersCommand(model);

            collectCmd.Run();
            switch (model.DataModel)
            {
            case GlobalEnums.PushPullModel.FormSheet:
            {
                exportRunner.RunReport(model, (ReportParameters)null);
                break;
            }

            case GlobalEnums.PushPullModel.PullData:
            {
                exportRunner.RunReport(model, (ReportParameters)null);
                break;
            }

            case GlobalEnums.PushPullModel.PushData:
            {
                var cmd = new DataSetFromXsdCommand();
                cmd.Run();
                System.Data.DataSet ds = cmd.DataSet;
                exportRunner.RunReport(model, ds.Tables[0], (ReportParameters)null);
                break;
            }

            default:
                throw new InvalidReportModelException();
            }
            PreviewViewModel previewViewModel = new PreviewViewModel(model.ReportSettings, exportRunner.Pages);

            viewer.SetBinding(previewViewModel);
        }
예제 #37
0
        /// <summary>
        /// Get the Summary report detais based on the search parameter.
        /// </summary>
        /// <param name="reportDetails">object</param>
        /// <param name="loginUserId">string</param>
        /// <returns>object</returns>
        public ReportModel GetSummaryReportDetails(ReportDetails reportDetails, string loginUserId)
        {
            ReportModel oReportModel = new ReportModel();

            try
            {
                using (var connection = Connection())
                {
                    var result = connection.QueryMultiple("Rpt_Summary", new
                    {
                        RptType      = reportDetails.RptType,
                        StateId      = reportDetails.StateId,
                        SiteId       = reportDetails.SiteId,
                        TurbinTypeId = reportDetails.TurbineTypeId,
                        DptId        = reportDetails.DptId,
                        CStatusId    = reportDetails.CStatusId,
                        TbnId        = reportDetails.TbnId == null ? "0" : reportDetails.TbnId,
                        State        = reportDetails.State,
                        Site         = reportDetails.Site,
                        TurbineType  = reportDetails.TurbineType,
                        Dept         = reportDetails.Dept,
                        CStatus      = reportDetails.CStatus,
                        Turbine      = reportDetails.Turbine,
                        DateFrom     = reportDetails.DateFrom,
                        DateTo       = reportDetails.DateTo,
                        UId          = loginUserId,
                    }, commandType: CommandType.StoredProcedure);
                    oReportModel.SummaryReports = result.Read <SummaryReport>().ToList();
                }
            }
            catch (Exception ex)
            {
                //SaveErrorMessageInFile(oErrorMessage = new ErrorMessage { UserId = loginUserId, ModuleName = "Report", MethodName = "GetSummaryReportDetails", Exception = ex.Message });
                logger.Error(ex.Message);
            }
            return(oReportModel);
        }
예제 #38
0
        public static void GenerateReport()
        {
            ReportModel report = new ReportModel();

            report.Formats = new Dictionary <string, int>();

            report.ActressRatio  = new List <ReportRatioModel>();
            report.CategoryRatio = new List <ReportRatioModel>();
            report.CompanyRatio  = new List <ReportRatioModel>();
            report.DirectorRatio = new List <ReportRatioModel>();

            report.PrefixRatio = new List <ReportRatioModel>();
            report.YearRatio   = new List <ReportRatioModel>();

            report.TopActress  = new Dictionary <string, int>();
            report.TopCategory = new Dictionary <string, int>();
            report.TopCompany  = new Dictionary <string, int>();
            report.TopDirctor  = new Dictionary <string, int>();

            report.TopPrefix = new Dictionary <string, int>();
            report.TopDate   = new Dictionary <string, int>();

            report.Top = 10;

            Console.WriteLine("正在获取AV爬虫信息...");
            var avs = JavDataBaseManager.GetAllAV();

            Console.WriteLine("正在获取本地AV信息...");
            var filesContainer = GenerateExistingAVs();

            Console.WriteLine("正在生成报表基本数据...");
            GenerateBasicReportData(avs, filesContainer, report);

            var reportStr = PrintReport(report);

            Console.WriteLine(reportStr);
        }
예제 #39
0
        void _bg_DoWork(object sender, DoWorkEventArgs e)
        {
            var worker = sender as BackgroundWorker;
            var model = e.Argument as CalibImageDTO;
            if (model != null)
            {
                //prepare data
                var descFile = _assistant.GetCalibPlateDescrFile();
                var calibImage = _assistant.GetCalibImage(model.ImageID);
                var plateParam = _assistant.GetCalibrationPlateParam();
                var startCameraParam = _assistant.GetCameraParamHTuple(calibImage);

                //doWork
                var report = _calibImageCalculator.GetCalibtionImageReport(descFile, calibImage, plateParam, startCameraParam);

                //var plateMarkModel = _calibImageCalculator.GetCalibrationPlateMarkViewModel(descFile, calibImage.GetImage()
                //																, plateParam, startCameraParam);

                var reportModel = new ReportModel()
                {
                    UserState = model.UserState,
                    Model = report,
                };
                _bg.ReportProgress(++_accWorkCount, reportModel);

                //remove work
                _workingStack.RemoveAt(0);
            }
        }
예제 #40
0
        public int UploadLog(ReportModel report, IEnumerable<IMessage> log)
        {
            try
            {
                var logId = -1;

                // log upload format doesn't allow much HTML or anything other than line breaks.
                var sb =
                    new StringBuilder(
                        string.Format(
                            "{0} log upload \nAll times in 24hr {1} \n\n",
                            Constants.FriendlyName,
                            TimeZone.CurrentTimeZone.StandardName));

                var messages =
                    log.Select(
                        m => string.Format("{0} {1}: {2} \n", m.PostedTime.ToTimeStamp(), m.Poster.Name, m.Message));

                var i = 0;
                foreach (var m in messages)
                {
                    sb.Append(m);
                    if (i >= 24)
                    {
                        sb.Append("\n\n"); // legibility
                        i = 0;
                    }

                    i++;
                }

                var toUpload = new Dictionary<string, object>
                    {
                        {"character", report.Reporter.Name},
                        {"log", sb.ToString()},
                        {"reportText", report.Complaint},
                        {"reportUser", report.Reported},
                        {"channel", report.Tab}
                    };

                var buffer = browser.GetResponse(Constants.UrlConstants.UploadLog, toUpload, true);
                dynamic result = SimpleJson.DeserializeObject(buffer);

                if (result.log_id != null)
                {
                    // sometimes log_id appears to be a string
                    int.TryParse(result.log_id, out logId);
                }

                return logId;
            }
            catch (Exception)
            {
                // when dealing with the web it's always possible something could mess up
                return -1;
            }
        }
예제 #41
0
		private void SetupViewer (ReportModel reportModel)
		{
			this.pages = new PagesCollection();
			this.reportSettings = reportModel.ReportSettings;
			this.AdjustDrawArea();
		}
예제 #42
0
		private void RunDataReport (ReportModel reportModel,IDataManager data)
		{
			IReportCreator reportCreator = DataPageBuilder.CreateInstance(reportModel,data);
			reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
			reportCreator.GroupHeaderRendering += new EventHandler<GroupHeaderEventArgs>(GroupHeaderRendering);
			reportCreator.GroupFooterRendering += GroupFooterRendering;
			
			reportCreator.RowRendering += new EventHandler<RowRenderEventArgs>(RowRendering);
			reportCreator.PageCreated += OnPageCreated;
			reportCreator.BuildExportList();
			ShowCompleted();
		}
예제 #43
0
		private void RunFormSheet (ReportModel reportModel)
		{
			IReportCreator reportCreator = FormPageBuilder.CreateInstance(reportModel);
			reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
			reportCreator.PageCreated += OnPageCreated;
			reportCreator.BuildExportList();
			ShowCompleted ();
		}
예제 #44
0
		private void SetupViewer(ReportModel reportModel)
		{
			this.reportSettings = reportModel.ReportSettings;
			this.AdjustDrawArea();
		}
        private void AddExamples(ReportModel.Scenario[] scenarioGroup)
        {
            var firstScenario = scenarioGroup.First();
            var scenarioResult = (Result)scenarioGroup.Max(s => (int)s.Result);

            using (OpenTag("<li class='step'>", HtmlTag.li))
            {
                AddLine("<span class='example-header'>Examples:</span>");
                using (OpenTag(string.Format("<table class='examples' style='border-collapse: collapse;margin-left:10px''>"), HtmlTag.table))
                {
                    using (OpenTag("<tr>", HtmlTag.tr))
                    {
                        AddLine(string.Format("<th></th>"));
                        foreach (var header in firstScenario.Example.Headers)
                            AddLine(string.Format("<th>{0}</th>", header));

                        if (scenarioResult == Result.Failed)
                            AddLine(string.Format("<th>Error</th>"));
                    }

                    foreach (var scenario in scenarioGroup)
                        AddExampleRow(scenario, scenarioResult);
                }
            }
        }
 public ReportModel SaveReport(ReportModel report)
 {           
     var savedReport = ReportProvider.SaveReport(report);
     return savedReport;
 }
        private void AddScenario(ReportModel.Scenario scenario)
        {
            AddLine(string.Format("<div class='{0} canToggle scenarioTitle' data-toggle-target='{1}'>{2}{3}</div>", scenario.Result, scenario.Id, scenario.Title, FormatTags(scenario.Tags)));

            using (OpenTag(string.Format("<ul class='steps' id='{0}'>", scenario.Id), HtmlTag.ul))
            {
                foreach (var step in scenario.Steps.Where(s => s.ShouldReport))
                {
                    string stepClass = string.Empty;
                    var reportException = step.Exception != null && step.Result == Result.Failed;
                    string canToggle = reportException ? "canToggle" : string.Empty;

                    using (OpenTag(string.Format("<li class='step {0} {1} {2} {3}' data-toggle-target='{4}' >", step.Result, stepClass, step.ExecutionOrder, canToggle, step.Id), HtmlTag.li))
                    {
                        var titleLines = step.Title.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                        var title = titleLines[0];
                        if (reportException)
                        {
                            stepClass = step.Result + "Exception";
                            if (!string.IsNullOrEmpty(step.Exception.Message))
                                title += " [Exception Message: '" + step.Exception.Message + "']";
                        }

                        AddLine(string.Format("<span>{0}</span>", title));

                        for (int i = 1; i < titleLines.Length; i++)
                            AddLine(string.Format("<div class='step-title-extra-lines'>{0}</div>", titleLines[i]));

                        if (reportException)
                        {
                            using (OpenTag(string.Format("<div class='step {0}' id='{1}'>", stepClass, step.Id), HtmlTag.div))
                            {
                                AddLine(string.Format("<code>{0}</code>", step.Exception.StackTrace));
                            }
                        }
                    }
                }
            }
        }
예제 #48
0
		public void RunReport(ReportModel reportModel, IDataManager dataManager)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataManager == null) {
				throw new ArgumentNullException("dataManager");
			}
//			ReportEngine.CheckForParameters(reportModel, parameters);
			IReportCreator reportCreator = DataPageBuilder.CreateInstance(reportModel, dataManager);
			BuildExportList(reportCreator);
		}
        private void AddStoryMetadataAndNarrative(ReportModel.Story story)
        {
            using (OpenTag("<div class='storyMetadata'>", HtmlTag.div))
            {
                AddLine(story.Metadata == null
                    ? string.Format("<div class='namespaceName'>{0}</div>", story.Namespace)
                    : string.Format("<div class='storyTitle'>{0}</div>",
                        string.IsNullOrWhiteSpace(story.Metadata.StoryUri)
                            ? story.Metadata.TitlePrefix + story.Metadata.Title
                            : string.Format("<a href='{0}'>{1}{2}</a>", story.Metadata.StoryUri, story.Metadata.TitlePrefix, story.Metadata.Title)));
                
                if (story.Metadata != null && !string.IsNullOrWhiteSpace(story.Metadata.ImageUri))
                {
                    AddLine(string.Format("<img class='storyImg' src='{0}' alt='Image for {1}{2}'/>", story.Metadata.ImageUri, story.Metadata.TitlePrefix, story.Metadata.Title));
                }
                
                if (story.Metadata == null || string.IsNullOrEmpty(story.Metadata.Narrative1)) 
                    return;

                using (OpenTag("<ul class='storyNarrative'>", HtmlTag.ul))
                {
                    AddLine(string.Format("<li>{0}</li>", story.Metadata.Narrative1));
                    if (!string.IsNullOrEmpty(story.Metadata.Narrative2))
                        AddLine(string.Format("<li>{0}</li>", story.Metadata.Narrative2));
                    if (!string.IsNullOrEmpty(story.Metadata.Narrative3))
                        AddLine(string.Format("<li>{0}</li>", story.Metadata.Narrative3));
                }
            }
        }
예제 #50
0
        private void OnReportRequested(IDictionary<string, object> command)
        {
            if (!command.ContainsKey(Constants.Arguments.Report))
                command.Add(Constants.Arguments.Report, string.Empty);

            var logId = -1; // no log

            // report format: "Current Tab/Channel: <channel> | Reporting User: <reported user> | <report body>
            var reportText =
                $"Current Tab/Channel: {command.Get(Constants.Arguments.Channel)} | Reporting User: {command.Get(Constants.Arguments.Name)} | {command.Get(Constants.Arguments.Report)}";

            // upload on a worker thread to avoid blocking
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                var channelName = command.Get(Constants.Arguments.Channel);
                if (!string.IsNullOrWhiteSpace(channelName) && !channelName.Equals("None"))
                {
                    // we could just use _model.SelectedChannel, but the user might change tabs immediately after reporting, creating a race condition
                    ChannelModel channel;
                    if (channelName == command.Get(Constants.Arguments.Name))
                        channel = cm.CurrentPms.FirstByIdOrNull(channelName);
                    else
                        channel = cm.CurrentChannels.FirstByIdOrNull(channelName);

                    if (channel != null)
                    {
                        var report = new ReportModel
                        {
                            Reporter = cm.CurrentCharacter,
                            Reported = command.Get(Constants.Arguments.Name),
                            Complaint = command.Get(Constants.Arguments.Report),
                            Tab = channelName
                        };


                        logId = api.UploadLog(report, channel.Messages.Union(channel.Ads));
                    }
                }

                command.Remove(Constants.Arguments.Name);
                command[Constants.Arguments.Report] = reportText;
                command[Constants.Arguments.LogId] = logId;
                command[Constants.Arguments.Tab] = channelName;

                if (!command.ContainsKey(Constants.Arguments.Action))
                    command[Constants.Arguments.Action] = Constants.Arguments.ActionReport;

                connection.SendMessage(command);
            }).Start();
        }
예제 #51
0
		private void RunDataReport (ReportModel reportModel,IDataManager data)
		{
			ILayouter layouter = new Layouter();
			IReportCreator reportCreator = DataPageBuilder.CreateInstance(reportModel,data,layouter);
			reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
			reportCreator.PageCreated += OnPageCreated;
			reportCreator.BuildExportList();
			ShowCompleted();
		}
예제 #52
0
		private void RunFormSheet(ReportModel reportModel)
		{
			IReportCreator reportCreator = FormPageBuilder.CreateInstance(reportModel);
//			reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
			BuildExportList(reportCreator);
		}
        private void AddExampleRow(ReportModel.Scenario scenario, Result scenarioResult)
        {
            using (OpenTag("<tr>", HtmlTag.tr))
            {
                AddLine(string.Format("<td><Span class='{0}' style='margin-right:4px;' /></td>", scenario.Result));
                foreach (var exampleValue in scenario.Example.Values)
                    AddLine(string.Format("<td>{0}</td>", HttpUtility.HtmlEncode(exampleValue.GetValueAsString())));

                if (scenarioResult != Result.Failed)
                    return;

                using (OpenTag("<td>", HtmlTag.td))
                {
                    var failingStep = scenario.Steps.FirstOrDefault(s => s.Result == Result.Failed);

                    if (failingStep == null)
                        return;

                    var exceptionId = Configurator.IdGenerator.GetStepId();
                    var encodedExceptionMessage = HttpUtility.HtmlEncode(failingStep.Exception.Message);
                    AddLine(string.Format("<span class='canToggle' data-toggle-target='{0}'>{1}</span>", exceptionId, encodedExceptionMessage));
                    using (OpenTag(string.Format("<div class='step' id='{0}'>", exceptionId), HtmlTag.div))
                    {
                        AddLine(string.Format("<code>{0}</code>", failingStep.Exception.StackTrace));
                    }
                }
            }
        }
예제 #54
0
		private void RunFormSheet(ReportModel reportModel)
		{
			runner.RunReport(reportModel,(ReportParameters)null);
			ShowCompleted();
		}
예제 #55
0
        private void OnReportRequested(IDictionary<string, object> command)
        {
            if (!command.ContainsKey(Constants.Arguments.Report))
                command.Add(Constants.Arguments.Report, string.Empty);

            var logId = -1; // no log

            // report format: "Current Tab/Channel: <channel> | Reporting User: <reported user> | <report body>
            var reportText = string.Format(
                "Current Tab/Channel: {0} | Reporting User: {1} | {2}",
                command.Get(Constants.Arguments.Channel),
                command.Get(Constants.Arguments.Name),
                command.Get(Constants.Arguments.Report));

            // upload log
            var channelText = command.Get(Constants.Arguments.Channel);
            if (!string.IsNullOrWhiteSpace(channelText) && !channelText.Equals("None"))
            {
                // we could just use _model.SelectedChannel, but the user might change tabs immediately after reporting, creating a race condition
                ChannelModel channel;
                if (channelText == command.Get(Constants.Arguments.Name))
                    channel = model.CurrentPms.FirstByIdOrNull(channelText);
                else
                    channel = model.CurrentChannels.FirstByIdOrNull(channelText);

                if (channel != null)
                {
                    var report = new ReportModel
                        {
                            Reporter = model.CurrentCharacter,
                            Reported = command.Get(Constants.Arguments.Name),
                            Complaint = command.Get(Constants.Arguments.Report),
                            Tab = channelText
                        };

                    logId = api.UploadLog(report, channel.Messages);
                }
            }

            command.Remove(Constants.Arguments.Name);
            command[Constants.Arguments.Report] = reportText;
            command[Constants.Arguments.LogId] = logId;

            if (!command.ContainsKey(Constants.Arguments.Action))
                command[Constants.Arguments.Action] = Constants.Arguments.ActionReport;

            connection.SendMessage(command);
        }
예제 #56
0
        public int UploadLog(ReportModel report, IEnumerable<IMessage> log)
        {
            try
            {
                var logId = -1;

                // log upload format doesn't allow much HTML or anything other than line breaks.
                var sb = new StringBuilder();
                sb.Append("==================================\n");
                sb.Append($"{Constants.FriendlyName} log upload " +
                          $"\n{DateTime.UtcNow.ToShortDateString()} in {report.Tab}" +
                          $"\nreported user: {report.Reported}" +
                          "\ntime stamps in 24hr UTC\n");
                sb.Append("==================================\n");

                log.Where(x => !x.IsHistoryMessage)
                    .Select(m => $"{m.PostedTime.ToUniversalTime().ToTimeStamp()} {m.Poster.Name}: {m.Message} \n")
                    .Each(m => sb.Append(m));

                var toUpload = new Dictionary<string, object>
                {
                    {"account", model.AccountName.ToLower()},
                    {"ticket", ticketService.Ticket},
                    {"character", report.Reporter.Name},
                    {"log", sb.ToString()},
                    {"reportText", report.Complaint},
                    {"reportUser", report.Reported},
                    {"channel", report.Tab}
                };

                var buffer = browser.GetResponse(Constants.UrlConstants.UploadLog, toUpload, true);
                var result = buffer.DeserializeTo<ApiUploadLogResponse>();

                var hasError = !string.IsNullOrWhiteSpace(result.Error);

                if (hasError)
                {
                    ticketService.ShouldGetNewTicket = true;
                    UploadLog(report, log);
                }

                if (result.LogId != null)
                {
                    int.TryParse(result.LogId, out logId);
                }

                Log($"Uploaded report log in tab {report.Tab} with id of {logId}");
                return logId;
            }
            catch (Exception)
            {
                // when dealing with the web it's always possible something could mess up
                Log($"Failed to get id for report log in tab {report.Tab}");
                return -1;
            }
        }
예제 #57
0
		public void RunReport (ReportModel reportModel,DataTable dataTable,ReportParameters parameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataTable == null) {
				throw new ArgumentNullException("dataTable");
			}
			ReportEngine.CheckForParameters(reportModel,parameters);
			IDataManager dataManager = DataManagerFactory.CreateDataManager(reportModel,dataTable);
			
			RunReport (reportModel,dataManager);
		}
예제 #58
0
		public void RunReport (ReportModel reportModel,IDataManager dataManager)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			if (dataManager == null) {
				throw new ArgumentNullException("dataManager");
			}
			
			this.SetupViewer(reportModel);
			this.dataManager = dataManager;
			RunDataReport(reportModel,dataManager);
		}
예제 #59
0
		private void RunDataReport(ReportModel reportModel, IDataManager data)
		{
			runner.RunReport(reportModel,data);
			ShowCompleted();
		}
        private string CreateExceptionMessage(ReportModel.Step step)
        {
            _exceptions.Add(step.Exception);

            var exceptionReference = string.Format("[Details at {0} below]", _exceptions.Count);
            if (!string.IsNullOrEmpty(step.Exception.Message))
                return string.Format("[{0}] {1}", FlattenExceptionMessage(step.Exception.Message), exceptionReference);

            return string.Format("{0}", exceptionReference);
        }