public JsonResult BookingReport(ReportingViewModel reportingViewModel)
        {

            HttpResponseMessage response = new APIHelper.APICallMethod().GetHttpResponseMessage("GetReportBookingDetailsBySearch", "AdminPanel", reportingViewModel);
            if (response.IsSuccessStatusCode)
            {
                var data = response.Content.ReadAsStringAsync().Result;
                ViewModel.ResponseModel.ResponseViewModel<List<ViewModel.ReportingViewModel>> dbBookingDetails = JsonConvert.DeserializeObject<ViewModel.ResponseModel.ResponseViewModel<List<ViewModel.ReportingViewModel>>>(data);
                if (dbBookingDetails.IdentityResult.Status == true)
                {
                    string convertedData = Common.HtmlHelper.RenderViewToString(this.ControllerContext, "~/Views/DetailReporting/_BookingReport.cshtml", dbBookingDetails.Content);

                    return Json(new { code = 0, message = convertedData });
                }
                else
                {
                    if (dbBookingDetails.IdentityResult.Message == "Invalid access details, Please log-out.")
                    {
                        return Json(new { code = -99, message = "Please Login Again" });
                    }
                    else
                    {
                        return Json(new { code = -1, message = dbBookingDetails.IdentityResult.Message });
                    }
                }
            }
            else
            {
                return Json(new { code = -2, message = "failed" });
            }

        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(ReportingViewModel model)
        {
            if (model.Request.StartDate.HasValue &&
                model.Request.EndDate.HasValue &&
                model.Request.EndDate <= model.Request.StartDate)
            {
                ModelState.AddModelError("Request.EndDate", "The End Date must be after the Start Date");
            }

            if (ModelState.IsValid)
            {
                var stats = await _reportService.GetAllByBranchAsync(model.Request);

                ReportingViewModel viewModel = new ReportingViewModel()
                {
                    Request                  = model.Request,
                    StatusSummaries          = stats,
                    TotalUsers               = stats.Sum(_ => _.RegisteredUsers),
                    TotalBooksRead           = stats.Sum(_ => _.ActivityEarnings.Sum(m => m.Value)),
                    TotalChallengesCompleted = stats.Sum(_ => _.CompletedChallenges),
                    TotalBadgesEarned        = stats.Sum(_ => _.BadgesEarned),
                    TotalPointsEarned        = stats.Sum(_ => _.PointsEarned)
                };
                return(View(viewModel));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 3
0
        private List <ReportingViewModel> GetAllReportingModels()
        {
            var employees         = new EmployeeService().RetrieveEmployeeList();
            var employeeReporting = new List <ReportingViewModel>();

            foreach (var employee in employees)
            {
                var reportingModel = new ReportingViewModel()
                {
                    UserID          = employee.EmployeeID,
                    DisplayName     = employee.DisplayName,
                    UserName        = employee.Username,
                    IsAdmin         = employee.IsAdmin,
                    Email           = employee.Email,
                    HireDate        = employee.HireDate,
                    AnniversaryDate = employee.AnniversaryDate,
                    PTO             = new PTOViewModel()
                };
                CalculatePTO(reportingModel);

                if (reportingModel.PTO.BalanceHours > 40)
                {
                    reportingModel.ExcessRolloverPTO = reportingModel.PTO.BalanceHours - 40;
                }
                else
                {
                    reportingModel.ExcessRolloverPTO = 0;
                }

                employeeReporting.Add(reportingModel);
            }

            return(employeeReporting);
        }
Ejemplo n.º 4
0
        public ActionResult ProjectRptView()

        {
            var donors = _donorsAppService.getAllDonors();
            List <SelectListItem> OrderBy = new List <SelectListItem>();

            OrderBy.Add(new SelectListItem()
            {
                Text = "Project Name", Value = "projectArabicName"
            });
            OrderBy.Add(new SelectListItem()
            {
                Text = "year", Value = "year"
            });
            OrderBy.Add(new SelectListItem()
            {
                Text = "Number of Families", Value = "numberOfFamilies"
            });

            var ReportingViewModel = new ReportingViewModel
            {
                Donors  = donors,
                OrderBy = OrderBy
            };

            //List<string> OrderBy = new List<string>
            //{
            //    ""
            //}



            return(View("ProjectRptView", ReportingViewModel));
        }
        public ActionResult Team()
        {
            ReportingViewModel model = new ReportingViewModel();

            model.Load();
            return(View(model));
        }
Ejemplo n.º 6
0
        public ViewResult Index()
        {
            ViewBag.Title = "Reporting";
            ReportingViewModel vm = new ReportingViewModel();

            vm.Reporting = _dbcontext.Reportings;

            var user        = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var userDetails = _dbcontext.Users.Where(x => x.Id == user).FirstOrDefault();
            var schemas     = _dbcontext.Schemas.Select(x => x.schemaName).Distinct().ToList();

            vm.Reports = new Dictionary <string, List <string> >();

            foreach (string schName in schemas)
            {
                var columns = _dbcontext.Schemas.Where(x => x.schemaName.Equals(schName)).Select(a => a.fieldName).Distinct().ToList();
                vm.Reports.Add(schName, columns);
            }

            vm.FirstName = userDetails.FirstName;
            vm.LastName  = userDetails.LastName;

            vm.ActiveReport = "Select Report";

            return(View(vm));
        }
Ejemplo n.º 7
0
        public static void AddDocuments()
        {
            _globalVM = new GlobalViewModel(VM);

            _configVM = new ConfigurationViewModel(VM);
            _clearConfigButton.Command   = new RelayCommand(_configVM.ClearConfig, ReturnTrue);
            _loadXmlConfigButton.Command = new RelayCommand(_configVM.LoadXmlConfig, _configVM.ReturnTrue);
            _saveXmlConfigButton.Command = new RelayCommand(_configVM.SaveXmlConfig, _configVM.ReturnTrue);
            _loadIniConfigButton.Command = new RelayCommand(_configVM.LoadIniConfig, _configVM.ReturnTrue);
            _saveIniConfigButton.Command = new RelayCommand(_configVM.SaveIniConfig, _configVM.ReturnTrue);

            _dbVM        = new DatabaseViewModel(VM);
            _httpVM      = new HttpServerViewModel(VM);
            _tcpVM       = new TcpServerViewModel(VM);
            _reportingVM = new ReportingViewModel(VM);
            _propertyVM  = new PropertyViewModel(VM);

            VM.Documents.Add(_globalVM);
            VM.Documents.Add(_configVM);
            VM.Documents.Add(_dbVM);
            VM.Documents.Add(_httpVM);
            VM.Documents.Add(_tcpVM);
            VM.Documents.Add(_reportingVM);
            VM.Tools.Add(_propertyVM);
        }
Ejemplo n.º 8
0
        public ActionResult ReportView(ReportingViewModel model)
        {
            Reporting reportingObj = dbContext.Reportings.Where(x => x.SlNo == model.SlNo).FirstOrDefault();

            model.ReportPath   = reportingObj.ReportPath;
            model.Qryname      = reportingObj.Qryname;
            model.xmlTableName = reportingObj.xmlTableName;
            model.ReportPath   = reportingObj.ReportPath;
            model.ReportName   = reportingObj.ReportName;
            model.Para1        = reportingObj.Para1;
            model.Para2        = reportingObj.Para2;
            model.Para3        = reportingObj.Para3;
            model.Para4        = reportingObj.Para4;
            if (!model.Para1.Equals("0"))
            {
                model.Parameters.Add(model.Para1, "");
            }
            if (!model.Para2.Equals("0"))
            {
                model.Parameters.Add(model.Para2, "");
            }
            if (!model.Para3.Equals("0"))
            {
                model.Parameters.Add(model.Para3, "");
            }
            if (!model.Para4.Equals("0"))
            {
                model.Parameters.Add(model.Para4, "");
            }
            model.SlNo = model.SlNo;
            return(View(model));
        }
Ejemplo n.º 9
0
        // report
        public IActionResult Reporting(int month, int year)
        {
            var employeeDataString = HttpContext.Session.GetString("employee");

            if (employeeDataString == "")
            {
                return(RedirectToAction("Login", "Auth"));
            }
            else
            {
                Employee employee = JsonConvert.DeserializeObject <Employee>(employeeDataString);

                if (userAccessManager.IsAccessExists(employee.Id, 5))
                {
                    ReportingViewModel model = orderManager.GetReportDetailsByMonthOrYear(month, year);

                    if (model != null)
                    {
                        model.Month = month;
                        model.Year  = year;
                        return(new ViewAsPdf("Reporting", model));
                    }
                    else
                    {
                        return(NotFound("Not Data Found"));
                    }
                }
                else
                {
                    return(NotFound("No Access"));
                }
            }
        }
Ejemplo n.º 10
0
        // GET: Management/Print
        public async Task <ActionResult> TeamReport(string id)
        {
            ReportingViewModel model = new ReportingViewModel();

            model.ReportingModel = await model.GetTeamReporting(id);

            return(View(model));
        }
 // GET: DetailReporting
 public ActionResult Index()
 {
     ReportingViewModel reportingViewModel = new ReportingViewModel() {
         BookingStatusViewModels = GetAllBookingStatus(),
         SessionMasterViewModels= GetAllSessionDetail(),
         MemberTypeViewModels= GetAllMemberType()
     
     };
     return View(reportingViewModel);
 }
        public async Task <ActionResult> Team(ReportingViewModel vm)
        {
            ReportingViewModel model = new ReportingViewModel();

            model.TeamId         = vm.TeamId;
            model.ReportingModel = await vm.GetTeamReporting(vm.TeamId);

            model.Load();
            return(View(model));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Print(ReportingViewModel model, string submit)
        {
            DataSet dataSet = new DataSet();

            MySqlConnection con  = new MySqlConnection("Data Source=localhost;Initial Catalog =ejabeda_habro;user id=root;password=asdf@1234");
            var             cmd1 = new MySqlCommand(model.Qryname, con);

            foreach (var paramerte in model.Parameters)
            {
                var parm = new MySqlParameter();
                if (paramerte.Key.ToLower().Contains("date"))
                {
                    parm.ParameterName = paramerte.Key;
                    parm.Value         = Convert.ToDateTime(paramerte.Value).ToString("yyyy-MM-dd");
                }
                else
                {
                    parm.ParameterName = paramerte.Key;
                    parm.Value         = paramerte.Value;
                }
                cmd1.Parameters.Add(parm);
            }
            string mimtype   = "";
            int    extension = 1;
            var    path      = $"{_webHostEnvironment.WebRootPath}\\Reports\\" + model.ReportPath;

            LocalReport localReport = new LocalReport(path);

            var rDs = new DataSet();
            var adp = new MySqlDataAdapter(cmd1);

            adp.Fill(rDs, model.Qryname);
            localReport.AddDataSource(model.xmlTableName, rDs.Tables[0]);
            if (submit == "Word")
            {
                var result = localReport.Execute(RenderType.Word, extension, model.Parameters, mimtype);
                return(File(result.MainStream, "application/msword", model.ReportName + ".doc"));
            }
            else if (submit == "Excel")
            {
                var result = localReport.Execute(RenderType.Excel, extension, model.Parameters, mimtype);
                return(File(result.MainStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", model.ReportName + ".xlsx"));
            }
            else if (submit == "Pdf")
            {
                var result = localReport.Execute(RenderType.Pdf, extension, model.Parameters, mimtype);
                return(File(result.MainStream, "application/pdf", model.ReportName + ".pdf"));
            }
            else
            {
                var result = localReport.Execute(RenderType.Pdf, extension, model.Parameters, mimtype);
                return(File(result.MainStream, "application/pdf"));
            }
        }
Ejemplo n.º 14
0
        public ActionResult AspReport(ReportingViewModel model)
        {
            var sessionUser = HttpContext.Session.GetString("paramertes");

            if (sessionUser == null)
            {
                HttpContext.Session.SetString("paramertes", JsonConvert.SerializeObject(model.Parameters));
                HttpContext.Session.SetString("slNo", JsonConvert.SerializeObject(model.SlNo));
            }
            return(Redirect("~/Reports/TreeReportViwer.aspx"));
        }
        public ActionResult Money()
        {
            ReportingViewModel reportingViewModel = new ReportingViewModel()
            {
                BookingStatusViewModels = GetAllBookingStatus(),
                PromotionViewModels = GetAllPromotion(),
                MemberTypeViewModels = GetAllMemberType()

            };
            return View(reportingViewModel);
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> Index(int instanceId)
        {
            var instanceModel = await _instanceRepository.GetByIdAsync(instanceId);

            var spaceList = await _spaceRepository.GetAllAsync(currentPageNumber : 1, rowsPerPage : int.MaxValue, "Name", true, instanceId);

            var viewModel = new ReportingViewModel
            {
                Instance  = instanceModel,
                SpaceList = spaceList.Items
            };

            return(View(viewModel));
        }
Ejemplo n.º 17
0
        public Reporting(DBContext context, Employee empl)
        {
            InitializeComponent();

            ReportingViewModel rvm = new ReportingViewModel(context, empl);

            DataContext = rvm;
            //if (empl.Role == Role.User)
            //{
            //    AdminBtn.IsHitTestVisible = false;
            //}
            //if (rvm.Close == null)
            //    rvm.Close = new Action(this.Close);
        }
        public ActionResult Index()
        {
            var model    = new ReportingViewModel();
            var settings = ConfigurationStore.Instance.Load <ReportConfig>();

            if (settings == null || settings.MaxReportsPerIncident == 0)
            {
                return(View(model));
            }

            _logger.Debug("Display acess: " + settings.MaxReportsPerIncident + " from " + ConfigurationStore.Instance.GetHashCode());
            model.MaxReportsPerIncident = settings.MaxReportsPerIncident;
            model.RetentionDays         = settings.RetentionDays;
            return(View(model));
        }
Ejemplo n.º 19
0
        public UserControl Initialize(ActionBarView actionBar, string databasename)
        {
            var ret = new ReportingView();

            mDatabaseName = databasename;

            mViewModel = new ReportingViewModel
            {
                ZeigeMitarbeiterReporting = new RelayCommand(ZeigeMitarbeiterReportingExecute),
                ZeigeArtikelReporting     = new RelayCommand(ZeigeArtikelReportingExecute),
                AktualisiereReporting     = new RelayCommand(AktualisiereReportingExecute)
            };

            actionBar.DataContext = new ActionBarViewModel();

            ret.DataContext = mViewModel;
            return(ret);
        }
        public ActionResult Index(ReportingViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var settings = new ReportConfig
            {
                MaxReportsPerIncident = model.MaxReportsPerIncident,
                RetentionDays         = model.RetentionDays,
            };

            _logger.Debug("Storing: " + settings.MaxReportsPerIncident);
            ConfigurationStore.Instance.Store(settings);
            _logger.Debug("Stored: " + settings.MaxReportsPerIncident + " to " + ConfigurationStore.Instance.GetHashCode());

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Handles the Loaded event of the UserControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (isInitialized)
            {
                return;
            }
            this.ShowProgressBar();
            Task t = Task.Factory.StartNew(() =>
            {
                ////log.InfoFormat("Preview test case with id: {0} and suite id {1}", this.TestCaseId, this.TestSuiteId);
                this.ReportingViewModel = new ReportingViewModel();
            });

            t.ContinueWith(antecedent =>
            {
                this.DataContext = this.ReportingViewModel;
                this.HideProgressBar();
                isInitialized = true;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        // get order items by month and year
        public ReportingViewModel GetReportDetailsByMonthOrYear(int month, int year)
        {
            List <OrderItemViewModel> models = unitOfWork.OrderInfo.GetOrderItemByMonthAndYear(month, year);

            ReportingViewModel model = new ReportingViewModel();

            if (models.Count > 0)
            {
                model.Total    = models.Where(x => x.IsReceived == 1 && x.IsDelivered == 1 && x.IsNew == 0 && x.State == 1).Sum(x => x.ProductPrice);
                model.Profit   = models.Where(x => x.IsReceived == 1 && x.IsDelivered == 1 && x.IsNew == 0 && x.State == 1).Sum(x => x.Profit);
                model.Quantity = models.Where(x => x.IsReceived == 1 && x.IsDelivered == 1 && x.IsNew == 0 && x.State == 1).Sum(x => x.Quantity);

                model.OrderItemViewModels = models;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 23
0
        // GET: Inventory
        public async Task <IActionResult> Index()
        {
            // Get all purchase orders
            var purchaseOrders = from m in _context.PurchaseOrder
                                 select m;

            // Select purchase orders that have not been shipped
            var outstandingPO   = purchaseOrders.Where(s => s.shipDate.Year == 1);
            var shippedPO       = purchaseOrders.Where(s => (s.shipDate.Year > 1 && s.shipDate.Date < DateTime.Now.Date));
            var shippingTodayPO = purchaseOrders.Where(s => s.shipDate.Date == DateTime.Now.Date);

            var reportingVM = new ReportingViewModel();

            reportingVM.outstandingPO = await outstandingPO.ToListAsync();

            reportingVM.shippedPO = await shippedPO.ToListAsync();

            reportingVM.shippingTodayPO = await shippingTodayPO.ToListAsync();

            return(View(reportingVM));
            //return View(await purchaseOrders.ToListAsync());
        }
Ejemplo n.º 24
0
        public ActionResult Create([Bind(Include = "date")] ReportingViewModel reportingView)
        {
            if (ModelState.IsValid)
            {
                //var reportings = from skill in db.Skills
                //                 join gskill in db.GraphSkill on skill.id equals gskill.related_skill
                //                 join gskillv in db.GraphSkillVacancy on gskill.id equals gskillv.graph_skill_id
                //                 join vacancy in db.Vacancies on gskillv.vacancy_id equals vacancy.id
                //                 where vacancy.created_at == reportingView.date
                //                 select new { skill = skill.title, date = vacancy.created_at.Value, count = vacancy.link.Count() };
                ////ViewBag.Count = reportings.ToList().Count();
                ////List<Reporting> repsToAdd = reportings.ToList();
                //var lst=reportings.ToList().Select(r => new Reporting { skill = r.skill, date = r.date, count = r.count }).ToList();
                repo.reportingUpdate(reportingView.date);
                //db.Reporting.Add(reporting);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //return View(reporting);
            return(View());
        }
Ejemplo n.º 25
0
        public ActionResult ApplicationRptView()
        {
            List <SelectListItem> OrderBy = new List <SelectListItem>();

            OrderBy.Add(new SelectListItem()
            {
                Text = "Full Name", Value = "fullName"
            });
            OrderBy.Add(new SelectListItem()
            {
                Text = "Reject Date", Value = "RejectDate"
            });
            OrderBy.Add(new SelectListItem()
            {
                Text = "Approved Date", Value = "ApprovedDate"
            });

            List <SelectListItem> ApplicationStatus = new List <SelectListItem>();

            ApplicationStatus.Add(new SelectListItem()
            {
                Text = "Rejected", Value = "Rejected"
            });
            ApplicationStatus.Add(new SelectListItem()
            {
                Text = "Approved", Value = "Approved"
            });

            var reportingViewModel = new ReportingViewModel()
            {
                OrderBy           = OrderBy,
                ApplicationStatus = ApplicationStatus
            };

            return(View("ApplicationRptView", reportingViewModel));
        }
Ejemplo n.º 26
0
 public ActionResult Index(ReportingViewModel model)
 {
     model.ReportingTreeViews = dbContext.Reportings.ToList();
     return(View(model));
 }
 public ReportingUpdateCommand(ReportingViewModel viewModel)
 {
     _viewModel = viewModel;
 }
		/// <summary>
		/// Handles the Loaded event of the UserControl control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
		private void UserControl_Loaded(object sender, RoutedEventArgs e)
		{
			if (isInitialized)
			{
				return;
			}
			this.ShowProgressBar();
			Task t = Task.Factory.StartNew(() =>
			{
				////log.InfoFormat("Preview test case with id: {0} and suite id {1}", this.TestCaseId, this.TestSuiteId);
				this.ReportingViewModel = new ReportingViewModel();
			});
			t.ContinueWith(antecedent =>
			{
				this.DataContext = this.ReportingViewModel;
				this.HideProgressBar();
				isInitialized = true;
			}, TaskScheduler.FromCurrentSynchronizationContext());
		}
Ejemplo n.º 29
0
        public ActionResult Search()
        {
            ReportingViewModel reportvm = new ReportingViewModel();

            return(View(reportvm));
        }
Ejemplo n.º 30
0
        public ActionResult projectRpt()
        {
            var donors = _donorsAppService.getAllDonors();
            List <SelectListItem> orderBy = new List <SelectListItem>();

            orderBy.Add(new SelectListItem()
            {
                Text = "Project Name", Value = "projectArabicName"
            });
            orderBy.Add(new SelectListItem()
            {
                Text = "year", Value = "year"
            });
            orderBy.Add(new SelectListItem()
            {
                Text = "Number of Families", Value = "numberOfFamilies"
            });
            var ReportingViewModel = new ReportingViewModel
            {
                Donors  = donors,
                OrderBy = orderBy
            };

            var reportViewer = new ReportViewer()
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Percentage(100),
            };

            ViewProjectDataTable PD = new ViewProjectDataTable();
            ProjectAdp           PA = new ProjectAdp("select * from ViewProject");

            PA.cmdTimeout = 0;
            String Wheresql = "";
            String OrderBy  = Request["OrderBy"];


            if (!string.IsNullOrWhiteSpace(Request["Donors"]))
            {
                Wheresql = CheckWhere(Wheresql) + " donorId=" + Request["Donors"];
            }

            if (Convert.ToInt32(Request["CheckedYear"]) == 0)
            {
                if (!string.IsNullOrWhiteSpace(Request["year"]))
                {
                    Wheresql = CheckWhere(Wheresql) + " year=" + Request["year"];
                }
            }

            if (Convert.ToInt32(Request["CheckedYear"]) == 1)
            {
                if (!string.IsNullOrWhiteSpace(Request["YearFrom"]) && !string.IsNullOrWhiteSpace(Request["YearTo"]))
                {
                    Wheresql = CheckWhere(Wheresql) + " year between " + Request["YearFrom"] + " and " + Request["YearTo"];
                }
            }


            if (!string.IsNullOrWhiteSpace(Request["Budget"]))
            {
                Wheresql = CheckWhere(Wheresql) + " budget=" + Request["Budget"];
            }

            if (!string.IsNullOrWhiteSpace(Request["Contractor"]))
            {
                Wheresql = CheckWhere(Wheresql) + " contractor Like N'%" + Request["Contractor"] + "%'";
            }

            if (!string.IsNullOrWhiteSpace(Request["locationFromMap"]))
            {
                Wheresql = CheckWhere(Wheresql) + " locationFromMap=" + Request["locationFromMap"];
            }

            if (!string.IsNullOrWhiteSpace(Request["projectPeriod"]))
            {
                Wheresql = CheckWhere(Wheresql) + " projectPeriod=" + Request["projectPeriod"];
            }

            if (!string.IsNullOrWhiteSpace(Request["Name"]))
            {
                Wheresql = CheckWhere(Wheresql) + " projectArabicName Like N'%" + Request["Name"] + "%' or projectEnglishName like N'%" + Request["Name"] + "%'";
            }



            if (Wheresql.Length == 0)
            {
                ProjectAdp PA2 = new ProjectAdp("select * from ViewProject order by " + OrderBy);
                PA2.cmdTimeout = 0;
                PA2.Adapter.Fill(PD);
            }
            else
            {
                PA.QueryStr(Wheresql, OrderBy);
                PA.Adapter.Fill(PD);
            }



            //if (!string.IsNullOrWhiteSpace(Request["Donors"]) && !string.IsNullOrWhiteSpace(Request["year"]))
            //{
            //    var donorId = Convert.ToInt32(Request["Donors"]);
            //    var year = Convert.ToInt32(Request["year"]);
            //    // PA.Fill(PD);
            //    PA.FillByDonorAndYear(PD, year, donorId);

            //}
            //else if (string.IsNullOrWhiteSpace(Request["Donors"]) && !string.IsNullOrWhiteSpace(Request["year"]))
            //{
            //    var year = Convert.ToInt32(Request["year"]);
            //    PA.FillByYear(PD,year);
            //}
            //else if (!string.IsNullOrWhiteSpace(Request["Donors"]) && string.IsNullOrWhiteSpace(Request["year"]))
            //{
            //    var donorId = Convert.ToInt32(Request["Donors"]);
            //    PA.FillByDonor(PD, donorId);
            //}
            //else
            //{
            //    PA.Fill(PD);
            //}



            reportViewer.LocalReport.ReportPath = @"Reporting\ProjectsReport.rdlc";

            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ProjectsDataSet", (object)PD));



            // System.Collections.Generic.List<ReportParameter> paramList = new System.Collections.Generic.List<ReportParameter>();

            //    paramList.Add(new ReportParameter("User1", this.User.Identity.Name));


            //  reportViewer.LocalReport.SetParameters(paramList);

            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View("ProjectRptView", ReportingViewModel));
        }
Ejemplo n.º 31
0
        public ActionResult ApplicationRpt()
        {
            List <SelectListItem> orderBy = new List <SelectListItem>();

            orderBy.Add(new SelectListItem()
            {
                Text = "Full Name", Value = "fullName"
            });
            orderBy.Add(new SelectListItem()
            {
                Text = "Reject Date", Value = "RejectDate"
            });
            orderBy.Add(new SelectListItem()
            {
                Text = "Approved Date", Value = "ApprovedDate"
            });

            List <SelectListItem> ApplicationStatus = new List <SelectListItem>();

            ApplicationStatus.Add(new SelectListItem()
            {
                Text = "Rejected", Value = "Rejected"
            });
            ApplicationStatus.Add(new SelectListItem()
            {
                Text = "Approved", Value = "Approved"
            });

            var reportingViewModel = new ReportingViewModel()
            {
                OrderBy           = orderBy,
                ApplicationStatus = ApplicationStatus
            };

            var reportViewer = new ReportViewer()
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Percentage(100),
            };

            ApplicationViewDataTable AD = new ApplicationViewDataTable();
            ApplicationAdp           AP = new ApplicationAdp("Select * From ApplicationView");

            AP.cmdTimeout = 0;
            String Wheresql = "";
            String OrderBy  = Request["OrderBy"];

            if (!string.IsNullOrWhiteSpace(Request["FullName"]))
            {
                Wheresql = CheckWhere(Wheresql) + " fullName Like N'%" + Request["FullName"] + "%'";
            }

            if (!string.IsNullOrWhiteSpace(Request["previousRestorationSource"]))
            {
                Wheresql = CheckWhere(Wheresql) + " previousRestorationSource Like N'%" + Request["previousRestorationSource"] + "%'";
            }

            if (!string.IsNullOrWhiteSpace(Request["ApprovedDateFrom"]) && !string.IsNullOrWhiteSpace(Request["ApprovedDateTo"]))
            {
                Wheresql = CheckWhere(Wheresql) + " format(ApprovedDate,'dd/mm/yyyy') between " + Request["ApprovedDateFrom"] + " and " + Request["ApprovedDateTo"];
            }

            if (!string.IsNullOrWhiteSpace(Request["RejectDateFrom"]) && !string.IsNullOrWhiteSpace(Request["RejectDateTo"]))
            {
                Wheresql = CheckWhere(Wheresql) + " RejectDate  between " + Request["RejectDateFrom"] + " and " + Request["RejectDateTo"];
            }

            if (!string.IsNullOrWhiteSpace(Request["otherOwnershipType"]))
            {
                Wheresql = CheckWhere(Wheresql) + " otherOwnershipType Like N'%" + Request["otherOwnershipType"] + "%'";
            }

            if (!string.IsNullOrWhiteSpace(Request["InterestedRepairingEntityName"]))
            {
                Wheresql = CheckWhere(Wheresql) + " interestedRepairingEntityName Like N'%" + Request["InterestedRepairingEntityName"] + "%'";
            }

            if (!string.IsNullOrWhiteSpace(Request["ApplicationStatus"]))
            {
                Wheresql = CheckWhere(Wheresql) + " ApplicationStatus= " + Request["ApplicationStatus"];
            }



            if (Wheresql.Length == 0)
            {
                ApplicationAdp AP2 = new ApplicationAdp("Select * From ApplicationView " + OrderBy);
                AP2.cmdTimeout = 0;
                AP2.Adapter.Fill(AD);
            }
            else
            {
                AP.QueryStr(Wheresql, OrderBy);
                AP.Adapter.Fill(AD);
            }

            foreach (DataRow row in AD.Rows)
            {
                var AppStatus = row["ApplicationStatus"].ToString();
                if (!string.IsNullOrWhiteSpace(AppStatus))
                {
                    var applicationStatus = Convert.ToInt32(row["ApplicationStatus"].ToString());
                    if (applicationStatus == 0)
                    {
                        row["AppStatus"] = "Rejected";
                    }
                    else
                    {
                        row["AppStatus"] = "Approved";
                    }
                }
                else
                {
                    row["AppStatus"] = "Not Processed";
                }
            }

            reportViewer.LocalReport.ReportPath = @"Reporting\ApplicationsReport.rdlc";

            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ApplicationDataSet", (object)AD));
            reportViewer.LocalReport.Refresh();
            ViewBag.ReportViewer = reportViewer;

            return(View("ApplicationRptView", reportingViewModel));
        }