public ActionResult Reports()
        {
            var model = new ReportsModel();

            var startDate = new DateTime(2013, 4, 30).AddDays(-7);   // In real app change to DateTime.Now.AddDays(-7);

            model.TotalRevenues    = (double?)ParticipantContext.Orders.Sum("TotalPrice");
            model.LastWeekRevenues = (double?)ParticipantContext.Orders.Sum("TotalPrice", where : "OrderDate > @0", parms: startDate);

            model.ProductCount = ParticipantContext.Products.Count();
            model.UserCount    = ParticipantContext.Users.Count();
            model.OrderCount   = ParticipantContext.Orders.Count();

            return(View(model));
        }
        private void Show_Report(object sender, EventArgs e)
        {
            if (sender is Image image)
            {
                ReportsModel reportsModel = (ReportsModel)image.BindingContext;
                _LabResultPageVM.ShowReport(reportsModel);
                //if (!String.IsNullOrEmpty(reportsModel.ASREF))
                //{

                //    App.Current.MainPage.Navigation.PushAsync(new PdfPage(reportsModel));
                //}
                //else
                //{
                //    MaterialDialog.Instance.AlertAsync("Report not available");
                //}
            }
        }
Пример #3
0
        protected void FillReportsGrid()
        {
            var entities = (from n in DataContext.LP_Reports
                            where n.DateDeleted == null && n.CategoryID == CategoryID
                            orderby n.DateCreated descending
                            select n).ToList();

            var converter = new ReportEntityModelConverter(DataContext);

            var models = entities.Select(n => converter.Convert(n)).ToList();

            var model = new ReportsModel {
                List = models
            };

            reportsControl.Model = model;
        }
        private void Report_IsChecked(object sender, EventArgs e)
        {
            ReportsModel reportsModel = null;

            if (sender is CustomLabelRegular customLabel)
            {
                reportsModel = (ReportsModel)customLabel.BindingContext;
            }


            if (sender is Image image)
            {
                reportsModel = (ReportsModel)image.BindingContext;
            }


            _LabResultPageVM.CheckByImplementation(reportsModel);
        }
        /// <summary>
        /// Populate all filter value on page load
        /// </summary>
        /// <param name="reportSearch"></param>
        /// <returns></returns>
        public ActionResult Reports(ReportSearch reportSearch)
        {
            if (TempData["ErrorMsg"] != null)
            {
                ViewBag.ErrorMsg = TempData["ErrorMsg"];
            }

            ReportsModel        reportModel = new ReportsModel();
            ExportReportService _report     = new ExportReportService();
            //reportModel.Name = Session["Name"].ToString();
            var searchValues = _report.GetSearchValues();

            reportModel.ReportSearch.ContentDistributors       = searchValues.ContentDistributors;
            reportModel.ReportSearch.ContentProviders          = searchValues.ContentProviders;
            reportModel.ReportSearch.LocalEdits                = searchValues.LocalEdits;
            reportModel.ReportSearch.AnnouncementProcessedDate = searchValues.AnnouncementProcessedDate;

            return(View(reportModel));
        }
Пример #6
0
        /// <summary>
        /// 导出CSV
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult ExportToExcel(ReportsModel model)
        {
            try
            {
                ReportsExportServices repSvr = new ReportsExportServices();
                switch (model.ReportType)
                {
                case 1:    //Sales by Channel
                    return(this.ExcelCsv(repSvr.ExportReportByChannelList(model), "Sales_By_Channel.csv", "application/ms-txt"));

                case 2:    //Sales by Product
                    return(this.ExcelCsv(repSvr.ExportReportByProductList(model), "Sales_By_Product.csv", "application/ms-txt"));

                //break;
                case 3:    //Product Development Report
                    return(this.ExcelCsv(repSvr.ExportReportDevList(model), "Product_Development_Report.csv", "application/ms-txt"));

                case 4:    //Low Inventory Report
                    // string sFormat4 = model.StartTime.ToString("yyyy-MM-dd") + "--" + model.EndTime.ToString("yyyy-MM-dd");
                    return(this.ExcelCsv(repSvr.ExportReportLowInventoryList(model), "Low_Inventory_Report.csv", "application/ms-txt"));

                case 5:    //Sales by HMNUM
                    return(this.ExcelCsv(repSvr.ExportReportByHMList(model), "Sales_By_HMNUM.csv", "application/ms-txt"));

                case 6:    //Low Inventory Report BY SKU
                    return(this.ExcelCsv(repSvr.ExportReportLowInventoryBySKUList(model), "Low_Inventory_Report_By_SKU.csv", "application/ms-txt"));

                case 7:    //Cost Margin By Product Reports
                    return(this.ExcelCsv(repSvr.ExportReportCost_Margin_By_Product(model), "Cost_Margin_By_Product.csv", "application/ms-txt"));

                default:

                    break;
                }
            }
            catch (Exception ex)
            {
                NBCMSLoggerManager.Error("Message:" + ex.Message);
                NBCMSLoggerManager.Error("Source:" + ex.Source);
                NBCMSLoggerManager.Error("StackTrace:" + ex.StackTrace);
            }
            return(this.ExcelCsv("There is a error has been occur   please contact administrator".ToString(), "Error.csv", "application/ms-txt"));
        }
Пример #7
0
        [HttpPost] public ActionResult RmeWisePerformanceReports(int rm, int pm, int eme, DateTime fromDate, DateTime toDate)
        {
            var repmodels = new List <ReportsModel>();

            var dtgetEMEDetails = _helper.ExecuteSelectStmtForDateTime("rmpmeme_wise_performance_report", "@sdate", fromDate.ToShortDateString(), "@edate", toDate.ToShortDateString(), null, null, "@emeid", rm.ToString(), "@pmid", pm.ToString(), "@rmid", eme.ToString());

            foreach (DataRow row in dtgetEMEDetails.Rows)
            {
                if (row != null)
                {
                    var reports = new ReportsModel {
                        JobCardNumber = Convert.ToInt32(row["JOBCARDNO"]), WorkShopName = row["WORKSHOP"].ToString(), District = row["DISTRICT"].ToString(), VehicleNumber = row["VEHICLENUMBER"].ToString(), DOR = Convert.ToDateTime(row["DATEOFREPAIR"]), DOD = Convert.ToDateTime(row["DATEOFDELIVERY"]), Aggregate = row["AGGRIGATENAME"].ToString(), ServiceIncharge = row["SERVICEINCHARGE"].ToString(), Status = row["STATUS"].ToString(), Mechanic = row["MECHANIC"].ToString(), Category = row["CATEGORIES"].ToString(), SubCategory = row["SUBCATEGORY"].ToString()
                    };
                    repmodels.Add(reports);
                }
            }

            Session["PerformanceReports"] = repmodels;
            return(RedirectToAction("RmeWisePerformanceReport"));
        }
Пример #8
0
        // GET: Reports/Reports/BannedPictures
        public ActionResult BannedPictures()
        {
            ReportsModel model = new ReportsModel();
            // List<ReportsModel> reportsList = new List<ReportsModel>();
            List <BanType> BanTypeList = new List <BanType>();

            actionResult = reportsAction.Ban_Types();

            if (actionResult.IsSuccess)
            {
                BanTypeList = (from DataRow row in actionResult.dtResult.Rows
                               select new BanType
                {
                    Text = row["Description"] != DBNull.Value ? row["Description"].ToString() : "",
                    Value = row["Description"] != DBNull.Value ? row["Description"].ToString() : ""
                }).ToList();
            }
            model.BanTypeList = BanTypeList;

            return(View(model));
        }
        public ActionResult Index(ReportsModel record)
        {
            using (SqlConnection con = new SqlConnection(Helper.GetCon()))
            {
                con.Open();
                string query = @"INSERT INTO crime_reports(Time,longitude, latitude, incident_details,users,crimetype) 
                                VALUES (@Date,  @longitude, @latitude, @incident_details,@users, @CrimeType)";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    cmd.Parameters.AddWithValue("@Date", DateTime.Now);
                    cmd.Parameters.AddWithValue("@longitude", record.longitude);
                    cmd.Parameters.AddWithValue("@latitude", record.latitude);
                    cmd.Parameters.AddWithValue("@incident_details", record.incident_details);

                    cmd.Parameters.AddWithValue("@CrimeType", record.CrimeTypeId);

                    cmd.Parameters.AddWithValue("@users", 1);
                    cmd.ExecuteNonQuery();
                }
            }
            return(RedirectToAction("Index"));
        }
Пример #10
0
        public ActionResult GenerateReport(string ProjectID, string TaskStatus, string TaskType, string FromDate, string ToDate)
        {
            //get report data from the api and add it to model object
            ReportsModel objreportdata = BindReportData();
            ReportDTO    objreportdto  = new ReportDTO {
                ProjectID = Convert.ToInt32(ProjectID), TaskStatusID = Convert.ToInt32(TaskStatus), TaskTypeID = Convert.ToInt32(TaskType), FromDate = Convert.ToDateTime(FromDate), ToDate = Convert.ToDateTime(ToDate)
            };
            CustomResponse       response    = APICalls.Post("projectreportapi/Post", objreportdto);
            JavaScriptSerializer serializer1 = new JavaScriptSerializer();

            if (response.Response != null)
            {
                var reportdata = response.Response.ToString();
                List <ReportData> projectsinfo = serializer1.Deserialize <List <ReportData> >(reportdata);
                objreportdata.ReportData = projectsinfo;
            }
            //pre populate selected project
            objreportdata.TaskStatusDDl.Find(x => x.Value == TaskStatus).Selected = true;
            objreportdata.TaskTypeDDl.Find(x => x.Value == TaskType).Selected     = true;
            objreportdata.ProjectsDDl.Find(x => x.Value == ProjectID).Selected    = true;
            return(View("Home", objreportdata));
        }
        public List <ReportsModel> LKU_Reports_Active()
        {
            List <ReportsModel> lst = new List <ReportsModel>();
            SqlCommand          cmd = new SqlCommand();
            SqlDataReader       rdr = default(SqlDataReader);

            SqlConnection conn = new SqlConnection(STRATIXDataConnString);

            using (conn)
            {
                conn.Open();

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "RPT_LKU_proc_Reports_Active";
                cmd.Connection  = conn;

                rdr = cmd.ExecuteReader();

                using (rdr)
                {
                    while (rdr.Read())
                    {
                        ReportsModel r = new ReportsModel();

                        r.rptID    = (int)rdr["RptID"];
                        r.name     = (string)rdr["RptName"];
                        r.rootpath = (string)rdr["RptRootPath"];
                        r.filename = (string)rdr["RptFileName"];
                        r.fullpath = (string)rdr["RptFullPath"];
                        r.frq      = (string)rdr["RptFreq"];
                        r.typ      = (string)rdr["RptType"];

                        lst.Add(r);
                    }
                }
            }

            return(lst);
        }
Пример #12
0
        public ActionResult Report(string reportPath, int headeroption = 1)
        {
            var vm = new ReportsModel();

            if (!string.IsNullOrEmpty(reportPath))
            {
                UserPrincipal user = GetCurrentPrincipal();
                vm            = SetReportViewModel(user);
                vm.ReportPath = reportPath;
                LoggingHelper.LogInformation("Retrieving Report - " + reportPath);
            }

            // getting report service from cache
            if (ReportServer.IsSessionExpired(HttpContext))
            {
                if (headeroption == 1)
                {
                    return(RedirectToAction("LogOff", "Account"));
                }
                else
                {
                    var returnUrl = "/Grids?headeroption=2";
                    return(RedirectToAction("LogOff", "Account", new { returnUrl = returnUrl }));
                }
            }
            //ReportServer rs = new ReportServer(HttpContext);

            //getting report parameters
            ItemParameter[] parameters = ReportServer.GetItemParameters(HttpContext, reportPath, null, true, null, null);

            ViewBag.CurrentUserFirstName = vm.CurrentUserFirstName;
            ViewBag.CurrentUserLastName  = vm.CurrentUserSurName;
            ViewBag.HeaderOption         = headeroption;
            ViewBag.ReportParameters     = parameters;
            ViewBag.SamAccount           = vm.SamAccount;
            ViewBag.Password             = LoginUser.Password;
            return(View(vm));
        }
Пример #13
0
        public ActionResult ReportingRatesCopy(string productCategory, string sdate, string edate)
        {
            ReportsModel obj = new ReportsModel();

            if (productCategory == "")
            {
                productCategory = null;
            }

            obj.productCategory = productCategory;

            DateTime?StartDate; //= DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
            DateTime?EndDate;   //= DateTime.ParseExact(edate, "dd/MM/yyyy", null);

            if ((!sdate.Contains("null") && sdate != "") || (!edate.Contains("null") && edate != ""))
            {
                StartDate = DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
                EndDate   = DateTime.ParseExact(edate, "dd/MM/yyyy", null);
            }
            else
            {
                StartDate = null; // Convert.ToDateTime(DBNull.Value);
                EndDate   = null; // Convert.ToDateTime(DBNull.Value);
            }
            obj.StartDate = StartDate;
            obj.EndDate   = EndDate;

            Microsoft.Reporting.WebForms.ReportViewer reportViewer = new Microsoft.Reporting.WebForms.ReportViewer();
            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;

            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\LMIS_Reports\Reporting_Rates.rdlc";
            reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportingRates", obj.GetReportingRatesCopy().ToList()));

            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
Пример #14
0
        public IActionResult Reports()
        {
            ReportsModel response = new ReportsModel
            {
                UsersReports = new List <GetNearbyFiresResponseDTO>()
            };

            using (var context = new IsfContext())
            {
                var retrievedReports = context.Reports.ToList();
                foreach (var report in retrievedReports)
                {
                    response.UsersReports.Add(new GetNearbyFiresResponseDTO()
                    {
                        Latitude   = report.Latitude,
                        Longitude  = report.Longitude,
                        PhotoUrl   = report.ImagePath ?? getImageUrl(report.ImagePath),
                        IsOwner    = false,
                        IsNasa     = false,
                        Confidence = 0.2m,
                        Distance   = LatLongDistance(report.Latitude, report.Longitude, 46.481940m, 30.747274m)
                    });
                }
                response.UsersReports.Add(new GetNearbyFiresResponseDTO()
                {
                    Latitude   = 46.500144m,
                    Longitude  = 30.663893m,
                    PhotoUrl   = getImageUrl("NASA"),
                    IsOwner    = false,
                    IsNasa     = false,
                    Confidence = 0.2m,   // from 0 to 1
                    Distance   = LatLongDistance(46.500144m, 30.663893m, 46.481940m, 30.747274m)
                });
                response.UsersReports = response.UsersReports.OrderBy(x => x.Distance).ToList();
            }

            return(View(response));
        }
Пример #15
0
        /// <summary>
        /// For handling report posts.
        /// </summary>
        public ActionResult ReportPost(ReportsModel model)
        {
            switch (model.Category)
            {
            case "Shelters":
                model.ReportViewerName = "reportViewerShelterDetail";
                model.ReportUrl        = "Report/_ShelterDetail";

                Session["ShelterId"] = model.ShelterId;
                ViewData["Report"]   = new ShelterDetail();
                break;

            case "Items":
                model.ReportViewerName = "reportViewerItemStock";
                model.ReportUrl        = "Report/_ItemStock";

                Session["ReportFilter"] = model.SearchParam;
                ViewData["Report"]      = new ItemsStock();
                break;
            }

            return(PartialView("Report/_ReportContent", model));
        }
Пример #16
0
        }//END RegisterMovement

        //View for Reports
        public ActionResult Reports()
        {
            if (Session["accountOnline"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                AccountDataModel acc = (AccountDataModel)Session["accountOnline"];
                ReportsModel     rpt = new ReportsModel();
                List <SGF_PROC_REPORTS_BY_CATEGORY_Result> data = new List <SGF_PROC_REPORTS_BY_CATEGORY_Result>();
                rpt.ReportType = 1;

                using (SGFEntitiess accRpt = new SGFEntitiess())
                {
                    data = accRpt.SGF_PROC_GET_REPORT_BY_CATEGORIES(acc.Account_Id, null, null, null).ToList();
                }

                rpt.ReportData           = data;
                Session["accountReport"] = rpt;
                return(View());
            }
        }//END Reports
        public async Task <ReportsModel> GetReportDetails(int collectionYear, int collectionPeriod)
        {
            var reportDetails = await _reportsService.GetAllReportDetails(collectionYear, collectionPeriod);

            var operationsReportsDetails = await _reportsService.GetOperationsReportsDetails(collectionYear, collectionPeriod);

            var fundingClaimsReportsDetails = await _reportsService.GetFundingClaimsReportsDetails();

            var reportDetailsList = reportDetails.ToList();

            reportDetailsList.AddRange(operationsReportsDetails);
            reportDetailsList.AddRange(fundingClaimsReportsDetails);
            var reportUrlDetails = reportDetailsList.Where(x => !string.IsNullOrEmpty(x.Url));

            var availableReports = await _reportsService.GetAvailableReportsAsync(collectionYear, collectionPeriod);

            var model = new ReportsModel
            {
                AvailableReportsList = availableReports,
                ReportUrlDetails     = reportUrlDetails
            };

            return(model);
        }
Пример #18
0
        //To get reports and Owner for a given workspaceid
        public JsonResult GetReportsAndOwner(string workspaceid)
        {
            //List<RoleRightsMappingModel> roleRights = new List<RoleRightsMappingModel>();
            var reportsModel = new ReportsModel();

            string Baseurl = ConfigurationManager.AppSettings["baseURL"];

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var responseTask = client.GetAsync(string.Format("api/GetReportsAndOwner/?workspaceid={0}", workspaceid));
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ReportsDTO>();
                    readTask.Wait();

                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <ReportsDTO, ReportsModel>();
                        cfg.CreateMap <UsersDTO, UsersModel>();
                    });
                    IMapper mapper = config.CreateMapper();

                    reportsModel = mapper.Map <ReportsDTO, ReportsModel>(readTask.Result);
                }
            }

            return(new JsonResult {
                Data = reportsModel, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #19
0
        public ActionResult FamilyQueryData(string field, string type)
        {
            var cc = ReportsModel.FamilyQueryDataCondition(field, type);

            return(Redirect("/Query/" + cc.Id));
        }
Пример #20
0
        public ActionResult FamilyQueryCodes(string field, string value)
        {
            var c = ReportsModel.FamilyQueryCodesCondition(field, value);

            return(Redirect("/Query/" + c.Id));
        }
Пример #21
0
 public ActionResult RenameAll(string field, string newname)
 {
     ReportsModel.RenameAll(field, newname);
     return(Content(newname));
 }
Пример #22
0
        public ActionResult DeleteAll(string field, string type, string value)
        {
            var ret = ReportsModel.DeleteAll(field, type, value);

            return(Content(ret));
        }
        public ReportsModel BindReportData()
        {
            ReportsModel objreport = new ReportsModel();

            objreport.ReportData = new List <ReportData>();
            List <SelectListItem> objtasktypedata   = new List <SelectListItem>();
            List <SelectListItem> objtaskstatusdata = new List <SelectListItem>();
            CustomResponse        response          = APICalls.Get("usersapi/Get?type=1");
            JavaScriptSerializer  serializer1       = new JavaScriptSerializer();

            if (response.Response != null)
            {
                var                   projects     = response.Response.ToString();
                List <UserDTO>        projectsinfo = serializer1.Deserialize <List <UserDTO> >(projects);
                List <SelectListItem> objprojects  = new List <SelectListItem>();
                foreach (UserDTO pdto in projectsinfo)
                {
                    objprojects.Add(new SelectListItem {
                        Text = pdto.FirstName, Value = pdto.Id.ToString()
                    });
                }
                objprojects.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.ProjectsDDl = objprojects;
            }
            CustomResponse restype2 = APICalls.Get("GenericAPI/Get?type=2");

            if (restype2.Response != null)
            {
                var tasktype = restype2.Response.ToString();
                List <TypeAndPriorityDTO> objtasktype = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype);
                foreach (TypeAndPriorityDTO objtp in objtasktype)
                {
                    objtasktypedata.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                objtasktypedata.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.TaskTypeDDl = objtasktypedata;
            }
            CustomResponse restype6 = APICalls.Get("GenericAPI/Get?type=3");

            if (restype6.Response != null)
            {
                var tasktype1 = restype6.Response.ToString();
                List <TypeAndPriorityDTO> objtasktype1 = serializer1.Deserialize <List <TypeAndPriorityDTO> >(tasktype1);
                foreach (TypeAndPriorityDTO objtp in objtasktype1)
                {
                    objtaskstatusdata.Add(new SelectListItem {
                        Text = objtp.Name, Value = objtp.ID.ToString()
                    });
                }
                objtaskstatusdata.Add(new SelectListItem {
                    Text = "All", Value = "0"
                });
                objreport.TaskStatusDDl = objtaskstatusdata;
            }
            return(objreport);
        }
Пример #24
0
        //ReportingRatesIndex
        public ActionResult ReportingRates(string Year, string Month, string productCategory, string DeliveryZoneCode, string cdc, string IP, string SCTO, string sdate, string edate)
        {
            ReportsModel obj = new ReportsModel();

            if (Year == "")
            {
                Year = null;
            }
            if (Month == "")
            {
                Month = null;
            }
            if (productCategory == "")
            {
                productCategory = null;
            }
            if (DeliveryZoneCode == "")
            {
                DeliveryZoneCode = null;
            }
            if (cdc == "")
            {
                cdc = null;
            }
            if (IP == "")
            {
                IP = null;
            }
            if (SCTO == "")
            {
                SCTO = null;
            }
            obj.Year             = Year;
            obj.Month            = Month;
            obj.productCategory  = productCategory;
            obj.DeliveryZoneCode = DeliveryZoneCode;
            obj.cdc  = cdc;
            obj.IP   = IP;
            obj.SCTO = SCTO;
            DateTime?StartDate; //= DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
            DateTime?EndDate;   //= DateTime.ParseExact(edate, "dd/MM/yyyy", null);

            if ((!sdate.Contains("null") && sdate != "") || (!edate.Contains("null") && edate != ""))
            {
                StartDate = DateTime.ParseExact(sdate, "dd/MM/yyyy", null);
                EndDate   = DateTime.ParseExact(edate, "dd/MM/yyyy", null);
            }
            else
            {
                StartDate = null; // Convert.ToDateTime(DBNull.Value);
                EndDate   = null; // Convert.ToDateTime(DBNull.Value);
            }
            obj.StartDate = StartDate;
            obj.EndDate   = EndDate;

            Microsoft.Reporting.WebForms.ReportViewer reportViewer = new Microsoft.Reporting.WebForms.ReportViewer();
            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;

            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\LMIS_Reports\ReportingRates.rdlc";
            reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportingRates", obj.GetReportingRates().ToList()));

            ViewBag.ReportViewer = reportViewer;

            return(View());
        }
Пример #25
0
        internal async void ShowReport(ReportsModel reportsModel)
        {
            try
            {
                var res = LabResultListComplete.Where(x => x.ASREF == reportsModel.ASREF &&
                                                      x.ASYEAR == reportsModel.ASYEAR).FirstOrDefault();
                if (res != null)
                {
                    res.IsViewed = true;
                }

                App.TabbedPage.viewModel.LabCount--;
                App.TabbedPage.viewModel.LabCountVisibility = App.TabbedPage.viewModel.LabCount >= 0;

                Task.Run(async() =>
                {
                    var result = await ReportsService.SetSeenReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR,
                                                                     reportsModel.ASREF, "Y");
                });
            }
            catch (Exception ex)
            {
            }

            try
            {
                if (!String.IsNullOrEmpty(reportsModel.ASREF))
                {
                    var name   = $"{reportsModel.ASBRCH}_{reportsModel.ASYEAR}_{reportsModel.ASREF}";
                    var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                    var result = await ReportsService.GetAttachmentsList(name);

                    await loader.DismissAsync();

                    if (result.Success)
                    {
                        var list = result.data.ToList();
                        list.Insert(0, name + ".pdf");

                        var newList = new List <string>();
                        foreach (var item in list)
                        {
                            var newIndex = list.IndexOf(item);
                            if (newIndex == 0)
                            {
                                newList.Add("Main Report");
                            }
                            else
                            {
                                newList.Add($"Attachment {newIndex}");
                            }
                        }


                        var index = await ShowActionSheet("Select", newList);

                        if (index >= 0)
                        {
                            if (index >= 1)
                            {
                                var nativeFileHandler = DependencyService.Get <INativeFileHandler>();
                                //var url = $"{ApiBase.HttpClientBase.BaseUrl}/Attachments/{list[index]}";
                                var loader1 = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                                //var bytes = await ReportsService.Download($"/Attachments/{list[index]}");// DownloadPDFAsync(url);
                                //var response = await ReportsService.DownloadFileBytes(ApiBase.HttpClientBase.BaseUrl + $"api/Reports/GetReportAttachment?filename=X_19_19804_01.PDF");
                                var response = await ReportsService.DownloadFileBytes(ApiBase.HttpClientBase.BaseUrl + $"api/Reports/GetReportAttachment?filename={list[index]}");

                                await loader1.DismissAsync();

                                if (response.FileContents != null && response.FileContents.Length > 1)
                                {
                                    await App.Current.MainPage.Navigation.PushAsync(new PdfPage(response.FileContents));

                                    nativeFileHandler.SaveFile(list[index], response.FileContents);
                                    //   await MaterialDialog.Instance.AlertAsync("Report downloaded in your local storage");
                                }
                                else
                                {
                                    await MaterialDialog.Instance.AlertAsync("Cannot download report due to server issue");
                                }
                            }
                            else
                            {
                                //var url = $"{ApiBase.HttpClientBase.BaseUrl}/api/Reports/DownloadReport?refernce={reportsModel.ASREF}";
                                var loader1 = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                                var pdfModel = await ReportsService.DownloadBytes($"api/Reports/DownloadReportBytes?brch={reportsModel.ASBRCH}&year={reportsModel.ASYEAR}&refernce={reportsModel.ASREF}");

                                await loader1.DismissAsync();

                                if (pdfModel.FileContents != null && pdfModel.FileContents.Length > 1)
                                {
                                    //var pdfByte = HtmlByteToPdfByte(pdfModel.FileContents);
                                    //await App.Current.MainPage.Navigation.PushAsync(new PdfPage(pdfByte));
                                    await App.Current.MainPage.Navigation.PushAsync(new BrowserPage(pdfModel.FileContents));
                                }
                                else
                                {
                                    await MaterialDialog.Instance.AlertAsync("Report not available");
                                }
                            }
                        }
                    }
                    else
                    {
                        var url     = $"api/Reports/DownloadReportBytes?brch={reportsModel.ASBRCH}&year={reportsModel.ASYEAR}&refernce={reportsModel.ASREF}";
                        var loader1 = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                        var pdfModel = await ReportsService.DownloadBytes(url);

                        await loader1.DismissAsync();

                        if (pdfModel.FileContents != null && pdfModel.FileContents.Length > 1)
                        {
                            //var pdfByte = HtmlByteToPdfByte(pdfModel.FileContents);
                            //await App.Current.MainPage.Navigation.PushAsync(new PdfPage(pdfByte));
                            await App.Current.MainPage.Navigation.PushAsync(new BrowserPage(pdfModel.FileContents));
                        }
                        else
                        {
                            await MaterialDialog.Instance.AlertAsync("Report not available");
                        }
                    }
                }
                else
                {
                    await MaterialDialog.Instance.AlertAsync("Report not available");
                }
            }
            catch (Exception ex)
            {
                await MaterialDialog.Instance.AlertAsync(ex.Message);
            }
        }
        internal async void CheckByImplementation(ReportsModel reportsModel)
        {
            if (Constants.UserProfile.Role == "guarantor" && Constants.UserProfile.LabID == reportsModel.ASGUAR2)
            {
                await MaterialDialog.Instance.AlertAsync("Your account dont have permissions to check this document ");

                return;
            }

            bool isChecked = false;

            if (reportsModel != null)
            {
                switch (Constants.UserProfile.Role)
                {
                case "patient":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASPCHKBY);
                    break;

                case "doctor":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASDCHKBY);
                    break;

                case "agent":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASACHKBY);
                    break;

                case "guarantor":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASGCHKBY);
                    break;
                }

                if (isChecked)
                {
                    var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                    var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR,
                                                                   reportsModel.ASREF, "", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"));

                    await loader.DismissAsync();

                    if (result.Success)
                    {
                        //App.TabbedPage.viewModel.RadioCount++;
                        //App.TabbedPage.viewModel.RadioCountVisibility = App.TabbedPage.viewModel.RadioCount != 0;
                        switch (Constants.UserProfile.Role)
                        {
                        case "patient":
                            reportsModel.ASPCHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "doctor":
                            reportsModel.ASDCHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "agent":
                            reportsModel.ASACHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "guarantor":
                            reportsModel.ASGCHKBY = reportsModel.CheckDate = String.Empty;
                            break;
                        }

                        reportsModel.CheckedSource = "checkbox.png";
                        //reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(result.Message);
                    }
                }
                else
                {
                    var loader = await MaterialDialog.Instance.LoadingDialogAsync("loading");

                    var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR,
                                                                   reportsModel.ASREF, Constants.UserProfile.LabID, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"));

                    await loader.DismissAsync();

                    if (result.Success)
                    {
                        //App.TabbedPage.viewModel.RadioCount--;
                        //App.TabbedPage.viewModel.RadioCountVisibility = App.TabbedPage.viewModel.RadioCount != 0;

                        switch (Constants.UserProfile.Role)
                        {
                        case "patient":
                            reportsModel.ASPCHKBY = Constants.UserProfile.LabID;
                            break;

                        case "doctor":
                            reportsModel.ASDCHKBY = Constants.UserProfile.LabID;
                            break;

                        case "agent":
                            reportsModel.ASACHKBY = Constants.UserProfile.LabID;
                            break;

                        case "guarantor":
                            reportsModel.ASGCHKBY = Constants.UserProfile.LabID;
                            break;
                        }



                        reportsModel.CheckedSource = "check.png";
                        reportsModel.CheckDate     = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(result.Message);
                    }
                }
                //  LabCountVisibility = RadioCountVisibility = false;
                //var result1 = await new ReportsService().GetLabReportsCount(Constants.UserProfile.Role, Constants.UserProfile.LabID);
                //if (result1.Success)
                //{
                //    if (result1.labCount > 0)
                //    {
                //        LabCount = result1.labCount;
                //        LabCountVisibility = true;
                //    }
                //    if (result1.radioCount > 0)
                //    {
                //        RadioCount = result1.radioCount;
                //        RadioCountVisibility = true;
                //    }
                //}
            }
        }
Пример #27
0
        //To get reports and embeded url for a given workspaceid
        public JsonResult GetReportsAndEmbedUrl(string requestId)
        {
            //List<RoleRightsMappingModel> roleRights = new List<RoleRightsMappingModel>();
            var reportsModel = new ReportsModel();

            if (Session["UserName"] == null)
            {
                return(Json(new { code = 1 }));
            }

            //var loginModel = new LoginModel();
            //loginModel.UserName = Session["UserName"].ToString();
            //loginModel.Password = Session["Pwd"].ToString();

            //string Baseurl = ConfigurationManager.AppSettings["baseURL"] + "api/AuthenticatePowerBIUser";
            //using (var client = new HttpClient())
            //{
            //    client.BaseAddress = new Uri(Baseurl);
            //    client.DefaultRequestHeaders.Clear();
            //    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            //    //HTTP POST
            //    var postTask = client.PostAsJsonAsync<LoginModel>(Baseurl, loginModel);
            //    postTask.Wait();

            //    var result = postTask.Result;
            //    if (result.IsSuccessStatusCode)
            //    {
            //        var readTask = result.Content.ReadAsAsync<string>();
            //        readTask.Wait();
            //        if (readTask.Result == "PowerBI Authentication failed")
            //        {
            //            ViewBag.ErrorMessage = "The Email and/or Password are incorrect";
            //        }
            //        else
            //        {
            //            Session["PowerBIAccessToken"] = readTask.Result;
            //        }
            //    }
            //}


            string Baseurl = ConfigurationManager.AppSettings["baseURL"];

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var responseTask = client.GetAsync(string.Format("api/GetReportsAndEmbedUrl/?requestId={0}", requestId));
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ReportsDTO>();
                    readTask.Wait();

                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <ReportsDTO, ReportsModel>();
                        cfg.CreateMap <UsersDTO, UsersModel>();
                    });
                    IMapper mapper = config.CreateMapper();

                    reportsModel = mapper.Map <ReportsDTO, ReportsModel>(readTask.Result);
                    if (Session["PowerBIAccessToken"] != null)
                    {
                        reportsModel.PowerBIAccessToken = Session["PowerBIAccessToken"].ToString();
                    }
                }
            }

            return(new JsonResult {
                Data = reportsModel, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #28
0
        public static List <OffersModel> OffersReportByCategory(string fromDate, string toDate, string categoryId, int startValue, int noOFRows, int cityId)
        {
            ReportsModel reports = new ReportsModel();

            return(reports.OffersReportByCategory(fromDate, toDate, categoryId, startValue, noOFRows, cityId));
        }
Пример #29
0
        internal async void CheckByImplementation(ReportsModel reportsModel)
        {
            bool isChecked = false;

            if (reportsModel != null)
            {
                switch (Constants.UserProfile.Role)
                {
                case "patient":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASPCHKBY);
                    break;

                case "doctor":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASDCHKBY);
                    break;

                case "agent":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASACHKBY);
                    break;

                case "guarantor":
                    isChecked = !String.IsNullOrEmpty(reportsModel.ASGCHKBY);
                    break;
                }

                if (isChecked)
                {
                    var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                    var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR,
                                                                   reportsModel.ASREF, "", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"));

                    await loader.DismissAsync();

                    if (result.Success)
                    {
                        reportsModel.CheckedSource = "checkbox.png";
                        //  reportsModel.CheckDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");

                        //App.TabbedPage.viewModel.LabCount++;
                        //App.TabbedPage.viewModel.LabCountVisibility = App.TabbedPage.viewModel.LabCount != 0;
                        switch (Constants.UserProfile.Role)
                        {
                        case "patient":
                            reportsModel.ASPCHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "doctor":
                            reportsModel.ASDCHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "agent":
                            reportsModel.ASACHKBY = reportsModel.CheckDate = String.Empty;
                            break;

                        case "guarantor":
                            reportsModel.ASGCHKBY = reportsModel.CheckDate = String.Empty;
                            break;
                        }
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(result.Message);
                    }
                }
                else
                {
                    var loader = await MaterialDialog.Instance.LoadingDialogAsync("Loading");

                    var result = await ReportsService.CheckReports(Constants.UserProfile.Role, reportsModel.ASBRCH, reportsModel.ASYEAR,
                                                                   reportsModel.ASREF, Constants.UserProfile.LabID, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"));

                    await loader.DismissAsync();

                    if (result.Success)
                    {
                        reportsModel.CheckedSource = "check.png";
                        reportsModel.CheckDate     = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");


                        //App.TabbedPage.viewModel.LabCount--;
                        //App.TabbedPage.viewModel.LabCountVisibility = App.TabbedPage.viewModel.LabCount != 0;

                        switch (Constants.UserProfile.Role)
                        {
                        case "patient":
                            reportsModel.ASPCHKBY = Constants.UserProfile.LabID;
                            break;

                        case "doctor":
                            reportsModel.ASDCHKBY = Constants.UserProfile.LabID;
                            break;

                        case "agent":
                            reportsModel.ASACHKBY = Constants.UserProfile.LabID;
                            break;

                        case "guarantor":
                            reportsModel.ASGCHKBY = Constants.UserProfile.LabID;
                            break;
                        }
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(result.Message);
                    }
                }
            }
        }
Пример #30
0
        public static List <RequestsModel> RequestReportBySubCategory(string fromDate, string toDate, string subCategoryId, int startValue, int noOFRows, int cityId)
        {
            ReportsModel reports = new ReportsModel();

            return(reports.RequestReportBySubCategory(fromDate, toDate, subCategoryId, startValue, noOFRows, cityId));
        }