Пример #1
0
        public IActionResult GetOptionListByKey(int PageIndex, int PageSize, string GroupKey, string EnumName, int IsHide)
        {
            string code    = "000000";
            var    pageSet = new PageSet(PageIndex, PageSize);

            var where = PredicateBuilder.True <Sys_Option>();
            if (string.IsNullOrEmpty(GroupKey))
            {
                return(ReturnJson("000200"));
            }
            if (!string.IsNullOrEmpty(EnumName))
            {
                where = where.And(p => EnumName.Contains(p.EnumName));
            }
            if (IsHide > 0)
            {
                where = where.And(p => p.IsHide == IsHide);
            }

            var list = _sysOptionService.GetPageList(where, pageSet, p => p.Orders, true, false);

            if (list.RecordCount == 0)
            {
                code = "000200";
            }
            return(ReturnJson(code, list));
        }
Пример #2
0
        public IActionResult GetPageList([FromQuery] FromGetSysUser model)
        {
            string  code    = "000000";
            PageSet pageSet = new PageSet(model.PageIndex, model.PageSize);

            var where = PredicateBuilder.True <Sys_User>();
            if (!string.IsNullOrEmpty(model.RealName))
            {
                where = where.And(n => model.RealName.Contains(n.RealName));
            }
            if (!string.IsNullOrEmpty(model.UserName))
            {
                where = where.And(n => model.UserName.Contains(n.UserName));
            }
            if (model.Status > 0)
            {
                where = where.And(n => n.Status == model.Status);
            }
            var pageList = _sysUserService.GetPageList(where, pageSet, p => new { p.Id, p.UserName, p.RealName, p.Sex, p.LastIp, p.Status, p.LastLogDate, p.HeadImgUrl, p.Mobile, p.Email }, p => p.LastLogDate, true);

            if (pageList.RecordCount == 0)
            {
                code = "000200";
            }

            return(ReturnJson(code, pageList));
        }
Пример #3
0
        public PageSet <AutoBodyTypeViewModel> GetAutoBodyTypeDT(DTParameters dTParameters)
        {
            var sortColumnName = dTParameters.Columns[dTParameters.Order[0].Column].Data;
            var sortDirection  = dTParameters.Order[0].Dir;

            IQueryable <AutoBodyType> result = unitOfWork.GetAutoSolutionContext().AutoBodyType.AsQueryable().OrderBy(x => x.BodyType);
            var TotalCount = result.Count();

            //if(sortColumnName == "autoBodyTypeName" && sortDirection == DTOrderDir.ASC)
            //{
            //    result = result.OrderBy(x => x.AutoBodyTypeName);
            //}
            //else if(sortColumnName== "autoBodyTypeName" && sortDirection== DTOrderDir.DESC)
            //{
            //    result = result.OrderByDescending(x => x.AutoBodyTypeName);
            //}

            var FinalResult = result.Skip(dTParameters.Start).Take(dTParameters.Length);

            var Data = autoMapper.Map <List <AutoBodyTypeViewModel> >(FinalResult);
            PageSet <AutoBodyTypeViewModel> pageSet = new PageSet <AutoBodyTypeViewModel>
            {
                draw            = dTParameters.Draw,
                recordsFiltered = TotalCount,
                recordsTotal    = TotalCount,
                result          = Data
            };

            return(pageSet);
        }
Пример #4
0
        public static void Run()
        {
            // ExStart:SaveAsMultipageTiff
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();

            // Open the document.
            Document doc = new Document(dataDir + "TestFile Multipage TIFF.doc");

            // ExStart:SaveAsTIFF
            // Save the document as multipage TIFF.
            doc.Save(dataDir + "TestFile Multipage TIFF_out.tiff");
            // ExEnd:SaveAsTIFF
            // ExStart:SaveAsTIFFUsingImageSaveOptions
            // Create an ImageSaveOptions object to pass to the Save method
            // Export various page ranges to multipage TIFF image.
            ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);

            PageSet pageSet = new PageSet(new PageRange(0, 2));

            options.PageSet         = pageSet;
            options.TiffCompression = TiffCompression.Ccitt4;
            options.Resolution      = 160;
            dataDir = dataDir + "TestFileWithOptions_out.tiff";
            doc.Save(dataDir, options);
            // ExEnd:SaveAsTIFFUsingImageSaveOptions
            // ExEnd:SaveAsMultipageTiff
            Console.WriteLine("\nDocument saved as multi-page TIFF successfully.\nFile saved at " + dataDir);
        }
Пример #5
0
        public Page <T> GetPage <T>(PageSet pageSet)
        {
            var page = new Page <T>();
            var sql  = $"select  {pageSet.column} from  {pageSet.table} where 1=1 {pageSet.sqlWhere} {pageSet.sqlOrder}   limit {pageSet.pageSize} offset {pageSet.pageIndex}-1";

            page.rows     = _dBService.AdminDB.QueryAsync <T>(sql).Result.ToList();
            page.totalNum = _dBService.AdminDB.QueryFirstAsync <int>($"select count(*) from {pageSet.table}").Result;
            return(page);
        }
Пример #6
0
        public IActionResult GetPageMenu([FromBody] PageSet page)
        {
            var result = new MsgResult();

            page.table = Menu.TK;
            var pageData = _accountService.GetPage <Menu>(page);

            result.data = pageData;
            return(ReJson(result));
        }
Пример #7
0
        public ActionResult GetList(int page, int stationId, int shopType)
        {
            HandleResult hr = new HandleResult();

            if (page < 1)
            {
                page = 1;
            }
            if (stationId < 0 || shopType < 0)
            {
                hr.Message = "参数错误";
                return(Json(hr));
            }
            if (shopType <= 0)
            {
                shopType = Enums.eShopType.地铁商铺.GetHashCode();
            }
            PageSet pageSet = new PageSet()
            {
                PageIndex = page, PageSize = 20
            };
            List <ShopListEntity> list = ShopListBLL.GetPageList(stationId, shopType, pageSet);
            List <Dictionary <string, object> > listResult = new List <Dictionary <string, object> >();

            foreach (var item in list)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("Id", item.Id);
                dict.Add("StationId", item.StationId);
                dict.Add("ShopType", item.ShopType);
                dict.Add("ShopImageUrl", string.IsNullOrWhiteSpace(item.ShopImageUrl) ? "img/st_icon.jpg" : "/upload/" + item.ShopImageUrl);
                dict.Add("ShopName", item.ShopName);
                dict.Add("Title", item.Title);
                dict.Add("Summury", item.Summury);
                dict.Add("ShopNo", item.ShopNo);
                dict.Add("Address", item.Address);
                dict.Add("AddTime", item.AddTime);
                listResult.Add(dict);
            }
            var data = new
            {
                list = listResult
            };

            hr.StatsCode = 200;
            hr.Data      = data;
            hr.Message   = "";
            return(Json(hr));
        }
        private static void SaveImageToOnebitPerPixel(Document doc, string dataDir)
        {
            // ExStart:SaveImageToOnebitPerPixel
            ImageSaveOptions opt = new ImageSaveOptions(SaveFormat.Png);

            PageSet pageSet = new PageSet(new PageRange(1, 1));

            opt.PageSet        = pageSet;
            opt.ImageColorMode = ImageColorMode.BlackAndWhite;
            opt.PixelFormat    = ImagePixelFormat.Format1bppIndexed;

            dataDir = dataDir + "Format1bppIndexed_Out.Png";
            doc.Save(dataDir, opt);
            // ExEnd:SaveImageToOnebitPerPixel
            Console.WriteLine("\nDocument converted to PNG successfully with 1 bit per pixel.\nFile saved at " + dataDir);
        }
Пример #9
0
        public ActionResult GetList(int stationId, int shopType, int page = 1, int pageSize = 10)
        {
            HandleResult hr      = new HandleResult();
            PageSet      pageSet = new PageSet()
            {
                PageIndex = page, PageSize = pageSize
            };

            ViewBag.Data = null;
            List <ShopListEntity> list = ShopListBLL.GetPageList(stationId, shopType, pageSet);

            ViewBag.Data        = list;
            ViewBag.RecordCount = pageSet.RecordCount;
            ViewBag.TotalPage   = Math.Ceiling(pageSet.RecordCount / (pageSet.PageSize * 1.0));
            return(PartialView("PartialList"));
        }
Пример #10
0
        public IActionResult GetOptionList(int PageIndex, int PageSize, string GroupName)
        {
            string code    = "000000";
            var    pageSet = new PageSet(PageIndex, PageSize);

            var where = PredicateBuilder.True <Sys_Option>();
            if (!string.IsNullOrEmpty(GroupName))
            {
                where = where.And(p => GroupName.Contains(p.GroupName));
            }

            var list = _sysOptionService.GetPageList(where, pageSet, p => p.CrtDate, true, false);

            if (list.RecordCount == 0)
            {
                code = "000200";
            }
            return(ReturnJson(code, list));
        }
Пример #11
0
        /// <summary>
        /// 获取列表-分页
        /// </summary>
        /// <param name="key"></param>
        /// <param name="visible"></param>
        /// <returns></returns>
        public static List <ShopListEntity> GetPageList(int stationId, int shopType, PageSet pageSet)
        {
            string strWhere = string.Empty;

            if (stationId > 0)
            {
                strWhere += string.Format(" StationId={0} AND ", stationId);
            }
            if (shopType > 0)
            {
                strWhere += string.Format(" ShopType={0} AND ", shopType);
            }
            if (!string.IsNullOrEmpty(strWhere))
            {
                strWhere = strWhere.Remove(strWhere.Length - 4, 4);
            }
            pageSet.RecordCount = ShopListDAL.SearchCount(strWhere);
            return(ShopListDAL.Search(strWhere, "Id desc", (pageSet.PageIndex - 1) * pageSet.PageSize, pageSet.PageSize));
        }
Пример #12
0
        public IActionResult GetAdminRolesList(int PageIndex, int PageSize, int IsForbidden, string RoleName)
        {
            string code    = "000000";
            var    pageSet = new PageSet(PageIndex, PageSize);

            var where = PredicateBuilder.True <Sys_AdminRole>();
            if (!string.IsNullOrEmpty(RoleName))
            {
                where = where.And(p => RoleName.Contains(p.RoleName));
            }
            if (IsForbidden > 0)
            {
                where = where.And(p => p.IsForbidden == IsForbidden);
            }
            var list = _sysAdminRoleService.GetPageList(where, pageSet, p => p.CrtDate, true, false);

            if (list.RecordCount == 0)
            {
                code = "000200";
            }
            return(ReturnJson(code, list));
        }
        public IActionResult GetAutoManufacturerU(DTParameters dTParameters)
        {
            PageSet <AutoManufacturerViewModel> data = autoManufacturerService.GetAutoManufacturerDT(dTParameters);

            return(Json(data));
        }
Пример #14
0
        public void Exportar(IEnumerable <DocumentoRepositorio> documentos, string ruta, bool zip, Func <DocumentoRepositorio, string> rutaInterna)
        {
            foreach (DocumentoRepositorio documento in documentos)
            {
                DocumentInfo informacionDocumento = documento.DocumentoAsociado as DocumentInfo;
                string       directorioInterno    = rutaInterna.Invoke(documento);

                //Crear los directorios internos
                string[] subdirectorios = directorioInterno.Split('\\');
                string   rutaActual     = ruta;
                rutaActual += !rutaActual.EndsWith("\\") ? "\\" : "";

                for (int i = 0; i < subdirectorios.Length; i++)
                {
                    rutaActual += subdirectorios[i];
                    DirectoryInfo directorio = new DirectoryInfo(rutaActual);
                    if (!directorio.Exists)
                    {
                        directorio.Create();
                    }

                    rutaActual += "\\";
                }

                rutaActual += !rutaActual.EndsWith("\\") ? "\\" : "";

                var exportadorDocumentos = new DocumentExporter();


                if (informacionDocumento.IsElectronicDocument)
                {
                    if (!File.Exists(rutaActual + documento.Nombre + "." + informacionDocumento.Extension))
                    {
                        documento.Nombre = documento.Nombre.Replace("/", "_").Replace("*", "_").Replace("\\", "_").Replace(":", "_").Replace("\"", "_").Replace('<', '_').Replace('>', '_').Replace('|', '_');
                        exportadorDocumentos.ExportElecDoc(informacionDocumento, rutaActual + documento.Nombre + "." + informacionDocumento.Extension);
                    }
                }
                else
                {
                    //En ocasiones hay documentos TIFF (escaneados) que no tienen páginas, en este caso bypasear
                    if (informacionDocumento.PageCount <= 0)
                    {
                        continue;
                    }
                    var rangoPaginas         = new PageRange(1, informacionDocumento.PageCount);
                    var configuracionPaginas = new PageSet(rangoPaginas);

                    string nombre = informacionDocumento.Name;
                    if (nombre.Contains("*") && string.IsNullOrEmpty(informacionDocumento.TemplateName))
                    {
                        nombre = informacionDocumento.TemplateName;
                    }
                    nombre = nombre.Replace("/", "_").Replace("*", "_").Replace("\\", "_").Replace(":", "_").Replace("\"", "_").Replace('<', '_').Replace('>', '_').Replace('|', '_');
                    if (!File.Exists(rutaActual + nombre + ".pdf"))
                    {
                        exportadorDocumentos.ExportPdf(informacionDocumento, configuracionPaginas, PdfExportOptions.None, rutaActual + nombre + ".pdf");
                    }
                }
            }

            if (zip)
            {
                Zippear(ruta);
            }
        }
Пример #15
0
 public PageList <Sys_Option> GetPageList(Expression <Func <Sys_Option, bool> > where, PageSet pageSet, Expression <Func <Sys_Option, object> > orderBy, bool isDesc = false, bool isPageNavStr = false)
 {
     return(_repository.GetPageList(where, pageSet, orderBy, isDesc));
 }
Пример #16
0
        void Execute(string[] args)
        {
            PDFNet.Initialize();

            // Optional: Set ICC color profiles to fine tune color conversion
            // for PDF 'device' color spaces. You can use your own ICC profiles.
            // Standard Adobe color profiles can be download from Adobes site:
            // http://www.adobe.com/support/downloads/iccprofiles/iccprofiles_win.html
            //
            // Simply drop all *.icc files in PDFNet resource folder or you specify
            // the full pathname.
            try
            {
                // PDFNet.SetColorManagement();
                // PDFNet.SetDefaultDeviceCMYKProfile("USWebCoatedSWOP.icc"); // will search in PDFNet resource folder.
                // PDFNet.SetDefaultDeviceRGBProfile("AdobeRGB1998.icc");
            }
            catch (Exception)
            {
                Console.WriteLine("The specified color profile was not found.");
            }

            // Optional: Set predefined font mappings to override default font
            // substitution for documents with missing fonts. For example:
            //---
            // PDFNet.AddFontSubst("StoneSans-Semibold", "C:/WINDOWS/Fonts/comic.ttf");
            // PDFNet.AddFontSubst("StoneSans", "comic.ttf");  // search for 'comic.ttf' in PDFNet resource folder.
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_Identity, "C:/WINDOWS/Fonts/arialuni.ttf");
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_Japan1, "C:/Program Files/Adobe/Acrobat 7.0/Resource/CIDFont/KozMinProVI-Regular.otf");
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_Japan2, "c:/myfonts/KozMinProVI-Regular.otf");
            //
            // If fonts are in PDFNet resource folder, it is not necessary to specify
            // the full path name. For example,
            //---
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_Korea1, "AdobeMyungjoStd-Medium.otf");
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_CNS1, "AdobeSongStd-Light.otf");
            // PDFNet.AddFontSubst(PDFNet.CharacterOrdering.e_GB1, "AdobeMingStd-Light.otf");

            string input_path = "../../TestFiles/";             // Relative path to the folder containing test files.

            try
            {
                // Open the PDF document.
                Console.WriteLine("Opening the input file...");
                using (pdfdoc = new PDFDoc(input_path + "tiger.pdf"))
                {
                    pdfdoc.InitSecurityHandler();


                    //////////////////////////////////////////////////////////////////////////
                    // Example 1: use the PDF::Print::StartPrintJob interface
                    // This is silent (no progress dialog) and blocks until print job is at spooler
                    // The rasterized print job is compressed before sending to printer
                    Console.WriteLine("Printing the input file using PDF.Print.StartPrintJob...");

                    // Setup printing options:
                    PrinterMode printerMode = new PrinterMode();
                    printerMode.SetAutoCenter(true);
                    printerMode.SetAutoRotate(true);
                    printerMode.SetCollation(true);
                    printerMode.SetCopyCount(1);
                    printerMode.SetDPI(300);                     // regardless of ordering, an explicit DPI setting overrides the OutputQuality setting
                    printerMode.SetDuplexing(PrinterMode.DuplexMode.e_Duplex_Auto);
                    printerMode.SetNUp(PrinterMode.NUp.e_NUp_1_1, PrinterMode.NUpPageOrder.e_PageOrder_LeftToRightThenTopToBottom);
                    printerMode.SetOrientation(PrinterMode.Orientation.e_Orientation_Portrait);
                    printerMode.SetOutputAnnot(PrinterMode.PrintContentTypes.e_PrintContent_DocumentAndAnnotations);

                    // If the XPS print path is being used, then the printer spooler file will
                    // ignore the grayscale option and be in full color
                    printerMode.SetOutputColor(PrinterMode.OutputColor.e_OutputColor_Grayscale);
                    printerMode.SetOutputPageBorder(false);
                    printerMode.SetOutputQuality(PrinterMode.OutputQuality.e_OutputQuality_Medium);
                    printerMode.SetPaperSize(new Rect(0, 0, 612, 792));
                    PageSet pagesToPrint = new PageSet(1, pdfdoc.GetPageCount(), PageSet.Filter.e_all);

                    // You can get the name of the default printer by using:
                    // PrinterSettings ps = new PrinterSettings();
                    // String printerName   ps.PrinterName();
                    // however Print.StartPrintJob can also determine this for you, just pass an empty printer name

                    // Print the document on the default printer, name the print job the name of the
                    // file, print to the printer not a file, and use printer options:
                    Print.StartPrintJob(pdfdoc, "", pdfdoc.GetFileName(), "", pagesToPrint, printerMode, null);


                    //////////////////////////////////////////////////////////////////////////
                    // Example 2: use the .Net PrintDocument class and PDFDraw rasterizer
                    // This will pop up a progress dialog

                    // Start printing from the first page
                    pageitr = pdfdoc.GetPageIterator();
                    pdfdraw = new PDFDraw();
                    pdfdraw.SetPrintMode(true);
                    pdfdraw.SetRasterizerType(PDFRasterizer.Type.e_BuiltIn);

                    // Create a printer
                    PrintDocument printer = new PrintDocument();

                    // name the document to be printed
                    printer.DocumentName = pdfdoc.GetFileName();

                    // Set the PrintPage delegate which will be invoked to print each page
                    printer.PrintPage += new PrintPageEventHandler(PrintPage);

                    Console.WriteLine("Printing the input file using .NET PrintDocument and PDFDraw...");
                    printer.Print();                            // Start printing

                    pdfdraw.Dispose();                          // Free allocated resources (generally a good idea when printing many documents).
                }
            }
            catch (PDFNetException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #17
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     PageSet.OnPageChange("李亚杰点击用户控件");
 }
Пример #18
0
 public PageList <Sys_AdminPermission> GetPageList(Expression <Func <Sys_AdminPermission, bool> > where, PageSet pageSet, Expression <Func <Sys_AdminPermission, object> > orderBy, bool isDesc = false, bool isPageNavStr = false)
 {
     throw new NotImplementedException();
 }
Пример #19
0
 public PageList <TResult> GetPageList <TResult>(Expression <Func <Sys_User, bool> > where, PageSet pageSet, Expression <Func <Sys_User, TResult> > obj, Expression <Func <Sys_User, object> > orderBy, bool isDesc = false, bool isPageNavStr = false)
 {
     return(_repository.GetPageList(where, pageSet, obj, orderBy, isDesc, isPageNavStr));
 }