コード例 #1
0
ファイル: ReportData.cs プロジェクト: madankumar6/CSharp
        public ReportViewModel GetSummaryReport(ReportViewModel reportModel)
        {
            List<ReportResultViewModel> rData = new List<ReportResultViewModel>();

            try
            {
                DataTable dt = _DAL.Data.GetData(_DAL.DataBase.Api, System.Data.CommandType.StoredProcedure,
                    "Report_GetASummaryReport", new List<SqlParameter>() {
                    new SqlParameter("StartDate", reportModel.Parameter.StartDate),
                    new SqlParameter("EndDate", reportModel.Parameter.EndDate)
                }.ToArray());

                if (dt != null || dt.Rows.Count > 0)
                {
                    rData = dt.AsEnumerable().Select(m =>
                        new ReportResultViewModel()
                        {
                            SNo = Convert.ToInt32(m["SNo"]),
                            StartDate = Convert.ToDateTime(m["StartDate"]),
                            EndDate = Convert.ToDateTime(m["EndDate"]),
                            Lat = Convert.ToString(m["Lat"]),
                            Lang = Convert.ToString(m["Lang"]),
                            OnAcc = Convert.ToBoolean(m["OnAcc"])
                        }
                    ).ToList();
                }
            }
            catch (Exception ex)
            {
            }

            reportModel.Results = rData;

            return reportModel;
        }
コード例 #2
0
        public ActionResult Summary(ReportViewModel reportModel)
        {
            //ReportViewModel reportModel = new ReportViewModel();

            reportModel.Results = new List<ReportResultViewModel>();

            reportModel = new ReportData().GetSummaryReport(reportModel);
            return View(reportModel);
        }
コード例 #3
0
ファイル: ReportData.cs プロジェクト: madankumar6/CSharp
        public ReportViewModel GetSpeedReport(ReportViewModel reportModel)
        {
            List<ReportResultViewModel> rData = new List<ReportResultViewModel>();

            try
            {
                DataTable dt = _DAL.Data.GetData(_DAL.DataBase.Api, System.Data.CommandType.StoredProcedure,
                    "Report_SpeedReport", new List<SqlParameter>() {
                    new SqlParameter("StartDate", reportModel.Parameter.StartDate),
                    new SqlParameter("EndDate", reportModel.Parameter.EndDate),
                    new SqlParameter("Speed", reportModel.Parameter.Speed),
                    new SqlParameter("DeviceId",reportModel.Parameter.DeviceId)
                }.ToArray());

                if (dt != null || dt.Rows.Count > 0)
                {
                    rData = dt.AsEnumerable().Select(m =>
                        new ReportResultViewModel()
                        {
                            Speed = Convert.ToInt32(m["Speed"]),
                            //StartDate = Convert.ToDateTime(m["StartDate"]),
                            //EndDate = Convert.ToDateTime(m["EndDate"]),
                            Lat= Convert.ToString(m["Latitude"]),
                            Lang = Convert.ToString(m["Longitude"]),
                            DeviceId = Convert.ToString(m["DeviceId"]),
                            DeviceDataTime = Convert.ToDateTime(m["DeviceDataTime"])
                        }
                    ).ToList();
                }
            }
            catch (Exception ex)
            {
            }

            reportModel.Results = rData;

            return reportModel;
        }
コード例 #4
0
        public ActionResult SpeedReport(ReportViewModel reportModel)
        {
            reportModel.Results = new List<ReportResultViewModel>();
            reportModel = new ReportData().GetSpeedReport(reportModel);

            ReportParameterViewModel model = new ReportParameterViewModel();
            model.DeviceList = new List<SelectListItem>();
            var CurrentUser = Session["UserData"] as Admin;

            // Get list of devices
            DataTable dt = Data.GetData(DataBase.Api, CommandType.StoredProcedure, "Api_GetDeviceList", new List<SqlParameter>() {
                    new SqlParameter("UserId", Guid.Parse(CurrentUser.UserId.ToString())) }.ToArray());
            if (dt != null || dt.Rows.Count > 0)
            {
                model.DeviceList = dt.AsEnumerable().Select(m => new SelectListItem()
                {
                    Value = Convert.ToString(m["DeviceId"]),
                    Text = Convert.ToString(m["DeviceId"])
                }).ToList();
            }
            reportModel.Parameter = model;
            return View(reportModel);
        }
コード例 #5
0
 public ActionResult Summary()
 {
     ReportViewModel reportModel = new ReportViewModel();
     reportModel.Parameter = new ReportParameterViewModel();
     return View(reportModel);
 }