Esempio n. 1
0
        public string RemoteSearch(
            string keyPrevBoundary,
            string keyNextBoundary,
            FilterIncomeReportViewModel SearchViewModel,
            int numItemsPerPage = 20)
        {
            if (!Session.isUserSession())
            {
                return("");
            }

            /*Navigation*/
            IncomeReportRemoteSearchViewModel DataTableViewModel;
            //Parse JsonQuery into stuff


            //Default
            var authorizeGroups = ((TaiKhoan)Session["User"]).Nhom;

            if (!string.IsNullOrEmpty(keyNextBoundary) ||
                string.IsNullOrEmpty(keyPrevBoundary)) // Move next and default
            {
                DataTableViewModel = IncomeReport_BUS.getNextIncomeReports(keyNextBoundary, numItemsPerPage, SearchViewModel, authorizeGroups);
            }
            else
            {
                DataTableViewModel = IncomeReport_BUS.getPrevIncomeReports(keyPrevBoundary, numItemsPerPage);
            }

            //Serialize thành json
            string json = JsonConvert.SerializeObject(DataTableViewModel);

            return(json);
        }
Esempio n. 2
0
        //POST : ViewDetails/5


        //POST : DownExcel
        public void DownExcel(string JsonFilterQuery = "")
        {
            if (!Session.isUserSession())
            {
                return;
            }

            string       myName = Server.UrlEncode("TruyVanDoanhThu_" + DateTime.Now.ToShortDateString() + ".xlsx");
            MemoryStream stream = (MemoryStream)IncomeReport_BUS.createExcel();

            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment; filename=" + myName);
            Response.ContentType = "application/vnd.ms-excel";
            Response.BinaryWrite(stream.ToArray());
            Response.End();
        }