当前位置: 首页>>代码示例>>C#>>正文


C# List.Where方法代码示例

本文整理汇总了C#中iTextSharp.text.List.Where方法的典型用法代码示例。如果您正苦于以下问题:C# List.Where方法的具体用法?C# List.Where怎么用?C# List.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.Where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsCurrentUserReviewer

        private bool IsCurrentUserReviewer(List<Model.DTO.Appraisal.Reviewer> reviewers)
        {
            bool boo_is_reviewer = false;

            if (!Lib.Utility.Common.IsNullOrEmptyList(reviewers))
            {
                var var_approvers = reviewers.Where(rec => rec.EmployeeId == CurrentUser.Id);

                if (!Lib.Utility.Common.IsNullOrEmptyList(var_approvers))
                {
                    boo_is_reviewer = true;
                }
            }
            return boo_is_reviewer;
        }
开发者ID:kyoliumiao,项目名称:eHR-Phase2,代码行数:15,代码来源:HomeController.cs

示例2: Index


//.........这里部分代码省略.........
                    Logger.Debug("Job Object" + Newtonsoft.Json.JsonConvert.SerializeObject(ljob));

                    //FOr Regional Manager
                    if (Session["UserType"] != null && !string.IsNullOrEmpty(Session["UserType"].ToString()) && Session["UserType"].ToString() == "ENT_U_RM" && Session["UserGUID"] != null)
                    {
                        OrganizationUsersMap OrgUserMap = _IOrganizationRepository.GetOrganizationUserMapByUserGUID(new Guid(Session["UserGUID"].ToString()), ljob.OrganizationGUID);
                        if (OrgUserMap != null)
                        {
                            ljob.RegionGUID = OrgUserMap.RegionGUID;
                            _market.RegionGUID = OrgUserMap.RegionGUID;
                        }
                    }

                    //check the current user is Field Manager or not
                    if (Session["UserType"] != null && !string.IsNullOrEmpty(Session["UserType"].ToString()) && Session["UserType"].ToString() == "ENT_U" && Session["UserGUID"] != null)
                    {
                        GlobalUser globalUser = _IGlobalUserRepository.GetGlobalUserByID(new Guid(Session["UserGUID"].ToString()));
                        if (globalUser != null)
                        {
                            ljob.AssignedUserGUID = globalUser.UserGUID;
                            _market.FMUserID = globalUser.USERID;
                        }
                    }

                    List<Job> lstorevisit = _IJobRepository.GetStoreVisitJobs(ljob);
                    List<Market> lstorenonvisit = new List<Market>();
                    lstorenonvisit = _IMarketRepository.GetStoreNonVisit(_market);
                    if (lstorevisit != null && lstorevisit.Count > 0)
                    {
                        ViewBag.Visit_Search = Visit_Search;
                        if (!string.IsNullOrEmpty(Visit_Search))
                        {
                            Visit_Search = Visit_Search.ToLower();
                            lstorevisit = lstorevisit.Where(
                                p => (!String.IsNullOrEmpty(_IRegionRepository.GetRegionNameByRegionGUID(new Guid(p.RegionGUID.ToString()))) && _IRegionRepository.GetRegionNameByRegionGUID(new Guid(p.RegionGUID.ToString())).ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(p.CustomerStopGUID.ToString()) && _IMarketRepository.GetMarketByID(new Guid(p.CustomerStopGUID.ToString())).MarketID.ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(p.PONumber) && _IMarketRepository.GetMarketByCustomerID(p.OrganizationGUID, _IPORepository.GetPObyPoNumber(p.PONumber).PlaceID, _IPORepository.GetPObyPoNumber(p.PONumber).MarketID).MarketID.ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(p.CustomerStopGUID.ToString()) && _IMarketRepository.GetMarketByID(new Guid(p.CustomerStopGUID.ToString())).MarketName.ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(p.PONumber) && _IMarketRepository.GetMarketByCustomerID(p.OrganizationGUID, _IPORepository.GetPObyPoNumber(p.PONumber).PlaceID, _IPORepository.GetPObyPoNumber(p.PONumber).MarketID).MarketName.ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(_IJobRepository.GetStatusName((int)p.StatusCode)) && _IJobRepository.GetStatusName((int)p.StatusCode).ToLower().Contains(Visit_Search))
                            || (!String.IsNullOrEmpty(_IUserProfileRepository.GetUserProfileByUserID(_IGlobalUserRepository.GetGlobalUserByID(new Guid(p.ManagerUserGUID.ToString())).UserGUID, p.OrganizationGUID).ToString()) && _IUserProfileRepository.GetUserProfileByUserID(_IGlobalUserRepository.GetGlobalUserByID(new Guid(p.ManagerUserGUID.ToString())).UserGUID, p.OrganizationGUID).ToString().ToLower().Contains(Visit_Search))).ToList();
                        }

                        visit_TotalRecord = lstorevisit.ToList().Count;
                        visit_TotalPage = (visit_TotalRecord / (int)ViewBag.pageVisitCountValue) + ((visit_TotalRecord % (int)ViewBag.pageVisitCountValue) > 0 ? 1 : 0);

                        ViewBag.Visit_TotalRows = visit_TotalRecord;
                        lstorevisit = lstorevisit.OrderBy(a => a.OrganizationGUID).Skip(((page - 1) * (int)ViewBag.pageVisitCountValue)).Take((int)ViewBag.pageVisitCountValue).ToList();

                        foreach (Job job in lstorevisit)
                        {
                            StoreVisit storevisit = ConvertToStoreVisit(job);
                            if (storevisit != null)
                            {
                                pStoreVisitReports.StoreVisitList.Add(storevisit);
                            }
                        }
                    }

                    // Logger.Debug("Store Non Visit Count : " + lstorenonvisit.Count);
                    if (lstorenonvisit != null && lstorenonvisit.Count > 0)
                    {
                        ViewBag.NonVisit_Search = NonVisit_Search;
                        if (!string.IsNullOrEmpty(NonVisit_Search))
                        {
                            NonVisit_Search = NonVisit_Search.ToLower();
开发者ID:sfielder,项目名称:heroku-net-example,代码行数:67,代码来源:StoreVisitController.cs

示例3: SaveProfile

        public JsonResult SaveProfile(string reviewers, int apprid)
        {
            string message = string.Empty;
            List<Model.DTO.Appraisal.Reviewer> lst_reviewers = null;
            Model.DTO.Appraisal.Appraisal obj_appraisal = Model.PMSModel.GetAppraisalById(apprid);
            if (!string.IsNullOrEmpty(reviewers))
            {
                string[] reviewarray = reviewers.Split('|');

                if (!Lib.Utility.Common.IsNullOrEmptyList(reviewarray))
                {
                    List<string> lst_temp = new List<string>();
                    lst_reviewers = new List<Model.DTO.Appraisal.Reviewer>();
                    foreach(string str_reviewer in reviewarray)
                    {
                        if (Lib.Utility.Common.IsNullOrEmptyList(lst_temp.Where(rec=>rec.Equals(str_reviewer))))
                        {
                            lst_temp.Add(str_reviewer);
                        }
                    }

                    foreach (string str_reviewer_id in lst_temp)
                    {

                        // 1. add GetEmployeeById in model
                        // 2. add MapEmployeeDTOToReviewerDTO in pmsmapper

                        Model.DTO.Appraisal.Reviewer obj_reviewer = Model.Mappers.PMSMapper.MapEmployeeDTOToReviewerDTO(Model.PMSModel.GetEmployeeById(Convert.ToInt32(str_reviewer_id)));
                        obj_reviewer.Appraisal = new Model.DTO.Appraisal.Appraisal() { Id = apprid };
                        obj_reviewer.SMT = false;

                        lst_reviewers.Add(obj_reviewer);
                    }
                }
            }
            if (!Business.AppraisalManager.ManageChangeReviewerMember(obj_appraisal, lst_reviewers, out message))
            {
                return Json(message);
            }

            return Json(message);
        }
开发者ID:kyoliumiao,项目名称:eHR-Phase2,代码行数:42,代码来源:HomeController.cs

示例4: editFootnoteMaps

        public ActionResult editFootnoteMaps(Int16 fiscalYear, Int16? indicatorID)
        {
            List<Indicator_Footnote_Maps> footnoteMaps = new List<Indicator_Footnote_Maps>();
            foreach (var footnote in db.Indicator_Footnote_Maps.Where(x => x.Fiscal_Year == fiscalYear).OrderBy(e => e.Map_ID).ToList())
            {
                footnoteMaps.Add(footnote);
            }

            var allIndicator = new List<Indicators>();
            if (indicatorID.HasValue)
            {
                allIndicator = db.Indicators.Where(x => x.Indicator_ID == indicatorID).OrderBy(x => x.Indicator_ID).ToList();
            }
            else
            {
                allIndicator = db.Indicators.OrderBy(x => x.Indicator_ID).ToList();
            }

            var viewModel = allIndicator.Select(x => new Indicator_Footnote_MapsViewModel
            {
                Indicator_ID = x.Indicator_ID,
                Indicator = x.Indicator,
                Fiscal_Year = fiscalYear,
            }).ToList();

            viewModel.FirstOrDefault().allFootnotes = new List<string>();

            viewModel.FirstOrDefault().allFootnotes.AddRange(db.Footnotes.Select(x => x.Footnote_Symbol + ", " + x.Footnote).ToList());

            foreach (var Indicator in viewModel)
            {
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 0)
                {
                    Indicator.Footnote_ID_1 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).First().Footnote_ID;
                    Indicator.Map_ID_1 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).First().Map_ID;
                    Indicator.Footnote_Symbol_1 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_1).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 1)
                {
                    Indicator.Footnote_ID_2 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(1).First().Footnote_ID;
                    Indicator.Map_ID_2 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(1).First().Map_ID;
                    Indicator.Footnote_Symbol_2 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_2).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 2)
                {
                    Indicator.Footnote_ID_3 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(2).First().Footnote_ID;
                    Indicator.Map_ID_3 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(2).First().Map_ID;
                    Indicator.Footnote_Symbol_3 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_3).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 3)
                {
                    Indicator.Footnote_ID_4 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(3).First().Footnote_ID;
                    Indicator.Map_ID_4 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(3).First().Map_ID;
                    Indicator.Footnote_Symbol_4 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_4).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 4)
                {
                    Indicator.Footnote_ID_5 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(4).First().Footnote_ID;
                    Indicator.Map_ID_5 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(4).First().Map_ID;
                    Indicator.Footnote_Symbol_5 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_5).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 5)
                {
                    Indicator.Footnote_ID_6 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(5).First().Footnote_ID;
                    Indicator.Map_ID_6 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(5).First().Map_ID;
                    Indicator.Footnote_Symbol_6 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_6).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 6)
                {
                    Indicator.Footnote_ID_7 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(6).First().Footnote_ID;
                    Indicator.Map_ID_7 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(6).First().Map_ID;
                    Indicator.Footnote_Symbol_7 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_7).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 7)
                {
                    Indicator.Footnote_ID_8 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(7).First().Footnote_ID;
                    Indicator.Map_ID_8 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(7).First().Map_ID;
                    Indicator.Footnote_Symbol_8 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_8).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 8)
                {
                    Indicator.Footnote_ID_9 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(8).First().Footnote_ID;
                    Indicator.Map_ID_9 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(8).First().Map_ID;
                    Indicator.Footnote_Symbol_9 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_9).Footnote_Symbol;
                }
                if (footnoteMaps.Count(e => e.Indicator_ID == Indicator.Indicator_ID) > 9)
                {
                    Indicator.Footnote_ID_10 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(9).First().Footnote_ID;
                    Indicator.Map_ID_10 = footnoteMaps.Where(e => e.Indicator_ID == Indicator.Indicator_ID).OrderBy(e => e.Map_ID).Skip(9).First().Map_ID;
                    Indicator.Footnote_Symbol_10 = db.Footnotes.FirstOrDefault(e => e.Footnote_ID == Indicator.Footnote_ID_10).Footnote_Symbol;
                }
            }

            return View(viewModel);
        }
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:95,代码来源:IndicatorController.cs

示例5: TeamScoreBoard

        private void TeamScoreBoard(List<MultiDogEntry> multiTeams, ShowClasses showClass, PdfPTable callingListTbl)
        {
            var teamsForClass = multiTeams.Where(t => t.ClassId == showClass.ID).OrderBy(t => t.RO);
            var teamCnt = 0;
            foreach (var team in teamsForClass)
            {
                var altColor = (teamCnt%2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
                callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(team.RO.ToString(), _normal10Black)))
                {
                    BorderWidth = 0,
                    FixedHeight = 20f
                });

                if (TeamPairsManager.isTeam(showClass.EntryType))
                {
                    callingListTbl.AddCell(new PdfPCell(
                            new Phrase(new Chunk(team.TeamDetails.TeamName.Replace("&#39;", "'"), _normal10Black)))
                    {
                        Colspan = 2,
                        BackgroundColor = altColor,
                        BorderWidth = 0
                    });
                }
                else
                {
                    var dogCnt = 0;
                    var handlerPara = new Paragraph();
                    var dogPara = new Paragraph();
                    foreach (var member in team.Members)
                    {
                        if (dogCnt < team.DogCount)
                        {
                            if (dogCnt > 0)
                            {
                                handlerPara.Add(new Phrase(Chunk.NEWLINE));
                                dogPara.Add(new Phrase(Chunk.NEWLINE));
                            }

                            handlerPara.Add(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(member.HandlerName), _normal10Black)));
                            dogPara.Add(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(member.DogName), _normal10Black)));
                        }
                        dogCnt++;
                    }
                    callingListTbl.AddCell(new PdfPCell(handlerPara)
                    {
                        BackgroundColor = altColor,
                        BorderWidth = 0,
                        BorderWidthTop = 0
                    });
                    callingListTbl.AddCell(new PdfPCell(dogPara)
                    {
                        BackgroundColor = altColor,
                        BorderWidth = 0,
                        BorderWidthTop = 0
                    });
                }

                callingListTbl.AddCell(new PdfPCell(new Phrase(""))
                {
                    BorderWidth = 1,
                    BorderWidthRight = 0,
                    BorderWidthTop = (teamCnt > 0 ? 0 : 1)
                });

                callingListTbl.AddCell(new PdfPCell(new Phrase(""))
                {
                    BackgroundColor = Color.WHITE,
                    BorderWidth = 1,
                    BorderWidthRight = 0,
                    BorderWidthTop = (teamCnt > 0 ? 0 : 1)
                });

                callingListTbl.AddCell(new PdfPCell(new Phrase(""))
                {
                    BackgroundColor = Color.WHITE,
                    BorderWidth = 1,
                    BorderWidthRight = 1,
                    BorderWidthTop = (teamCnt > 0 ? 0 : 1)
                });

                teamCnt++;
            }
        }
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:83,代码来源:DocumentManager.cs

示例6: viewPR

        public ActionResult viewPR(Int16 fiscalYear, Int16? analystID, Int16? coeID)
        {
            var allMaps = new List<Indicator_CoE_Maps>();

            if (analystID.HasValue)
            {
                allMaps = db.Indicator_CoE_Maps.Where(x => x.Indicator.Analyst_ID == analystID).ToList();
            }
            else
            {
                allMaps = db.Indicator_CoE_Maps.ToList();
            }

            var allCoEs = new List<CoEs>();
            if (coeID.HasValue)
            {
                allCoEs = db.CoEs.Where(x => x.CoE_ID == coeID).ToList();
                allMaps = allMaps.Where(x => x.CoE.CoE_ID == coeID || x.CoE_ID == 0).ToList();
            }
            else
            {
                allCoEs = db.CoEs.Where(x=>x.CoE_ID != 0).ToList();
            }
            ModelState.Clear();

            var obj = allCoEs.FirstOrDefault();
            var type = obj.GetType();
            //var test = type.GetProperty(FiscalYear.FYStrFull("FY_", fiscalYear) + "Draft").GetValue(obj, null) == null;
            var isDraft = (bool)(type.GetProperty(FiscalYear.FYStrFull("FY_",fiscalYear) + "Draft").GetValue(obj,null) ?? false);

            var viewModel = new PRViewModel
            {
                //allCoEs = db.CoEs.ToList(),
                allAnalysts = db.Analysts.ToList(),
                allCoEs = allCoEs,
                allMaps = allMaps,
                allFootnoteMaps = db.Indicator_Footnote_Maps.ToList(),
                allFootnotes = db.Footnotes.ToList(),
                allAreas = db.Areas.ToList(),
                Fiscal_Year = fiscalYear,
                Analyst_ID = analystID,
                allColors = db.Color_Types.ToList(),
                allDirections = db.Color_Directions.ToList(),
                allThresholds = db.Color_Thresholds.ToList(),
                allFormats = db.Formats.ToList(),
                allIndicators = null,
                isDraft = isDraft
            };

            return View(viewModel);
        }
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:51,代码来源:IndicatorController.cs

示例7: viewPRdbl

        public ActionResult viewPRdbl(Int16 fiscalYear, Int16? analystID, Int16 coeID, Int16 coeID2)
        {
            var allMaps = new List<Indicator_CoE_Maps>();

            if (analystID.HasValue)
            {
                allMaps = db.Indicator_CoE_Maps.Where(x => x.Indicator.Analyst_ID == analystID).ToList();
            }
            else
            {
                allMaps = db.Indicator_CoE_Maps.ToList();
            }

            var allCoEs = db.CoEs.Where(x => x.CoE_ID == coeID).ToList();
            allMaps = allMaps.Where(x => x.CoE.CoE_ID == coeID || x.CoE_ID == 0).ToList();

            ModelState.Clear();
            var viewModel = new PRViewModel
            {
                //allCoEs = db.CoEs.ToList(),
                allAnalysts = db.Analysts.ToList(),
                allCoEs = allCoEs,
                allMaps = allMaps,
                allIndicators = db.Indicators.ToList(),
                allFootnoteMaps = db.Indicator_Footnote_Maps.ToList(),
                allFootnotes = db.Footnotes.ToList(),
                allAreas = db.Areas.ToList(),
                Fiscal_Year = fiscalYear,
                Analyst_ID = analystID,
                allColors = db.Color_Types.ToList(),
                allDirections = db.Color_Directions.ToList(),
                allThresholds = db.Color_Thresholds.ToList(),
                allFormats = db.Formats.ToList(),

                coeID2= coeID2
            };

            return View(viewModel);
        }
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:39,代码来源:IndicatorController.cs

示例8: Main

        static void Main(string[] args)
        {
            WebRequest.DefaultWebProxy = null;
            string[] books;
            using (var client = new WebClient()) {
                books = client.DownloadString(@"http://ieeexplore.ieee.org/otherfiles/OPACBookListMIT.txt")
                                           .Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            }
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Ukupno knjiga: {0}", books.Count() - 1);

            var ebooksDirectory = Path.Combine((Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName)), "ebooks");
            if (!Directory.Exists(ebooksDirectory))
                Directory.CreateDirectory(ebooksDirectory);

            Directory.GetFiles(ebooksDirectory).Where(i => Regex.IsMatch(i, @"\d{13}-\d{1,3}.pdf")).ToList().ForEach(File.Delete);

            var alreadyDownloaded = new DirectoryInfo(ebooksDirectory).GetFiles().Length;
            var timeout = 5;
            foreach (var book in books.Skip(1 + alreadyDownloaded).Select((title, no) => new { no, title })) {
                string[] stopMessages = { "All Online Seats Are in Use", "All Online Seats Are Currently Occupied.",
                                          "URL Error (110)", "IEEE Xplore is Under Maintenance", "This document you requested has moved temporarily" };
                while (true) {
                    try {
                        using (var client = new WebClient()) {
                            if (stopMessages.Any(client.DownloadString(@"http://ieeexplore.ieee.org").Contains)) {
                                Console.ForegroundColor = ConsoleColor.Blue;
                                Console.WriteLine("  Previse korisnika je spojeno na web server - pauziram {0} sekundi...", timeout);
                                Thread.Sleep(timeout * 1000);
                            }
                            else {
                                break;
                            }
                        }
                    }
                    catch { }
                }
                Console.ForegroundColor = ConsoleColor.Green;

                var isbn = book.title.Split(new string[] { "\",\"" }, StringSplitOptions.None)[1];
                var book_url = book.title.Split(',')[book.title.Split(',').Length - 2].TrimEnd('"');
                var book_number = book_url.Split('=')[1];
                var book_name = new string(new string(book.title.Split(new string[] { "\",\"" }, StringSplitOptions.None)[0].Skip(1).ToArray())
                                           .Replace("\"", "'").Replace(":", "-").Trim().TrimEnd('-')
                                           .Where(ch => !Path.GetInvalidFileNameChars().Contains(ch)).ToArray());

                Console.Write("* Ekstrahiram poglavlja trenutne knjige..");
                IEnumerable<string> chapters;
                using (var client = new WebClient()) {
                    var r = new Regex(String.Format("{0}(.*?){1}", Regex.Escape(@"/xpl/ebooks/bookPdfWithBanner.jsp?fileName="), Regex.Escape(".pdf")));
                    chapters = from Match match in r.Matches(client.DownloadString(book_url))
                               select String.Format("http://ieeexplore.ieee.org/ebooks/{0}/{1}.pdf?bkn={0}", book_number, match.Groups[1].Value);
                }

                Console.Write("\r{0}\r", new string(' ', Console.WindowWidth));
                Console.WriteLine("#{0}, ISBN={1}, poglavlja={2}, naziv={3}", alreadyDownloaded + book.no + 1, isbn, chapters.Count(), book_name);

                var fileList = new List<string>();
                var ok = true;
                for (int j = 0; j < chapters.Count(); ++j) {
                    var chapter_url = chapters.ToArray()[j];
                    Console.WriteLine(" --> Skidam poglavlje #{0}/{1} ({2} KB)", j + 1, chapters.Count(), GetUrlFileSize(chapter_url));
                    var currentFile = String.Format("{0}\\{1}-{2}.pdf", ebooksDirectory, isbn, j);
                    fileList.Add(currentFile);
                    try {
                        using (var client = new WebClientWithCookies()) {
                            client.DownloadFile(chapter_url, currentFile);
                        }
                    }
                    catch { }

                    while (!File.Exists(currentFile) || stopMessages.Any(File.ReadAllText(currentFile).Contains)) {
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("  Previse korisnika je spojeno na web server - pauziram {0} sekundi...", timeout);
                        Thread.Sleep(timeout * 1000);
                        try {
                            using (var client = new WebClientWithCookies()) {
                                client.DownloadFile(chapter_url, currentFile);
                            }
                        }
                        catch { }
                    }
                    Console.ForegroundColor = ConsoleColor.Green;

                    if (new FileInfo(currentFile).Length < 100 * 1024 && File.ReadAllText(currentFile).Contains("Page Not Found")) {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("\tGreska prilikom dohvata datoteke - provjeri prava pristupa!");
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\tPrelazim na sljedecu knjigu...");
                        ok = false;
                        break;
                    }
                }
                if (ok)
                    MergePDFs(fileList, String.Format("{0}\\{1}.pdf", ebooksDirectory, book_name));
                fileList.Where(file => File.Exists(file)).ToList().ForEach(File.Delete);
            }
        }
开发者ID:istambuk,项目名称:public,代码行数:98,代码来源:I3E_downloader.cs

示例9: editInventory

        public ActionResult editInventory(String indicatorID, Int16? analystID, int fiscalYear, Int16? Link_ID)
        {
            //}
            //var viewModelItems = db.Indicators.Where(x => x.Area_ID.Equals(1)).Where(y => y.Indicator_CoE_Map.Any(x => x.CoE_ID.Equals(10) || x.CoE_ID.Equals(27) || x.CoE_ID.Equals(30) || x.CoE_ID.Equals(40) || x.CoE_ID.Equals(50))).ToArray();
            var allLinks = db.Indicator_Links.ToList();
            var viewModelItems = new List<Indicators>();
            if (analystID.HasValue && analystID.Value > 0)
            {
                //viewModelItems = db.Indicators.Where(x => x.Analyst_ID == analystID).ToList();
                var analystName = db.Analysts.FirstOrDefault(x=>x.Analyst_ID == analystID).First_Name;
                viewModelItems = db.Indicators.Where(x =>
                    x.FY_13_14_Data_Source_Benchmark.Contains(analystName) ||
                    x.FY_13_14_Data_Source_MSH.Contains(analystName) ||
                    x.FY_14_15_Data_Source_Benchmark.Contains(analystName) ||
                    x.FY_14_15_Data_Source_MSH.Contains(analystName)
                    ).ToList();
            }
            else
            {
                viewModelItems = db.Indicators.ToList();
            }
            if (indicatorID != null)
            {
                viewModelItems = viewModelItems.Where(x => x.Indicator_ID == Int16.Parse(indicatorID)).ToList();
            }
            if (Link_ID.HasValue && Link_ID > 0)
            {
                viewModelItems = db.Indicator_Links.FirstOrDefault(x => x.Link_ID == Link_ID).Indicator_Link_Indicators.Select(x => x.Indicator).ToList();
            }
            var allFootnotes = db.Indicator_Footnote_Maps.ToList();

            var viewModel = viewModelItems.Where(x=>x.Indicator_N_Value != true).OrderBy(x => x.Indicator_ID).Select(x => new InventoryViewModel
            {
                Indicator_ID = x.Indicator_ID,
                Area_ID = x.Area_ID,
                CoE = x.Indicator_CoE_Map != null ?
                        (x.Indicator_CoE_Map.Where(y => y.Fiscal_Year == fiscalYear).FirstOrDefault() != null ? x.Indicator_CoE_Map.Where(y => y.Fiscal_Year == fiscalYear).FirstOrDefault().CoE.CoE : "")
                      : "",
                Indicator = x.Indicator,
                Indicator_Type = x.Indicator_Type,
                Identifier = x.Identifier,
                Area = x.Area.Area,
                //Footnote = string.Join(",", allFootnotes.Where(y=>y.Indicator.Indicator_ID == x.Indicator_ID).ToList()),
                Footnote = string.Join(",", x.Indicator_Footnote_Map.Select(z=>z.Footnote.Footnote_Symbol).ToList()),
                FY_3 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 3) + "_YTD").GetValue(x, null),
                FY_3_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 3) + "_YTD_Sup").GetValue(x, null),
                FY_2 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 2) + "_YTD").GetValue(x, null),
                FY_2_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 2) + "_YTD_Sup").GetValue(x, null),
                FY_1 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 1) + "_YTD").GetValue(x, null),
                FY_1_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 1) + "_YTD_Sup").GetValue(x, null),
                FY_Q1 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q1").GetValue(x, null),
                FY_Q1_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q1_Sup").GetValue(x, null),
                FY_Q2 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q2").GetValue(x, null),
                FY_Q2_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q2_Sup").GetValue(x, null),
                FY_Q3 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q3").GetValue(x, null),
                FY_Q3_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q3_Sup").GetValue(x, null),
                FY_Q4 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q4").GetValue(x, null),
                FY_Q4_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q4_Sup").GetValue(x, null),
                FY_YTD = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_YTD").GetValue(x, null),
                FY_YTD_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_YTD_Sup").GetValue(x, null),
                FY_Target = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Target").GetValue(x, null),
                FY_Target_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Target_Sup").GetValue(x, null),
                FY_Comparator = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator").GetValue(x, null),
                FY_Comparator_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Sup").GetValue(x, null),
                FY_Comparator_Q1 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Q1").GetValue(x, null),
                FY_Comparator_Q2 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Q2").GetValue(x, null),
                FY_Comparator_Q3 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Q3").GetValue(x, null),
                FY_Comparator_Q4 = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Q4").GetValue(x, null),
                FY_Performance_Threshold = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Performance_Threshold").GetValue(x, null),
                FY_Performance_Threshold_Sup = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Performance_Threshold_Sup").GetValue(x, null),

                FY_Color_ID = (Int16)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Color_ID").GetValue(x, null),
                FY_YTD_Custom_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_YTD_Custom_Color").GetValue(x, null),
                FY_Q1_Custom_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q1_Custom_Color").GetValue(x, null),
                FY_Q2_Custom_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q2_Custom_Color").GetValue(x, null),
                FY_Q3_Custom_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q3_Custom_Color").GetValue(x, null),
                FY_Q4_Custom_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q4_Custom_Color").GetValue(x, null),

                FY_Definition_Calculation = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Definition_Calculation").GetValue(x, null),
                FY_Target_Rationale = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Target_Rationale").GetValue(x, null),
                FY_Comparator_Source = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comparator_Source").GetValue(x, null),

                FY_Data_Source_MSH = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Data_Source_MSH").GetValue(x, null),
                FY_Data_Source_Benchmark = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Data_Source_Benchmark").GetValue(x, null),
                FY_OPEO_Lead = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_OPEO_Lead").GetValue(x, null),

                FY_Q1_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q1_Color").GetValue(x, null),
                FY_Q2_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q2_Color").GetValue(x, null),
                FY_Q3_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q3_Color").GetValue(x, null),
                FY_Q4_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Q4_Color").GetValue(x, null),
                FY_YTD_Color = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_YTD_Color").GetValue(x, null),

                FY_Comment = (string)x.GetType().GetProperty(FiscalYear.FYStr(fiscalYear, 0) + "_Comment").GetValue(x, null),

                Format_Code = x.Format == null ? "" : (string)x.Format.GetType().GetProperty("Format_Code").GetValue(x.Format, null),
                N_Value = x.Indicator_N_Value.HasValue ? x.Indicator_N_Value.Value : false,
                N_Value_ID = x.Indicator_N_Value_ID == null ? "" : x.Indicator_N_Value_ID.ToString(),

                Fiscal_Year = fiscalYear,
                Analyst_ID = analystID.HasValue ? analystID.Value : 0,
//.........这里部分代码省略.........
开发者ID:vadimPoliansky,项目名称:TestPR_Dev,代码行数:101,代码来源:IndicatorController.cs

示例10: Index


//.........这里部分代码省略.........
                            }
                        }
                        else if (!string.IsNullOrEmpty(assigneduserguid))
                        {
                            mjob.ActualStartTime = DateTime.Now.AddDays(-29);
                            mjob.ActualEndTime = DateTime.Now;
                            mjob.AssignedUserGUID = new Guid(assigneduserguid);
                            mjob.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString());
                            jobGroup = _IJobRepository.GetJobs(mjob);
                        }
                        else
                        {
                            mjob.ActualStartTime = DateTime.Now.AddDays(-29);
                            mjob.ActualEndTime = DateTime.Now;
                            if (Session["UserType"] != null && Session["UserType"].ToString() == "ENT_U")
                            {
                                mjob.AssignedUserGUID = new Guid(Session["UserGUID"].ToString());
                                mjob.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString());
                                jobGroup = _IJobRepository.GetJobs(mjob);
                            }
                            else
                            {
                                mjob.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString());
                                jobGroup = _IJobRepository.GetJobs(mjob);
                            }
                        }

                        if (jobGroup != null && jobGroup.Count > 0)
                        {
                            ViewBag.Search = search;
                            if (!string.IsNullOrEmpty(search))
                            {
                                search = search.ToLower();
                                jobGroup = jobGroup.Where(x => (x.CustomerGUID != null ? GetCompanyName(x.CustomerGUID).ToLower() : GetCompanyNameByPO(x.PONumber).ToLower()).Contains(search)
                                    || (!String.IsNullOrEmpty(x.JobName) && x.JobName.ToLower().Contains(search))
                                    || (!String.IsNullOrEmpty(x.PONumber) && x.PONumber.ToLower().Contains(search))
                                    || (!string.IsNullOrEmpty(x.CustomerGUID.ToString()) ? getStoreID(x.CustomerStopGUID.ToString()) : "").Contains(search)
                                    || (_IJobRepository.GetStatusName(Convert.ToInt32(x.StatusCode)).ToLower().Contains(search))
                                    ).ToList();
                            }

                            totalRecord = jobGroup.ToList().Count;
                            totalPage = (totalRecord / (int)ViewBag.pageCountValue) + ((totalRecord % (int)ViewBag.pageCountValue) > 0 ? 1 : 0);
                            
                            ViewBag.TotalRows = totalRecord;

                            jobGroup = jobGroup.OrderBy(a => a.OrganizationGUID).Skip(((page - 1) * (int)ViewBag.pageCountValue)).Take((int)ViewBag.pageCountValue).ToList();

                            foreach (var job in jobGroup.ToList())
                            {
                                JobStatusModel js = new JobStatusModel();
                                js.JobName = job.JobName;
                                js.JobIndexGUID = job.JobGUID.ToString();
                                //  js.JobLogicalID = job.JobFormGUID.ToString();
                                js.UserGUID = job.AssignedUserGUID.ToString();

                                js.PreferredStartTime = job.PreferedStartTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(job.PreferedStartTime, Session["TimeZoneID"].ToString()) : job.PreferedStartTime.ToString() : "";
                                js.PreferredStartTime = !string.IsNullOrEmpty(js.PreferredStartTime) ? _IUserRepository.GetLocalDateTime(job.PreferedStartTime, Session["TimeZoneID"].ToString()) : "";
                                js.PreferredStartTime = !string.IsNullOrEmpty(js.PreferredStartTime) ? Convert.ToDateTime(js.PreferredStartTime).ToString("MM/dd/yy HH:mm") : "";

                                js.PreferredEndTime = job.PreferedEndTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(job.PreferedEndTime, Session["TimeZoneID"].ToString()) : job.PreferedEndTime.ToString() : "";
                                js.PreferredEndTime = !string.IsNullOrEmpty(js.PreferredEndTime) ? _IUserRepository.GetLocalDateTime(job.PreferedEndTime, Session["TimeZoneID"].ToString()) : "";
                                js.PreferredEndTime = !string.IsNullOrEmpty(js.PreferredEndTime) ? Convert.ToDateTime(js.PreferredEndTime).ToString("MM/dd/yy HH:mm") : "";

                                js.ActualStartTime = job.ActualStartTime != null ? Session["TimeZoneID"] != null ? _IUserRepository.GetLocalDateTime(job.ActualStartTime, Session["TimeZoneID"].ToString()) : job.ActualStartTime.ToString() : "";
                                js.ActualStartTime = !string.IsNullOrEmpty(js.ActualStartTime) ? _IUserRepository.GetLocalDateTime(job.ActualStartTime, Session["TimeZoneID"].ToString()) : "";
开发者ID:sfielder,项目名称:heroku-net-example,代码行数:67,代码来源:UserActivitiesController.cs

示例11: RetornaCredores

        public ActionResult RetornaCredores(string credor)
        {
            var result = new List<KeyValuePair<string, string>>();
            IList<SelectListItem> List = new List<SelectListItem>();

            var lista = new Dados().RetornaDados("Select distinct PRC_CREDOR as NOMECREDOR from processos where PRC_CREDOR like '" + credor + "%' and PRC_CREDOR is not null order by PRC_CREDOR");
            foreach (System.Data.DataRow item in lista.Rows)
            {
                result.Add(new KeyValuePair<string, string>(item["NOMECREDOR"].ToString(), item["NOMECREDOR"].ToString()));
            }
            var result3 = result.Where(s => s.Value.ToLower().Contains(credor.ToLower())).Select(w => w).ToList();

            return Json(result3, JsonRequestBehavior.AllowGet);
        }
开发者ID:andresombra,项目名称:ged,代码行数:14,代码来源:ProcessosController.cs

示例12: btnStart_Click

        private void btnStart_Click(object sender, EventArgs e)
        {
            CleanDestination();

            _fileList = new List<string>();
            btnStart.Enabled = false;

            if (string.IsNullOrEmpty(txtExcelFile.Text) || string.IsNullOrEmpty(txtFirstPDF.Text) ||
                string.IsNullOrEmpty(txtSecondPDF.Text) || string.IsNullOrEmpty(txtDestinationFolder.Text))
            {
                MessageBox.Show("One or more files not specified.");
                return;
            }

            var pathToExcelFile = txtExcelFile.Text;
            var excelFile = new ExcelQueryFactory(pathToExcelFile);
            var columnValues = from a in excelFile.WorksheetNoHeader(0) select a;

            var listRows = new List<ExcelRow>();

            var setNumber = 1;
            var increment = 1;
            foreach (var a in columnValues)
            {
                listRows.Add(
                    new ExcelRow
                    {
                        Index = increment,
                        SetNumber = setNumber,
                        ColumnValue = a[1].Value.ToString(),
                        FileName = string.IsNullOrWhiteSpace(a[0].Value.ToString()) ? "" : a[0].Value.ToString()
                    }
                );

                if (!a[1].Value.ToString().EndsWith(","))
                    setNumber++;

                increment++;
            }

            for (var i = 1; i < increment - 1; i++)
            {
                var sbSearch = new StringBuilder();
                _searchValues.Clear();

                foreach (var item in from item in listRows.Where(item => item.SetNumber == i) let index = item.Index let text = item.ColumnValue select item)
                {
                    sbSearch.Append(item.ColumnValue);

                    _searchValues.Add(new KeyValuePair<int, string>(item.Index, item.ColumnValue));

                    if (!string.IsNullOrEmpty(item.FileName))
                    {
                        _currentFile = item.FileName;
                        _actualRow = item.SetNumber;
                    }
                }

                if (!string.IsNullOrEmpty(sbSearch.ToString()))
                    ProcessPdf(StringComparison.Ordinal, txtFirstPDF.Text, txtDestinationFolder.Text + "\\" + GetFileName(_currentFile, txtFirstPDF.Text) + ".pdf", sbSearch.ToString(), i, _searchValues);

                if (!string.IsNullOrEmpty(txtSecondPDF.Text) && !string.IsNullOrEmpty(sbSearch.ToString()))
                    ProcessPdf(StringComparison.Ordinal, txtSecondPDF.Text, txtDestinationFolder.Text + "\\" + GetFileName(_currentFile, txtSecondPDF.Text) + ".pdf", sbSearch.ToString(), i, _searchValues);

            }

            #region Update Excel...

            lblMsg.Visible = true;
            foreach (var item in _foundValuesInFirstPdf)
            {
                var myCommand = new OleDbCommand();
                string sqlUpdate = null;
                var count = item.Value.Split(',').Count();

                var cnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtExcelFile.Text + ";Extended Properties='Excel 8.0;HDR=NO;'";
                var myConnection = new OleDbConnection(cnn);
                myConnection.Open();
                myCommand.Connection = myConnection;
                sqlUpdate = "UPDATE [Sheet1$H" + item.Key + ":H" + item.Key + "] SET F1='" + item.Value + "'";
                myCommand.CommandText = sqlUpdate;
                myCommand.ExecuteNonQuery();

                sqlUpdate = "UPDATE [Sheet1$J" + item.Key + ":J" + item.Key + "] SET F1='" + count + "'";
                myCommand.CommandText = sqlUpdate;
                myCommand.ExecuteNonQuery();

                myConnection.Close();

            }

            foreach (var item in _foundValuesInSecindPdf)
            {
                var myCommand = new OleDbCommand();
                string sqlUpdate = null;
                var count = item.Value.Split(',').Count();

                var cnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtExcelFile.Text + ";Extended Properties='Excel 8.0;HDR=NO;'";
                var myConnection = new OleDbConnection(cnn);
                myConnection.Open();
//.........这里部分代码省略.........
开发者ID:raviroyind,项目名称:PdfHighlighter,代码行数:101,代码来源:Form1.cs

示例13: MergePdfBlobsToC

        public static Blob.Blob MergePdfBlobsToC(List<Blob.Blob> blobsParam, ref Dictionary<string, int> pages)
        {
            blobsParam = blobsParam
                .Where(el => el != null && el.Data != null)
                .ToList();

            //Dictionary of file names (for display purposes) and their page numbers
            //var pages = new Dictionary<string, int>();

            //PDFs start at page 1
            var lastPageNumber = 1;

            //Will hold the final merged PDF bytes
            byte[] mergedBytes;

            //Most everything else below is standard
            using (var ms = new MemoryStream())
            {
                using (var document = new Document())
                {
                    using (var writer = new PdfCopy(document, ms))
                    {
                        document.Open();

                        foreach (var blob in blobsParam)
                        {

                            //Add the current page at the previous page number
                            pages.Add(blob.Name, lastPageNumber);

                            using (var reader = new PdfReader(blob.Data))
                            {
                                writer.AddDocument(reader);

                                //Increment our current page index
                                lastPageNumber += reader.NumberOfPages;
                            }
                        }
                        document.Close();
                    }
                }
                mergedBytes = ms.ToArray();
            }

            //Will hold the final PDF
            //            byte[] finalBytes;
            //            using (var ms = new MemoryStream())
            //            {
            //                using (var reader = new PdfReader(mergedBytes))
            //                {
            //                    using (var stamper = new PdfStamper(reader, ms))
            //                    {
            //
            //                        //The page number to insert our TOC into
            //                        var tocPageNum = reader.NumberOfPages + 1;
            //
            //                        //Arbitrarily pick one page to use as the size of the PDF
            //                        //Additional logic could be added or this could just be set to something like PageSize.LETTER
            //                        var tocPageSize = reader.GetPageSize(1);
            //
            //                        //Arbitrary margin for the page
            //                        var tocMargin = 20;
            //
            //                        //Create our new page
            //                        stamper.InsertPage(tocPageNum, tocPageSize);
            //
            //                        //Create a ColumnText object so that we can use abstractions like Paragraph
            //                        var ct = new ColumnText(stamper.GetOverContent(tocPageNum));
            //
            //                        //Set the working area
            //                        ct.SetSimpleColumn(tocPageSize.GetLeft(tocMargin), tocPageSize.GetBottom(tocMargin),
            //                            tocPageSize.GetRight(tocMargin), tocPageSize.GetTop(tocMargin));
            //
            //                        //Loop through each page
            //                        foreach (var page in pages)
            //                        {
            //                            var link = new Chunk(page.Key);
            //                            var action = PdfAction.GotoLocalPage(page.Value, new PdfDestination(PdfDestination.FIT),
            //                                stamper.Writer);
            //                            link.SetAction(action);
            //                            ct.AddElement(new Paragraph(link));
            //                        }
            //
            //                        ct.Go();
            //                    }
            //                }
            //                finalBytes = ms.ToArray();
            //            }

            var toReturn = new Blob.Blob { Data = mergedBytes/*finalBytes*/ };
            return toReturn;
        }
开发者ID:avannini,项目名称:uisp-mobile,代码行数:92,代码来源:AttachmentHelper.cs

示例14: MergePdfBlobs

        public static Blob.Blob MergePdfBlobs(List<Blob.Blob> blobsParam, bool isHorizontal)
        {
            var pdfReaders = blobsParam
                .Where(el => el != null && el.Data != null)
                .Select(el => new PdfReader(el.Data))
                .ToList();

            var document = isHorizontal
                ? new Document(PageSize.A4.Rotate(), 0, 0, 0, 0)
                : new Document(PageSize.A4, 0, 0, 0, 0);

            using (var outputStream = new MemoryStream())
            {
                using (var writer = PdfWriter.GetInstance(document, outputStream))
                {
                    document.Open();

                    foreach (var reader in pdfReaders)
                    {
                        for (int i = 1; i <= reader.NumberOfPages; i++)
                        {
                            var page = writer.GetImportedPage(reader, i);
                            document.Add(iTextSharp.text.Image.GetInstance(page));
                        }
                    }
                    document.Close();

                    var toReturn = new Blob.Blob {Data = outputStream.GetBuffer()};
                    return toReturn;
                }
            }
        }
开发者ID:avannini,项目名称:uisp-mobile,代码行数:32,代码来源:AttachmentHelper.cs

示例15: getKeyupSearch

        public JsonResult getKeyupSearch(string mysearch, int BuildingID, string aptNumber)
      {

            var Search = new List<TenantSearch>();

            if (mysearch != null || mysearch != "")
            {
                string FN = string.Empty;
                string LN = string.Empty;
                string[] m = mysearch.Split(null);//if the splitting char is null it is assume that the delimiter is a whie space
                var mymanagement = new managementVM();
                if (m.Length > 1)
                {
                    FN = m[0];
                    LN = m[1];

                    Search = db.Tenant
                   .Join(db.Apartment,
                           c => c.aptID,
                           a => a.ID,
                           (c, a) => new { c, a })
                           .Join(db.Buildings,
                           ca => ca.a.BuildingID,
                           b => b.ID,
                           (ca, b) => new TenantSearch
                           {
                               FirstName = ca.c.FirstName,
                               LastName = ca.c.LastName,
                               Apt = ca.a.ApartmentNumber,
                               Address = b.Address,
                               city = b.City,
                               State = b.State,
                               zipcode = b.Zipcode,
                               ApartmentID = ca.a.ID,
                               TenantID = ca.c.ID,
                               Userkey = ca.c.AspNetUsers.Id,
                               Phone = ca.c.Phone,
                               BuildingID = b.ID
                           })
                   .Where(c => c.FirstName.Contains(mysearch) ||
                               c.LastName.Contains(mysearch) ||
                               c.FirstName.Contains(FN) &&
                               c.LastName.Contains(LN)
                          ).Where(c => c.BuildingID == BuildingID)
                    .OrderByDescending(c => c.FirstName)
                   .Take(10)
                   .ToList();
                       if (aptNumber != "")
                    {
                        Search = Search.Where(c => c.Apt == aptNumber).ToList();
                   
                    }

                    return new JsonResult { Data = Search, JsonRequestBehavior = JsonRequestBehavior.AllowGet };

                }
                else
                {

                    Search = db.Tenant
                       .Join(db.Apartment,
                         c => c.aptID,
                         a => a.ID,
                         (c, a) => new { c, a })
                         .Join(db.Buildings,
                         ca => ca.a.BuildingID,
                         b => b.ID,
                         (ca, b) => new TenantSearch
                         {
                             FirstName = ca.c.FirstName,
                             LastName = ca.c.LastName,
                             Apt = ca.a.ApartmentNumber,
                             Address = b.Address,
                             city = b.City,
                             State = b.State,
                             zipcode = b.Zipcode,
                             ApartmentID = ca.a.ID,
                             TenantID = ca.c.ID,
                             Userkey = ca.c.AspNetUsers.Id,
                              Phone = ca.c.Phone,
                             BuildingID = b.ID
                         })
                   .Where(c => c.FirstName.Contains(mysearch) || c.LastName.Contains(mysearch))
                   .Where(c => c.BuildingID == BuildingID)
                   .OrderByDescending(c => c.FirstName)
                   .Take(10)
                   .ToList();
                    if (aptNumber != "")
                    {
                        Search = Search.Where(c => c.Apt == aptNumber).ToList();

                    }

                    return new JsonResult { Data = Search, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
                }

            }
            return new JsonResult { Data = Search, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
开发者ID:dioscarr,项目名称:PointerSecurityMonitor,代码行数:99,代码来源:BuildingController.cs


注:本文中的iTextSharp.text.List.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。