public ActionResult Index()
        {
            int           id            = 1;
            ReportDetails reportDetails = db.ReportDetails.Find(id);

            return(View(reportDetails));
        }
Exemple #2
0
        public ActionResult Index()
        {
            ViewBag.userName = Session["userName"];
            ViewBag.logged   = Session["LoggedIN"];

            Product_Report re        = Report.report();
            ReportDetails  reDetails = new ReportDetails();

            reDetails.productName          = product.Get(re.Product_ID).Product_Name;
            reDetails.category             = category.Get(product.Get(re.Product_ID).Category_ID).Category_Name;
            reDetails.subCategory          = subCategory.Get(product.Get(re.Product_ID).Sub_Category_ID).Sub_Category_Name;
            reDetails.productPicture       = product.Get(re.Product_ID).Product_Picture;
            reDetails.productPrice         = product.Get(re.Product_ID).Product_Price;
            reDetails.totalSellingQuantity = re.Selling_Quantity;

            int summation = 0, x = 0;
            IEnumerable <Product_Report> reportList = Report.GetAllValues();

            foreach (Product_Report r in reportList)
            {
                x          = product.Get(r.Product_ID).Product_Price *r.Selling_Quantity;
                summation += x;
            }
            ViewBag.totalSellingPrice = summation;

            return(View(reDetails));
        }
        public ActionResult Show(string tiaojian)
        {
            int           id    = db.ReportDetails.FirstOrDefault(r => r.AreaName.Contains(tiaojian)).AreaID;
            ReportDetails model = db.ReportDetails.Find(id);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        /// <summary>
        /// Used to create PDF file to send as attachment.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="reportPath">The report path.</param>
        /// <param name="reportDetails">The report details.</param>
        /// <returns>returns filepath</returns>
        public static string Createpdf(string fileName, string reportPath, ReportDetails reportDetails)
        {
            byte[] result;
            string encoding;
            string mimetype;

            string[] streamids;
            IDictionaryEnumerator en = reportDetails.OptionalReportParameter.GetEnumerator();

            en.MoveNext();
            if (reportDetails.OptionalReportParameter != null)
            {
                result = WSHelper.GetRenderReport(reportPath, "PDF", "", out encoding, out mimetype, out streamids, en.Key.ToString(), en.Value.ToString());
            }
            else
            {
                result = WSHelper.GetRenderReport(reportPath, "PDF", "", out encoding, out mimetype, out streamids, "", "");
            }

            string presentDate    = DateTime.Now.ToShortDateString();
            string presentTime    = DateTime.Now.ToShortTimeString();
            string reportFilePath = reportDetails.ApplicationPathforPdf.ToString() + "\\" + fileName + "_" + presentDate.Replace("/", "") + "_" + presentTime.Replace(":", "").Replace("AM", "").Replace("PM", "") + ".pdf";

            if (System.IO.File.Exists(reportFilePath))
            {
                System.IO.File.Delete(reportFilePath);
            }

            System.IO.FileStream outputFile = new System.IO.FileStream(reportFilePath, System.IO.FileMode.Create);
            outputFile.Write(result, 0, result.Length - 1);
            outputFile.Close();
            return(reportFilePath);
        }
        private List <ReportDetails> _generateDetails(List <Transaction> transactionList)
        {
            List <ReportDetails> detailsFromTransaction = new List <ReportDetails>();
            ReportDetails        reportDetail           = new ReportDetails
            {
                Date   = transactionList[0].TransactionDate.Date,
                Amount = transactionList[0].Amount
            };

            detailsFromTransaction.Add(reportDetail);

            for (int i = 0; i < transactionList.Count - 1; i++)
            {
                if (transactionList[i].TransactionDate.ToShortDateString().Equals(transactionList[i + 1].TransactionDate.ToShortDateString()))
                {
                    reportDetail.Amount += transactionList[i + 1].Amount;
                }
                else
                {
                    reportDetail = new ReportDetails
                    {
                        Date   = transactionList[i + 1].TransactionDate.Date,
                        Amount = transactionList[i + 1].Amount
                    };

                    detailsFromTransaction.Add(reportDetail);
                }
            }

            return(detailsFromTransaction);
        }
Exemple #6
0
        public JsonResult GetSummaryDetails(ReportDetails reportDetails)
        {
            reportDetails.DateFrom = ConvertDate(reportDetails.DateFrom);
            reportDetails.DateTo   = ConvertDate(reportDetails.DateTo);
            ReportModel result = oReportManager.GetSummaryReportDetails(reportDetails, CookieManager.GetCookie(CookieManager.CookieName).logindetail.EmpID);

            return(Json(new { result }, JsonRequestBehavior.AllowGet));
        }
    static void Main(string[] args)
    {
        ReportDirections reportDirections = new ReportDirections();

        reportDirections.selected = "inbound";
        Times Times = new Times();

        Times.dateRange = "Last5Minutes";
        Filters Filters = new Filters();

        Filters.sdfDips_0 = "in_AC10033A_AC10033A-410";
        DataGranularity DataGranularity = new DataGranularity();

        DataGranularity.selected = "auto";
        ReportDetails ReportDetails = new ReportDetails();

        ReportDetails.reportTypeLang   = "conversations";
        ReportDetails.reportDirections = reportDirections;
        ReportDetails.times            = Times;
        ReportDetails.filters          = Filters;
        ReportDetails.dataGranularity  = DataGranularity;
        //
        QueryLimit QueryLimit = new QueryLimit();

        QueryLimit.offset       = 0;
        QueryLimit.max_num_rows = 1;
        QueryLimit2 QueryLimit2 = new QueryLimit2();

        QueryLimit2.offset       = 0;
        QueryLimit2.max_num_rows = 1;
        Table Table = new Table();

        Table.query_limit = QueryLimit;
        Table2 Table2 = new Table2();

        Table2.query_limit = QueryLimit2;
        Inbound Inbound = new Inbound();

        Inbound.table = Table;
        Outbound Outbound = new Outbound();

        Outbound.table = Table2;
        DataINeed DataINeed = new DataINeed();

        DataINeed.inbound  = Inbound;
        DataINeed.outbound = Outbound;
        WebClient _webClient = new WebClient();

        _webClient.Headers.Add("Content-Type", "application/json");
        string data_requested = HttpUtility.UrlEncode(JsonConvert.SerializeObject(DataINeed));
        string rpt_json       = HttpUtility.UrlEncode(JsonConvert.SerializeObject(ReportDetails));
        string data           = "action=get&rm=report_api&data_requested=" + data_requested + "&rpt_json=" + rpt_json;

        string address      = "http://gh-scr-d01.diti.lr.net/fcgi/scrut_fcgi.fcgi";
        var    responseText = Encoding.Default.GetString(_webClient.UploadData(address, "POST", Encoding.Default.GetBytes(data)));

        Console.WriteLine(responseText);
    }
		}   // TestFormatItemCounters


		private static void ListAllErrors ( List<FormatStringError> plstAllErrors )
		{
			const int ORDINAL_FROM_SUBSCRIPT = ArrayInfo.INDEX_FROM_ORDINAL;
			const int POS_LABEL = ArrayInfo.ARRAY_FIRST_ELEMENT;
			const int POS_VALUE = ArrayInfo.ARRAY_SECOND_ELEMENT;
			const char DELIMITER = FormatStringError.LABEL_VALUE_DELIMITER;

			ReportDetail.DetailFormat = "{3}    {0} = {1}";

			int intErrorCount = plstAllErrors.Count;

			for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ;
					  intI < intErrorCount ;
					  intI++ )
			{
				FormatStringError fse = plstAllErrors [ intI ];
				string [ ] astrErrorDetails = fse.Split ( );
				int intNDetails = astrErrorDetails.Length;						// Save a trip into the collection.
				ReportDetails rptDtlsColl = new ReportDetails ( intNDetails );

				string [ ] astrErrorSummaryFirst = new string [ ]
                { 
                    string.Format (
                        Properties.Resources.MSG_FORMAT_ERROR_DETAILS ,			// Format template string
                        FormatItem.XofY (										// Format Item 0
                            intI + ORDINAL_FROM_SUBSCRIPT ,						//		X = Item Number
                            intErrorCount ) )									//		Y = Item Count
                };  // string [ ] astrErrorSummaryFirst

				//  ------------------------------------------------------------
				//  Maybe there is a better way to accompish this. Nevertheless,
				//  this method works for generating a completely blank string
				//  of a length that must be determined at runtime.
				//  ------------------------------------------------------------

				string [ ] astrErrorSummaryAllOthers = new string [ ]
                {
                    string.Empty.PadRight ( astrErrorSummaryFirst [ ArrayInfo.ARRAY_FIRST_ELEMENT ].Length )
                };  // string [ ] astrErrorSummaryAllOthers

				for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < intNDetails ; intJ++ )
				{
					string [ ] astrLabelAndValue = astrErrorDetails [ intJ ].Split ( DELIMITER );
					rptDtlsColl.Add (
						new ReportDetail (
							astrLabelAndValue [ POS_LABEL ].Trim ( ) ,								// Label (Format Item = 0)
							astrLabelAndValue [ POS_VALUE ].Trim ( ) ,								// Value (Format Item = 1) as String
							( ReportDetail.ItemDisplayOrder ) ArrayInfo.OrdinalFromIndex ( intJ ) ,	// Item Number (Format Item = 2) - The arithmetic operation casts it to int (signed), so it must be forcibly cast back to unsigned int.
							null ,																	// Individual Format String (Null = Use Default from static property)
							( intJ == ArrayInfo.ARRAY_FIRST_ELEMENT )								// Additional Details - Condition
								? astrErrorSummaryFirst												//		Value if Condition is True
								: astrErrorSummaryAllOthers ) );									//		Value if Condition is False
				}   // for ( uint uintJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; uintJ < intNDetails ; uintJ++ )

				rptDtlsColl.ListAllItems ( );
			}   // for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ; intI < intErrorCount ; intI++ )
		}   // ListAllErrors
 public MockReportGenerator()
 {
     defaultStudent = new Student {
         Name = "Jonatan Chrobak", Semester = 7, Group = 6, Section = 2, Major = "Informatyka", TypeOfStudies = "SSI"
     };
     defaultDetails = new ReportDetails {
         Subject = "Metod Statystycznych", TeacherName = "Krzysztof Pawelczyk", TopicNo = 18, LabDate = "Sroda, 13:15-14:45", DeadlineDate = new DateTime(2018, 6, 20)
     };
     template = new PdfDocument("C:\\Users\\Lenovo\\source\\repos\\ApiConcept\\ApiConcept\\Templates\\template.pdf");
 }
        public SessionDetails Get(string sessionId, bool detailed)
        {
            SessionController sessionController = new SessionController();

            ISession session = sessionController.GetSessionWithId(new SessionId(sessionId)).Result;

            SessionDetails retVal = new SessionDetails
            {
                Description = session.Description,
                SessionId   = session.SessionId.ToString(),
                StartTime   = session.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                EndTime     = session.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                Status      = session.Status
            };

            foreach (IDiagnoserSession diagSession in session.GetDiagnoserSessions())
            {
                DiagnoserSessionDetails diagSessionDetails = new DiagnoserSessionDetails
                {
                    Name            = diagSession.Diagnoser.Name,
                    CollectorStatus = diagSession.CollectorStatus,
                    AnalyzerStatus  = diagSession.AnalyzerStatus,
                };

                foreach (Log log in diagSession.GetLogs())
                {
                    LogDetails logDetails = new LogDetails
                    {
                        FileName                 = log.FileName,
                        RelativePath             = log.RelativePath,
                        FullPermanentStoragePath = log.FullPermanentStoragePath,
                        StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                    };

                    diagSessionDetails.AddLog(logDetails);
                }

                foreach (Report report in diagSession.GetReports())
                {
                    ReportDetails reportDetails = new ReportDetails
                    {
                        FileName                 = report.FileName,
                        RelativePath             = report.RelativePath,
                        FullPermanentStoragePath = report.FullPermanentStoragePath
                    };

                    diagSessionDetails.AddReport(reportDetails);
                }

                retVal.AddDiagnoser(diagSessionDetails);
            }

            return(retVal);
        }
        public ActionResult Create(ReportDetails reportDetails, HttpPostedFileBase Image)
        {
            reportDetails.Image = Image.FileName;
            string path = "~/images/" + Image.FileName;

            Image.SaveAs(Server.MapPath(path));

            db.ReportDetails.Add(reportDetails);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 void SetDataInternal(XtraReport report, string url, bool isNewOne)
 {
     if (!isNewOne && !Reports.ContainsKey(url))
     {
         throw new FaultException(new FaultReason(string.Format("Could not find report '{0}'.", url)), new FaultCode("Server"), "SetData");
     }
     using (var stream = new MemoryStream())
     {
         report.SaveLayoutToXml(stream);
         var reportLayout = stream.ToArray();
         var newReportDetails = new ReportDetails { DisplayName = url, Layout = reportLayout };
         Reports.AddOrUpdate(url, newReportDetails, (currentUrl, existingReport) => { existingReport.Layout = reportLayout; return existingReport; });
     }
 }
Exemple #13
0
        public ActionResult Details(string Id, double InnerRadius, double OuterRadius, string InnerColor, string OuterColor)
        {
            FinalView finalView = new FinalView();

            string[]      temp          = Id.Split('-');
            int           ReportId      = Convert.ToInt32(temp[1]);
            ReportDetails reportDetails = conn.SelectReportDetails("Select *from ReportDetails where Id = '" + ReportId + "'").FirstOrDefault();

            finalView.testImageList = conn.GetAllImage("Select *from TestImage where ReportId = '" + ReportId + "'");
            finalView.TestName      = reportDetails.TestName;
            finalView.InnerColor    = InnerColor;
            finalView.InnerRadius   = InnerRadius;
            finalView.OuterColor    = OuterColor;
            finalView.OuterRadius   = OuterRadius;
            return(View(finalView));
        }
Exemple #14
0
        public List <MonthReportSummaryViewModel> GetMonthlyReportDetailSummaryList(bool IsLatestVersion = false)
        {
            List <MonthReportSummaryViewModel> listMonthReportSummaryViewModel = new List <MonthReportSummaryViewModel>();
            MonthReportSummaryViewModel        mrsvm   = null;
            List <MonthlyReportDetail>         MRDList = ReportDetails.Where(p => p.SystemID == _System.ID && (p.Display == true)).ToList();
            List <C_TargetKpi> targetKpiList           = StaticResource.Instance.GetKpiList(_System.ID, FinYear);

            int i = 1;

            foreach (C_Target target in _Target.OrderBy(p => p.Sequence))
            {
                if (target.NeedReport == true)
                {
                    mrsvm                            = new MonthReportSummaryViewModel();
                    mrsvm.ID                         = i;
                    mrsvm.FinYear                    = FinYear;
                    mrsvm.TargetID                   = target.ID;
                    mrsvm.SystemID                   = target.SystemID;
                    mrsvm.TargetName                 = target.TargetName;
                    mrsvm.NPlanAmmount               = (double)(MRDList.Where(p => p.TargetID == target.ID).Sum(e => e.NPlanAmmount));
                    mrsvm.NActualAmmount             = (double)(MRDList.Where(p => p.TargetID == target.ID).Sum(e => e.NActualAmmount));
                    mrsvm.NDifference                = mrsvm.NActualAmmount - mrsvm.NPlanAmmount;
                    mrsvm.NAccumulativePlanAmmount   = (double)(MRDList.Where(p => p.TargetID == target.ID).Sum(e => e.NAccumulativePlanAmmount));
                    mrsvm.NAccumulativeActualAmmount = (double)(MRDList.Where(p => p.TargetID == target.ID).Sum(e => e.NAccumulativeActualAmmount));
                    mrsvm.NAccumulativeDifference    = mrsvm.NAccumulativeActualAmmount - mrsvm.NAccumulativePlanAmmount;
                    if (target.Configuration != null &&
                        target.Configuration.Element("SummaryTargetDisplay") != null &&
                        target.Configuration.Element("SummaryTargetDisplay").Attribute("ShowKpi") != null &&
                        target.Configuration.Element("SummaryTargetDisplay").Attribute("ShowKpi").Value.Trim().ToLower() == "true")
                    {
                        if (targetKpiList.Count > 0 && targetKpiList.Find(p => p.TargetID == target.ID) != null)
                        {
                            mrsvm.MeasureRate = Math.Round(targetKpiList.Find(p => p.TargetID == target.ID).MeasureRate * 100, 0, MidpointRounding.AwayFromZero).ToString() + "%";
                        }
                    }
                    else
                    {
                        mrsvm.MeasureRate1 = (double)Math.Round(StaticResource.Instance.GetTargetPlanList(_System.ID, FinYear).FindAll(P => P.TargetID == target.ID).Sum(P => P.Target), 7, MidpointRounding.AwayFromZero);
                        mrsvm.MeasureRate  = mrsvm.MeasureRate1.ToString();
                    }
                    listMonthReportSummaryViewModel.Add(TargetEvaluationEngine.TargetEvaluationService.SummaryCalculation(mrsvm));
                    i++;
                }
            }
            return(listMonthReportSummaryViewModel);
        }
        public override byte[] GetData(string url)
        {
            // Returns report layout data stored in a Report Storage using the specified URL.
            // This method is called only for valid URLs after the IsValidUrl method is called.           
            string[] urlParts = url.Split('?');
            string reportName = urlParts[0];

            var data = EmbeddedResourceReportStorage.GetData(reportName);
            if (data == null)
            {
                ReportDetails details = null;
                if (Reports.TryGetValue(reportName, out details))
                    data = details.Layout;
            }



            if (data != null)
            {
                if (urlParts.Length == 2)
                {
                    XtraReport report = new XtraReport();
                    report.LoadLayoutFromXml(new MemoryStream(data));

                    string[] parameterDefinitions = urlParts[1].Split('&');
                    foreach (string parameterDefinition in parameterDefinitions)
                    {
                        string[] keyValue = parameterDefinition.Split('=');
                        DevExpress.XtraReports.Parameters.Parameter parameter = report.Parameters[keyValue[0]];
                        parameter.Value = Convert.ChangeType(keyValue[1], parameter.Type);
                    }

                    using (MemoryStream ms = new MemoryStream())
                    {
                        report.SaveLayoutToXml(ms);
                        return ms.ToArray();
                    }
                }
                else
                    return data;
            }


            throw new FaultException(new FaultReason(string.Format("Could not find report '{0}'.", url)), new FaultCode("Server"), "GetData");
        }
Exemple #16
0
        public List <DiagnoserSessionDetails> Get(string sessionId, bool detailed)
        {
            SessionController sessionController = new SessionController();

            ISession session = sessionController.GetSessionWithId(new SessionId(sessionId)).Result;

            List <DiagnoserSessionDetails> retVal = new List <DiagnoserSessionDetails>();

            foreach (IDiagnoserSession diagSession in session.GetDiagnoserSessions())
            {
                DiagnoserSessionDetails tempSession = new DiagnoserSessionDetails
                {
                    Name            = diagSession.Diagnoser.Name,
                    CollectorStatus = diagSession.CollectorStatus,
                    AnalyzerStatus  = diagSession.AnalyzerStatus
                };
                foreach (Log log in diagSession.GetLogs())
                {
                    LogDetails temp = new LogDetails
                    {
                        FileName                 = log.FileName,
                        RelativePath             = log.RelativePath,
                        FullPermanentStoragePath = log.FullPermanentStoragePath,
                        StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                    };
                    tempSession.AddLog(temp);
                }
                foreach (Report report in diagSession.GetReports())
                {
                    ReportDetails temp = new ReportDetails
                    {
                        FileName                 = report.FileName,
                        RelativePath             = report.RelativePath,
                        FullPermanentStoragePath = report.FullPermanentStoragePath
                    };
                    tempSession.AddReport(temp);
                }

                retVal.Add(tempSession);
            }

            return(retVal);
        }
Exemple #17
0
        public JsonResult GetDetailReportDetails(ReportDetails reportDetails)
        {
            try
            {
                reportDetails.DateFrom = ConvertDate(reportDetails.DateFrom);
                reportDetails.DateTo   = ConvertDate(reportDetails.DateTo);
                ReportModel result = oReportManager.GetDetailReportDetails(reportDetails, CookieManager.GetCookie(CookieManager.CookieName).logindetail.EmpID);

                var jsonResult = Json(new { result }, JsonRequestBehavior.AllowGet);
                jsonResult.MaxJsonLength = int.MaxValue;
                DataTable table = ConvertToDataTable(result.ExcelReport);
                Session["DetailRpt"] = table;
                return(jsonResult);
            }
            catch
            {
                return(null);
            }
        }
Exemple #18
0
        /// <summary>
        /// Views the report.
        /// </summary>
        /// <param name="tmpReportDetails">The TMP report details.</param>
        public static void ViewReport(ReportDetails tmpReportDetails)
        {
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.EnableRaisingEvents = false;
            proc.StartInfo.FileName  = "iexplore";
            string queryString = "";

            queryString  = ConfigurationWrapper.ReportPath;
            queryString += tmpReportDetails.ReportFile;
            if (tmpReportDetails.OptionalReportParameter != null)
            {
                IDictionaryEnumerator en = tmpReportDetails.OptionalReportParameter.GetEnumerator();
                while (en.MoveNext())
                {
                    queryString += "&" + en.Key.ToString() + "=" + en.Value.ToString();
                }
            }

            proc.StartInfo.Arguments = ConfigurationWrapper.ReportViewerURL + "?" + queryString + "&rs:Command=Render";
            proc.Start();
        }
Exemple #19
0
        /// <summary>
        /// Opens the outlook with default default email client.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="reportPath">The report path.</param>
        /// <param name="reportDetails">The report details.</param>
        public static void OpenOutlook(string fileName, string reportPath, ReportDetails reportDetails)
        {
            string reportFilePath = Createpdf(fileName, reportPath, reportDetails);

            ////Commente by Biju on 27/Oct/2009 to implement outlook integration when Email button is clicked.

            ////StringBuilder mailstr = new StringBuilder();
            ////mailstr.Append("mailto:");
            ////mailstr.Append("&Attach=\"\"" + reportFilePath + "\"\"");
            ////Process emailProcess = new Process();
            ////emailProcess.StartInfo.FileName = mailstr.ToString();
            ////emailProcess.StartInfo.UseShellExecute = true;
            ////emailProcess.StartInfo.RedirectStandardOutput = false;
            ////emailProcess.Start();
            ////emailProcess.Dispose();

            ////Added by Biju on 27/Oct/2009 to implement outlook integration when Email button is clicked
            try
            {
                Outlook.ApplicationClass outlookApp = new Outlook.ApplicationClass();

                Outlook.MailItem outlookMail = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                if (outlookMail == null)
                {
                    MessageBox.Show("Error occured while accessing Outlook. Please try again!", "TerraScan - Outlook Emailing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                outlookMail.Attachments.Add(reportFilePath, Outlook.OlAttachmentType.olEmbeddeditem, 1, "Terrascan");
                outlookApp.Inspectors.Add(outlookMail);
                if (outlookApp.Inspectors.Count > 0)
                {
                    outlookApp.Inspectors[outlookApp.Inspectors.Count].Activate();
                    outlookApp.Inspectors[outlookApp.Inspectors.Count].WindowState = Outlook.OlWindowState.olMaximized;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "TerraScan - Outlook Emailing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            ////till here
        }
Exemple #20
0
        /// <summary>
        /// Get the Detail report details based on the report search parameter.
        /// </summary>
        /// <param name="reportDetails">object</param>
        /// <param name="loginUserId">string</param>
        /// <returns>object</returns>
        public ReportModel GetDetailReportDetails(ReportDetails reportDetails, string loginUserId)
        {
            ReportModel oReportModel = new ReportModel();

            try
            {
                using (var connection = Connection())
                {
                    var result = connection.QueryMultiple("Rpt_CIR_CIM_Detail", new
                    {
                        FormType    = reportDetails.RptType,
                        State       = reportDetails.StateId == null ? "0" : reportDetails.StateId,
                        Site        = reportDetails.SiteId == null ? "0" : reportDetails.SiteId,
                        TurbineType = reportDetails.TurbineTypeId == null ? "0" : reportDetails.TurbineTypeId,
                        Dept        = reportDetails.DptId == null ? "0" : reportDetails.DptId,
                        Turbine     = reportDetails.TbnId == null ? "0" : reportDetails.TbnId,
                        CStatus     = reportDetails.CStatusId == null ? "0" : reportDetails.CStatusId,
                        CId         = reportDetails.CIROrCIMNumber,
                        DateFrom    = reportDetails.DateFrom,
                        DateTo      = reportDetails.DateTo,
                        WONumber    = reportDetails.RptType == "1" ? "" : reportDetails.WONumber,
                        File        = reportDetails.File,
                        UId         = loginUserId,
                        DsgId       = reportDetails.DesignationId == null ? "0" : reportDetails.DesignationId,
                        EmpId       = reportDetails.EmployeeId
                    }, commandType: CommandType.StoredProcedure);
                    oReportModel.oMessage      = result.Read <Message>().FirstOrDefault();
                    oReportModel.DetailReports = result.Read <DetailReport>().ToList();
                    oReportModel.ExcelReport   = result.Read <ExcelDetailReport>().ToList();
                }
            }
            catch (Exception ex)
            {
                //SaveErrorMessageInFile(oErrorMessage = new ErrorMessage { UserId = loginUserId, ModuleName = "Report", MethodName = "GetDetailReportDetails", Exception = ex.Message });
                logger.Error(ex.Message);
            }
            return(oReportModel);
        }
Exemple #21
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);
        }
        public void Go ( )
        {
            switch ( _enmDataSource )
            {
                case DataSource.ArrayOfStrings:
                    UseInputFromStringArray ( );
                    break;  // case DataSource.ArrayOfStrings

                case DataSource.LinesInTextFile:
                    ReportDetails rpt = UseInputFromFile ( );
                    
                    foreach ( ReportDetail dtl in rpt )
                    {
                        Console.WriteLine ( dtl.FormatDetail ( ) );
                    }   // foreach ( ReportDetail dtl in rpt )
                    break;  // case DataSource.LinesInTextFile

                default:
                    Console.WriteLine (
                        SharedUtl4_TestStand.Properties.Resources.IDS_UNSUPPORTED_DATASOURCE ,
                        ( int ) _enmDataSource );
                    break;  // Default (else) case
            }   // switch ( _enmDataSource )
        }   // public void Go
Exemple #23
0
        public async void RefreshAllDatasets()
        {
            List <ReportDetails> reportDetailsList = new List <ReportDetails>();
            string        username      = "";
            string        roles         = "";
            var           result        = new EmbedConfig();
            ReportDetails reportDetails = new ReportDetails();

            try
            {
                result = new EmbedConfig {
                    Username = username, Roles = roles
                };
                var error = GetWebConfigErrors();
                if (error != null)
                {
                    result.ErrorMessage = error;
                    //return View(result);
                    return(null);
                }
                //azure key vault
                // Create a user password cradentials.
                var credential = new UserPasswordCredential(Username, Password);

                // Authenticate using created credentials
                var authenticationContext = new AuthenticationContext(AuthorityUrl);
                var authenticationResult  = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);

                if (authenticationResult == null)
                {
                    result.ErrorMessage = "Authentication Failed.";
                    //return View(result);
                    return(null);
                }

                var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

                // Create a Power BI Client object. It will be used to call Power BI APIs.
                using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
                {
                    // Get a list of reports.
                    var reports = await client.Reports.GetReportsInGroupAsync(GroupId);

                    for (int index = 0; index < reports.Value.Count; index++)
                    {
                        reportDetails = new ReportDetails();
                        Report report = reports.Value[index];

                        HttpWebRequest request;

                        var url = "https://api.powerbi.com/v1.0/myorg/groups/{0}/datasets/{1}/refreshes";
                        request = System.Net.HttpWebRequest.CreateHttp(String.Format(url, GroupId, report.DatasetId));

                        request.KeepAlive     = true;
                        request.Method        = "POST";
                        request.ContentLength = 0;

                        request.Headers.Add("Authorization", String.Format("Bearer {0}", authenticationResult.AccessToken));

                        using (Stream writer = request.GetRequestStream())
                        {
                            var response = (HttpWebResponse)request.GetResponse();
                            Console.WriteLine("Dataset refresh request{0}", response.StatusCode.ToString());
                        }

                        ////To Get History of Refresh
                        //using (var response = (HttpWebResponse)request.GetResponse())
                        //{
                        //    var responseString = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();
                        //    dynamic responseJson = JsonConvert.DeserializeObject<dynamic>(responseString);
                        //    foreach (var refresh in responseJson.value)
                        //    {
                        //        Console.WriteLine("Dataset {0} refreshed is {1}", report.DatasetId, refresh["status"]);
                        //        Console.WriteLine("StartTime at {0} EndTime at {1}", refresh["startTime"], refresh["endTime"]);
                        //    }
                    }//end for(int index=0; index< reports.Value.Count; index++)
                }
            }
            catch (HttpOperationException exc)
            {
                Console.log(exc.Message);
            }
            catch (Exception exc)
            {
                Console.log(exc.Message);
            }

            return(await GetAllReportsDetails());
        }
        public HttpResponseMessage Get(string type, bool detailed)
        {
            List <SessionDetails> retVal = new List <SessionDetails>();

            try
            {
                SessionController sessionController = new SessionController();

                IEnumerable <Session> sessions;

                switch (type.ToLowerInvariant())
                {
                case "all":
                    sessions = sessionController.GetAllSessions();
                    break;

                case "pending":
                    sessions = sessionController.GetAllActiveSessions();
                    break;

                case "needanalysis":
                    sessions = sessionController.GetAllUnanalyzedSessions();
                    break;

                case "complete":
                    sessions = sessionController.GetAllCompletedSessions();
                    break;

                default:
                    sessions = sessionController.GetAllSessions();
                    break;
                }

                IEnumerable <Session> sortedSessions = sessions.OrderByDescending(p => p.StartTime);

                foreach (Session session in sortedSessions)
                {
                    SessionDetails sessionDetails = new SessionDetails
                    {
                        Description   = session.Description,
                        SessionId     = session.SessionId.ToString(),
                        StartTime     = session.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        EndTime       = session.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        Status        = session.Status,
                        HasBlobSasUri = !string.IsNullOrWhiteSpace(session.BlobSasUri)
                    };

                    foreach (DiagnoserSession diagSession in session.GetDiagnoserSessions())
                    {
                        DiagnoserSessionDetails diagSessionDetails = new DiagnoserSessionDetails
                        {
                            Name                    = diagSession.Diagnoser.Name,
                            CollectorStatus         = diagSession.CollectorStatus,
                            AnalyzerStatus          = diagSession.AnalyzerStatus,
                            CollectorStatusMessages = diagSession.CollectorStatusMessages,
                            AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
                        };

                        foreach (String analyzerError in diagSession.GetAnalyzerErrors())
                        {
                            diagSessionDetails.AddAnalyzerError(analyzerError);
                        }

                        foreach (String collectorError in diagSession.GetCollectorErrors())
                        {
                            diagSessionDetails.AddCollectorError(collectorError);
                        }

                        int minLogRelativePathSegments = Int32.MaxValue;

                        double logFileSize = 0;
                        foreach (Log log in diagSession.GetLogs())
                        {
                            logFileSize += log.FileSize;
                            LogDetails logDetails = new LogDetails
                            {
                                FileName                 = log.FileName,
                                RelativePath             = log.RelativePath,
                                FullPermanentStoragePath = log.FullPermanentStoragePath,
                                StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                            };

                            int relativePathSegments = logDetails.RelativePath.Split('\\').Length;

                            if (relativePathSegments == minLogRelativePathSegments)
                            {
                                logDetails.RelativePath = logDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.AddLog(logDetails);
                            }
                            else if (relativePathSegments < minLogRelativePathSegments)
                            {
                                minLogRelativePathSegments = relativePathSegments;
                                logDetails.RelativePath    = logDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.ClearReports();
                                diagSessionDetails.AddLog(logDetails);
                            }
                        }
                        sessionDetails.LogFilesSize = logFileSize;

                        int minReportRelativePathSegments = Int32.MaxValue;
                        foreach (Report report in diagSession.GetReports())
                        {
                            ReportDetails reportDetails = new ReportDetails
                            {
                                FileName                 = report.FileName,
                                RelativePath             = report.RelativePath,
                                FullPermanentStoragePath = report.FullPermanentStoragePath
                            };

                            int relativePathSegments = reportDetails.RelativePath.Split('\\').Length;

                            if (relativePathSegments == minReportRelativePathSegments)
                            {
                                reportDetails.RelativePath = reportDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.AddReport(reportDetails);
                            }
                            else if (relativePathSegments < minReportRelativePathSegments)
                            {
                                minReportRelativePathSegments = relativePathSegments;
                                reportDetails.RelativePath    = reportDetails.RelativePath.Replace('\\', '/');
                                diagSessionDetails.ClearReports();
                                diagSessionDetails.AddReport(reportDetails);
                            }
                        }

                        sessionDetails.AddDiagnoser(diagSessionDetails);
                    }

                    retVal.Add(sessionDetails);
                }
            }
            catch (Exception ex)
            {
                Logger.LogErrorEvent("Encountered exception while getting sessions from file", ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, $"Encountered exception {ex.Message} while getting sessions from file"));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }
Exemple #25
0
        /// <summary>
        /// Initial the Data Source of MonthReport and MonthlyReportDetail.
        /// if IsLatestVersion is true, the data source will be B_ table  and WFStatus == Progress.
        /// otherwise, the data source is A_ atble
        /// </summary>
        /// <param name="IsLatestVersion">if the data source should be  B_ Table</param>
        void InitialData(bool IsLatestVersion, bool IsAll)
        {
            if (IsLatestVersion)
            {
                if (LastestMonthlyReport != null)
                {
                    Report = LastestMonthlyReport.ToVModel();
                    if (_MonthReportID == Guid.Empty)
                    {
                        _MonthReportID = Report.ID;
                    }
                }
                ReportDetails = new List <MonthlyReportDetail>();

                if (DataSource == "Draft")
                {
                    ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Draft(_System.ID, FinYear, FinMonth, _MonthReportID, TargetPlanID, _SystemBatchID, IsAll);
                }
                else
                {
                    ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Approve(_System.ID, FinYear, FinMonth, _MonthReportID, TargetPlanID, _SystemBatchID, IsAll);
                }

                //LastestMonthlyReportDetails.ForEach(P => ReportDetails.Add(P.ToVModel()));
            }
            else
            {
                if (ValidatedMonthlyReport != null)
                {
                    Report = ValidatedMonthlyReport.ToVModel();
                    if (_MonthReportID == Guid.Empty)
                    {
                        _MonthReportID = Report.ID;
                    }
                }
                ReportDetails = new List <MonthlyReportDetail>();
                ReportDetails = A_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Result(_System.ID, FinYear, FinMonth, TargetPlanID);

                //ValidatedMonthlyReportDetails.ForEach(P => ReportDetails.Add(P.ToVModel()));
            }

            if (UserPermission)
            {
                //筛选当前用户有权限的项目公司信息(因为权限数据缺失暂时注释)
                var companyIDArray = BLL.BizBLL.S_OrganizationalActionOperator.Instance.GetUserCompanyDataNoIsDelete(_System.ID, CurrentLoginName).Select(m => m.ID).ToArray();
                if (companyIDArray.Length > 0)
                {
                    ReportDetails = ReportDetails.Where(m => companyIDArray.Contains(m.CompanyID)).ToList();
                    if (ReportDetails.Any())
                    {
                        _MonthReportID = ReportDetails[0].MonthlyReportID;
                        if (IsLatestVersion)
                        {
                            _LastestMonthlyReport = B_MonthlyreportOperator.Instance.GetMonthlyreport(ReportDetails[0].MonthlyReportID);
                            Report = LastestMonthlyReport.ToVModel();
                        }
                        else
                        {
                            _ValidatedMonthlyReport = A_MonthlyreportOperator.Instance.GetMonthlyreport(ReportDetails[0].MonthlyReportID);
                            Report = ValidatedMonthlyReport.ToVModel();
                        }
                    }
                }
                else
                {
                    ReportDetails = new List <MonthlyReportDetail>();
                }
            }
        }
        public DiagnoserSessionDetails Get(string sessionId, string diagnoser, bool detailed)
        {
            SessionController sessionController = new SessionController();

            Session session = sessionController.GetSessionWithId(new SessionId(sessionId));

            DiagnoserSession diagSession = session.GetDiagnoserSessions().First(p => p.Diagnoser.Name.Equals(diagnoser, StringComparison.OrdinalIgnoreCase));

            DiagnoserSessionDetails retVal = new DiagnoserSessionDetails
            {
                Name                    = diagSession.Diagnoser.Name,
                CollectorStatus         = diagSession.CollectorStatus,
                AnalyzerStatus          = diagSession.AnalyzerStatus,
                CollectorStatusMessages = diagSession.CollectorStatusMessages,
                AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
            };

            foreach (String analyzerError in diagSession.GetAnalyzerErrors())
            {
                retVal.AddAnalyzerError(analyzerError);
            }

            foreach (String collectorError in diagSession.GetCollectorErrors())
            {
                retVal.AddCollectorError(collectorError);
            }

            int minLogRelativePathSegments = Int32.MaxValue;

            foreach (Log log in diagSession.GetLogs())
            {
                LogDetails temp = new LogDetails
                {
                    FileName                 = log.FileName,
                    RelativePath             = log.RelativePath,
                    FullPermanentStoragePath = log.FullPermanentStoragePath,
                    StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                };

                int relativePathSegments = temp.RelativePath.Split('\\').Length;

                if (relativePathSegments == minLogRelativePathSegments)
                {
                    temp.RelativePath = temp.RelativePath.Replace('\\', '/');
                    retVal.AddLog(temp);
                }
                else if (relativePathSegments < minLogRelativePathSegments)
                {
                    minLogRelativePathSegments = relativePathSegments;
                    temp.RelativePath          = temp.RelativePath.Replace('\\', '/');
                    retVal.ClearReports();
                    retVal.AddLog(temp);
                }
            }

            int minReportRelativePathSegments = Int32.MaxValue;

            foreach (Report report in diagSession.GetReports())
            {
                ReportDetails temp = new ReportDetails
                {
                    FileName                 = report.FileName,
                    RelativePath             = report.RelativePath,
                    FullPermanentStoragePath = report.FullPermanentStoragePath
                };

                int relativePathSegments = temp.RelativePath.Split('\\').Length;

                if (relativePathSegments == minReportRelativePathSegments)
                {
                    temp.RelativePath = temp.RelativePath.Replace('\\', '/');
                    retVal.AddReport(temp);
                }
                else if (relativePathSegments < minReportRelativePathSegments)
                {
                    minReportRelativePathSegments = relativePathSegments;
                    temp.RelativePath             = temp.RelativePath.Replace('\\', '/');
                    retVal.ClearReports();
                    retVal.AddReport(temp);
                }
            }

            return(retVal);
        }
Exemple #27
0
        public HttpResponseMessage Get(string sessionId, bool detailed)
        {
            SessionDetails retVal = new SessionDetails();

            try
            {
                SessionController sessionController = new SessionController();

                Session session = sessionController.GetSessionWithId(new SessionId(sessionId));

                retVal.Description   = session.Description;
                retVal.SessionId     = session.SessionId.ToString();
                retVal.StartTime     = session.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                retVal.EndTime       = session.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                retVal.Status        = session.Status;
                retVal.HasBlobSasUri = !string.IsNullOrWhiteSpace(session.BlobSasUri);


                foreach (DiagnoserSession diagSession in session.GetDiagnoserSessions())
                {
                    DiagnoserSessionDetails diagSessionDetails = new DiagnoserSessionDetails
                    {
                        Name                    = diagSession.Diagnoser.Name,
                        CollectorStatus         = diagSession.CollectorStatus,
                        AnalyzerStatus          = diagSession.AnalyzerStatus,
                        CollectorStatusMessages = diagSession.CollectorStatusMessages,
                        AnalyzerStatusMessages  = diagSession.AnalyzerStatusMessages
                    };

                    foreach (String analyzerError in diagSession.GetAnalyzerErrors())
                    {
                        diagSessionDetails.AddAnalyzerError(analyzerError);
                    }

                    foreach (String collectorError in diagSession.GetCollectorErrors())
                    {
                        diagSessionDetails.AddCollectorError(collectorError);
                    }

                    int minLogRelativePathSegments = Int32.MaxValue;

                    double logFileSize = 0;
                    foreach (Log log in diagSession.GetLogs())
                    {
                        logFileSize += log.FileSize;
                        LogDetails logDetails = new LogDetails
                        {
                            FileName                 = log.FileName,
                            RelativePath             = log.RelativePath,
                            FullPermanentStoragePath = log.FullPermanentStoragePath,
                            StartTime                = log.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            EndTime = log.EndTime.ToString("yyyy-MM-dd HH:mm:ss")
                        };

                        int relativePathSegments = logDetails.RelativePath.Split('\\').Length;

                        if (relativePathSegments == minLogRelativePathSegments)
                        {
                            logDetails.RelativePath = logDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.AddLog(logDetails);
                        }
                        else if (relativePathSegments < minLogRelativePathSegments)
                        {
                            minLogRelativePathSegments = relativePathSegments;
                            logDetails.RelativePath    = logDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.ClearReports();
                            diagSessionDetails.AddLog(logDetails);
                        }
                    }
                    retVal.LogFilesSize = logFileSize;

                    int minReportRelativePathSegments = Int32.MaxValue;
                    foreach (Report report in diagSession.GetReports())
                    {
                        ReportDetails reportDetails = new ReportDetails
                        {
                            FileName                 = report.FileName,
                            RelativePath             = report.RelativePath,
                            FullPermanentStoragePath = report.FullPermanentStoragePath
                        };

                        int relativePathSegments = reportDetails.RelativePath.Split('\\').Length;

                        if (relativePathSegments == minReportRelativePathSegments)
                        {
                            reportDetails.RelativePath = reportDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.AddReport(reportDetails);
                        }
                        else if (relativePathSegments < minReportRelativePathSegments)
                        {
                            minReportRelativePathSegments = relativePathSegments;
                            reportDetails.RelativePath    = reportDetails.RelativePath.Replace('\\', '/');
                            diagSessionDetails.ClearReports();
                            diagSessionDetails.AddReport(reportDetails);
                        }
                    }

                    retVal.AddDiagnoser(diagSessionDetails);
                }
            }
            catch (FileNotFoundException fex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, fex.Message));
            }
            catch (Exception ex)
            {
                Logger.LogSessionErrorEvent("Encountered exception while getting session", ex, sessionId);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, retVal));
        }
        public MemoryStream FillReport(Student student, ReportDetails details)
        {
            List <string> tagsToFind = new List <string>()
            {
                "$subject", "$topicno", "$author", "$teacher", "$year", "$major", "$typeofstudies", "$semester", "$labdate", "$group", "$section", "$deadlinedate", "$returneddate"
            };

            foreach (String tag in tagsToFind)
            {
                PdfPageBase page     = template.Pages[0];
                PdfTextFind location = page.FindText(tag, TextFindParameter.None)?.Finds[0];
                if (location != null)
                {
                    string          replacement;
                    PdfTrueTypeFont font;
                    switch (tag)
                    {
                    case "$subject": replacement = details.Subject;
                        font = new PdfTrueTypeFont(new Font("Calibri", 18f, FontStyle.Bold)); break;

                    case "$topicno": replacement = details.TopicNo.ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 18f, FontStyle.Regular)); break;

                    case "$author": replacement = student.Name;
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$teacher": replacement = details.TeacherName;
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$year": replacement = DateTime.Now.Month < 10 ? (DateTime.Now.Year - 1).ToString() + "/" + DateTime.Now.Year.ToString() : DateTime.Now.Year.ToString() + "/" + (DateTime.Now.Year + 1).ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$major": replacement = student.Major;
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$typeofstudies": replacement = student.TypeOfStudies;
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$semester": replacement = student.Semester.ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$labdate": replacement = details.LabDate.ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$group": replacement = student.Group.ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$section": replacement = student.Section.ToString();
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$deadlinedate": replacement = details.DeadlineDate.ToString("dd/MM/yy");
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    case "$returneddate": replacement = DateTime.Now.ToString("dd/MM/yy");
                        font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Regular)); break;

                    default: replacement = "ERROR"; font = new PdfTrueTypeFont(new Font("Calibri", 12f, FontStyle.Underline)); break;
                    }
                    RectangleF rec = location.Bounds;
                    page.Canvas.DrawRectangle(PdfBrushes.White, rec);
                    page.Canvas.DrawString(replacement, font, PdfBrushes.Black, new PointF(rec.Left, rec.Top - 3f));
                }
            }
            //template.SaveToFile("C:\\Users\\Lenovo\\source\\repos\\ApiConcept\\ApiConcept\\Templates\\report.pdf");

            MemoryStream stream = new MemoryStream();

            template.SaveToStream(stream);
            return(stream);
        }
Exemple #29
0
        public async Task <ApiResponse <IEnumerable <UploadItem> > > GetJourneyReportsAsync(string vehicleId, string journeyId, ReportDetails reportDetails)
        {
            if (vehicleId == null)
            {
                throw new ArgumentNullException(nameof(vehicleId));
            }
            if (journeyId == null)
            {
                throw new ArgumentNullException(nameof(journeyId));
            }
            if (reportDetails == null)
            {
                throw new ArgumentNullException(nameof(reportDetails));
            }

            return(await DoApiRequestAsync <IEnumerable <UploadItem> >($"vehicles/{vehicleId}/journeys/{journeyId}/reports", HttpMethod.Post, reportDetails));
        }
 public MemoryStream GenerateCleanReport(Student student, ReportDetails details)
 {
     return(FillReport(student, details));
 }