Exemplo n.º 1
0
        private string GetReportTemplate(ConfigParamModel form, FormCollection formData)
        {
            string reportdata = string.Empty;

            DBHelper db   = new DBHelper();
            string   json = db.GetReportTemplate();

            dynamic jsonObj = JsonConvert.DeserializeObject(json);

            reportdata = "<br/>Name : " + jsonObj["Title"] +
                         "<br/>Description : " + jsonObj["Description"];

            return(reportdata);
        }
Exemplo n.º 2
0
        public ActionResult Explorer()
        {
            TabDetailModel tabDetail = getTabDetails();

            ViewBag.TabHeaderHtml          = tabDetail.tabHeaderHtml;
            ViewBag.TabContentHtml         = tabDetail.tabContentHtml;
            ViewBag.TabNodes               = tabDetail.tabnodes;
            ViewBag.TreeViewPLMNObjectData = GetPLMNObjectData();
            ViewBag.ReportExcelDatajson    = JsonConvert.SerializeObject(new List <Report_ExcelData>());

            ConfigParamModel model = new ConfigParamModel();

            model.FromDate = DateTime.Now.AddDays(-7);
            model.ToDate   = DateTime.Now;

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Calculate(ConfigParamModel form, FormCollection formData)
        {
            ConfigParamModel model = new ConfigParamModel();

            if (form.ReportType.ToLower() == "geo")
            {
                model.GeoReportData = CalculateGeoReports(form, formData);
            }
            else if (form.ReportType.ToLower() == "reports")
            {
                model.ReportExcelData = CalculateReports(form, formData);
            }
            else
            {
                model.GeoReportData = GetReportTemplate(form, formData);
            }

            //return View();
            //return null;

            //return new EmptyResult();
            //return File(Encoding.UTF8.GetBytes(sb.ToString()), "text/csv", "Ericsson.csv");
            //return File(@"D:\weekly_reports\$2020_$06_$03_Cluster daily.ttr", "text/plain");
            //return File(@"D:\weekly_reports\2020_05_26_Cluster daily.ttr", "text/plain", "ClusterReport.ttr");

            //return File(@"D:\weekly_reports\2020_05_26_Cluster daily.ttr", "text/plain", "ClusterReport.ttr");

            TabDetailModel tabDetail = getTabDetails();

            ViewBag.TabHeaderHtml          = tabDetail.tabHeaderHtml;
            ViewBag.TabContentHtml         = tabDetail.tabContentHtml;
            ViewBag.TabNodes               = tabDetail.tabnodes;
            ViewBag.TreeViewPLMNObjectData = GetPLMNObjectData();

            model.FromDate = DateTime.Now.AddDays(-7);
            model.ToDate   = DateTime.Now;

            return(View("Explorer", model));
            //return File("D:\\weekly_reports\\tmp.txt", "text/plain");

            //return new HttpStatusCodeResult(204);
        }
Exemplo n.º 4
0
        private string CalculateGeoReports(ConfigParamModel form, FormCollection formData)
        {
            string reportdata = string.Empty;

            string exePath            = ConfigurationManager.AppSettings["GeoExePath"];
            string jsonConfigPath     = ConfigurationManager.AppSettings["GeoJsonConfigPath"];
            string tempJsonConfigPath = ConfigurationManager.AppSettings["tempJsonConfigPath"];

            DateTime currdt                = DateTime.Now;
            string   strTimeStamp          = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_ffff_");
            string   newtempJsonConfigPath = tempJsonConfigPath + strTimeStamp + form.ReportType.ToLower() + "_tmp" + ".json";
            string   ttgOutputFilePath     = string.Empty;
            string   ttgOutputFileName     = strTimeStamp + form.ReportName + ".ttg";
            string   excelOutputFilePath   = string.Empty;
            string   excelOutputFileName   = strTimeStamp + "report_dashboard.xlsx";
            string   excelsheetName        = string.Empty;

            try
            {
                //create temp json file with changed values
                string  json    = System.IO.File.ReadAllText(jsonConfigPath);
                dynamic jsonObj = JsonConvert.DeserializeObject(json);

                ttgOutputFilePath = jsonObj["GeoReports"][0]["OutputFile"].ToString() + ttgOutputFileName;
                ////excelOutputFilePath = jsonObj["Export"]["XlsxOutput"]["OutputFile"].ToString() + excelOutputFileName;
                //excelOutputFilePath = jsonObj["XlsxOutput"]["OutputFile"].ToString() + excelOutputFileName;
                //excelsheetName = jsonObj["Reports"][0]["XlsxWorkSheet"].ToString();
                if (form.FromDate != null)
                {
                    jsonObj["GeoReports"][0]["Pixmaps"][0]["TimeFrom"] = form.FromDate.Value.ToString("yyyy-MM-dd 00:00:00");
                }
                if (form.ToDate != null)
                {
                    jsonObj["GeoReports"][0]["Pixmaps"][0]["TimeTo"] = form.ToDate.Value.ToString("yyyy-MM-dd 00:00:00");
                }
                jsonObj["GeoReports"][0]["Pixmaps"][0]["Name"]                        = form.ReportName;
                jsonObj["GeoReports"][0]["Pixmaps"][0]["PixelSizeMeters"]             = form.PixelSizeMeters;
                jsonObj["GeoReports"][0]["Pixmaps"][0]["ObjectAttrFilter"]["EUARFCN"] = form.EUARFCN;
                jsonObj["GeoReports"][0]["Path"]       = form.Path;
                jsonObj["GeoReports"][0]["OutputFile"] = ttgOutputFilePath;

                ////jsonObj["Reports"][0]["Objects"] = JsonConvert.SerializeObject(form.PLMNObjects.Split(','));
                //jsonObj["Reports"][0]["Objects"] = Newtonsoft.Json.Linq.JToken.FromObject(form.PLMNObjects.Split(','));

                ////jsonObj["Export"]["XlsxOutput"]["OutputFile"] = excelOutputFilePath;
                //jsonObj["XlsxOutput"]["OutputFile"] = excelOutputFilePath;

                string output = JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);

                System.IO.File.WriteAllText(newtempJsonConfigPath, output);
                //create temp json file with changed values

                Process myProcess = new Process();
                myProcess.StartInfo.UseShellExecute = false;
                myProcess.StartInfo.FileName        = exePath;
                //myProcess.StartInfo.Arguments = "\"" + jsonConfigPath + "\"";
                myProcess.StartInfo.Arguments      = "-c " + newtempJsonConfigPath;
                myProcess.StartInfo.CreateNoWindow = true;
                myProcess.Start();

                System.Threading.Thread.Sleep(2000);

                DeleteFile(newtempJsonConfigPath);
            }
            catch (Exception ex)
            {
                DeleteFile(newtempJsonConfigPath);
                throw ex;
            }

            //if (!string.IsNullOrEmpty(excelOutputFilePath) && !string.IsNullOrEmpty(excelsheetName))
            //{
            //    //List<Report_ExcelData> dataList = ReadDataFromExcel(excelOutputFilePath, excelsheetName);

            //    //SaveReportExcelData(dataList);

            //    //ViewBag.ReportExcelDatajson = JsonConvert.SerializeObject(dataList);

            //    reportdata = ReadDataFromExcel(excelOutputFilePath, excelsheetName, ttrOutputFilePath);

            //}

            reportdata = ttgOutputFilePath;

            return(reportdata);
        }