Пример #1
0
        public JsonResult Data([Bind(Include = "PartNr,DateFrom,DateTo,Type,Top")] DashboardSearchModel searchModel)
        {
            IDashboardService ds = new DashboardService(Properties.Settings.Default.db);

            Dictionary <string, List <DashboardItem> > data = new Dictionary <string, List <DashboardItem> >();

            // List<DashboardItem> items = new List<DashboardItem>();
            switch (searchModel.Type)
            {
            case 100:
                data = ds.GetPartStockDash(searchModel);
                break;

            case 200:
                data = ds.GetPartCompleteRateDash(searchModel);
                break;

            case 300:
                searchModel.DateFrom = DateTime.Now.Date.AddDays(-8);
                searchModel.DateTo   = DateTime.Now.Date.AddDays(-1);
                data = ds.GetPartTopRateDash(searchModel);
                break;

            default:
                break;
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public static async Task <IEnumerable <EventSummaryModel> > GetEventSummary(DashboardSearchModel searchModel)
        {
            List <EventSummaryModel> modelResult = new List <EventSummaryModel>();
            EventSummaryModel        report      = null;

            if (searchModel != null)
            {
                object[] param  = new object[] { searchModel.OrganizationUrl, searchModel.StartDate, searchModel.EndDate };
                var      result = await ColligoO365RMOManager <DashboardChartData> .ExecuteSqlQueryAsync(Procedure.UspReportChartData, param);

                //converT data to framework model
                if (result != null && result.Any())
                {
                    Type source      = typeof(DashboardChartData);
                    Type destination = typeof(EventSummaryModel);
                    foreach (var item in result)
                    {
                        report = new EventSummaryModel();
                        CopyHelper.Copy(source, item, destination, report);
                        modelResult.Add(report);
                    }
                }
            }
            return(modelResult);
        }
Пример #3
0
 public IHttpActionResult GetDashboard(DashboardSearchModel model)
 {
     try
     {
         return(Ok());
     }
     catch (Exception ex)
     {
         return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)));
     }
 }
Пример #4
0
 public async Task <IEnumerable <EventSummaryModel> > GetEventSummary(DashboardSearchModel searchModel)
 {
     try
     {
         return(await DashboardManager.GetEventSummary(searchModel));
     }
     catch (Exception ex)
     {
         _logger.Error("GetEventSummary-- error- ", ex);
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Problem in GetEventSummary"));
     }
 }
Пример #5
0
        public string GetContentAuditSummary(string criteria)
        {
            ResetToken();
            bool error = false;
            DashboardSearchModel          model     = JsonHelper.ConvertToObject <DashboardSearchModel>(criteria);
            List <ContentLogSummaryModel> apiResult = GetManyByPostFromAPI <DashboardSearchModel, ContentLogSummaryModel>(model, RMAdminAPI.GetContentAuditSummary, out error);

            if (error || apiResult == null)
            {
                return("fail");
            }
            return(JsonHelper.ConvertToJson(apiResult));
        }
Пример #6
0
        public string SearchDashboardReport(string criteria)
        {
            ResetToken();
            bool error = false;
            DashboardSearchModel model     = JsonHelper.ConvertToObject <DashboardSearchModel>(criteria);
            EventReportModel     apiResult = PostToApi <DashboardSearchModel, EventReportModel>(RMAdminAPI.SearchDashboardReport, model, out error);

            if (error || apiResult == null)
            {
                return("fail");
            }
            return(JsonHelper.ConvertToJson(apiResult));
        }
Пример #7
0
        public ActionResult StockReport(int?page)
        {
            int pageIndex = PagingHelper.GetPageIndex(page);

            DashboardSearchModel q = new DashboardSearchModel();

            IStockSumRecordService sss = new StockSumRecordService(Properties.Settings.Default.db);

            IPagedList <StockSumRecord> stockSumRecord = sss.SearchStockReport(q).ToPagedList(pageIndex, Properties.Settings.Default.pageSize);

            ViewBag.Query = q;

            return(View(stockSumRecord));
        }
Пример #8
0
        public ActionResult SearchStockReports([Bind(Include = "PartNr, DateFrom, DateTo")] DashboardSearchModel q)
        {
            int pageIndex = 0;

            int.TryParse(Request.QueryString.Get("page"), out pageIndex);
            pageIndex = PagingHelper.GetPageIndex(pageIndex);

            IStockSumRecordService sss = new StockSumRecordService(Properties.Settings.Default.db);

            IPagedList <StockSumRecord> stockSumRecord = sss.SearchStockReport(q).ToPagedList(pageIndex, Properties.Settings.Default.pageSize);

            ViewBag.Query = q;

            return(View("StockReport", stockSumRecord));
        }
Пример #9
0
        public ActionResult Dashboard()
        {
            decimal?USER_NO = Session["sess_USER_NO"] as decimal?;

            DashboardSearchModel model = new DashboardSearchModel();
            ObjectResult <DASHBOARD_REPORT_Result> dashboard = null;

            model.Search_AM_User = null;

            DateTime now             = DateTime.Now;
            DateTime FirstDayOfMonth = new DateTime(now.Year, now.Month, 1);

            model.Search_Date_From = FirstDayOfMonth;

            model.Search_Date_To = DateTime.Now;

            if (!string.IsNullOrEmpty(Request.QueryString["Search"]))
            {
                if (!string.IsNullOrEmpty(Request.QueryString["Search_AM_User"]))
                {
                    model.Search_AM_User = decimal.Parse(Request.QueryString["Search_AM_User"]);
                }

                if (!string.IsNullOrEmpty(Request.QueryString["Search_Date_From"]))
                {
                    model.Search_Date_From = DateTime.Parse(Request.QueryString["Search_Date_From"]);
                }

                if (!string.IsNullOrEmpty(Request.QueryString["Search_Date_To"]))
                {
                    model.Search_Date_To = DateTime.Parse(Request.QueryString["Search_Date_To"]);
                }
            }

            dashboard = db.DASHBOARD_REPORT(null, model.Search_AM_User, USER_NO,
                                            model.Search_Date_From, model.Search_Date_To);

            ViewBag.Search_Model = model;

            return(View(dashboard));
        }
Пример #10
0
        public void ExportStockReport([Bind(Include = "PartNr, DateFrom, DateTo")] DashboardSearchModel q)
        {
            IStockSumRecordService sss = new StockSumRecordService(Properties.Settings.Default.db);

            List <StockSumRecord> stockSumRecords = sss.SearchStockReport(q).ToList();

            ViewBag.Query = q;

            MemoryStream ms = new MemoryStream();

            using (StreamWriter sw = new StreamWriter(ms, Encoding.UTF8))
            {
                List <string> head = new List <string> {
                    " No.", "PartNr", "Quantity", "Date"
                };
                sw.WriteLine(string.Join(Properties.Settings.Default.csvDelimiter, head));
                for (var i = 0; i < stockSumRecords.Count; i++)
                {
                    List <string> ii = new List <string>();
                    ii.Add((i + 1).ToString());
                    ii.Add(stockSumRecords[i].partNr);
                    ii.Add(stockSumRecords[i].quantity.ToString());
                    ii.Add(stockSumRecords[i].date.ToString());
                    sw.WriteLine(string.Join(Properties.Settings.Default.csvDelimiter, ii.ToArray()));
                }
                //sw.WriteLine(max);
            }
            var filename    = "StockReport" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv";
            var contenttype = "text/csv";

            Response.Clear();
            Response.ContentEncoding = Encoding.UTF8;
            Response.ContentType     = contenttype;
            Response.AddHeader("content-disposition", "attachment;filename=" + filename);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.BinaryWrite(ms.ToArray());
            Response.End();
        }
Пример #11
0
        public static async Task <EventReportModel> GetEventReport(DashboardSearchModel searchModel)
        {
            EventReportModel report = null;

            if (searchModel != null)
            {
                object[] param  = new object[] { searchModel.OrganizationUrl, searchModel.StartDate, searchModel.EndDate, searchModel.Status };
                var      result = await ColligoO365RMOManager <DashboardResult> .ExecuteSqlQueryAsync(Procedure.UspReportADGAgent, param);

                //converT data to framework model
                if (result != null && result.Any())
                {
                    Type source      = typeof(DashboardResult);
                    Type destination = typeof(EventReportModel);
                    foreach (var item in result)
                    {
                        report = new EventReportModel();
                        CopyHelper.Copy(source, item, destination, report);
                        break;
                    }
                }
            }
            return(report);
        }
Пример #12
0
        public static async Task <IEnumerable <ContentLogSummaryModel> > GetContentAuditSummary(DashboardSearchModel searchModel)
        {
            List <ContentLogSummaryModel> modelResult = new List <ContentLogSummaryModel>();
            ContentLogSummaryModel        report      = null;

            if (searchModel != null)
            {
                object[] param  = new object[] { searchModel.OrganizationUrl, searchModel.SearchTerm, searchModel.PageNumber, searchModel.PageSize };
                var      result = await ColligoO365RMOManager <ContentAuditSummary> .ExecuteSqlQueryAsync(Procedure.UspReportContentAuditSummary, param);

                //converT data to framework model
                if (result != null && result.Any())
                {
                    Type source      = typeof(ContentAuditSummary);
                    Type destination = typeof(ContentLogSummaryModel);
                    foreach (var item in result)
                    {
                        report = new ContentLogSummaryModel();
                        CopyHelper.Copy(source, item, destination, report);
                        modelResult.Add(report);
                    }
                }
            }
            return(modelResult);
        }