本文整理汇总了C#中iTextSharp.text.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.List
的用法示例。
在下文中一共展示了List.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printRingForUser
private void printRingForUser(UserShows userShow, int UserID, Document doc, ref List<int> defaultUsers, ref int pageCount)
{
float[] ringColumns = new float[] { 300, 300, 300, 300 };
User currentUser = new User(userShow.Userid);
Shows show = new Shows(userShow.ShowID);
List<ShowDetails> showDetailsList = ShowDetails.GetShowDetails(userShow.ShowID);
Rings r = new Rings();
DataSet ringList = r.GetAllRingsForShow(userShow.ShowID, "ShowDate");
Dogs d = new Dogs();
DogClasses dc = new DogClasses();
DateTime dt = DateTime.Now;
string currentJudge = "";
int currentRingID = 0;
int ShowDetailsID = -1;
int PrevShowDetailsID = -1;
PdfPTable rings = new PdfPTable(ringColumns);
int ringCnt = 0;
PdfPCell cell = null;
PdfPTable ringDetails = null;
PdfPTable classDetailsTable = null;
List<int> dogsRunningToday = new List<int>();
PdfPTable headerPage = null;
List<TeamPairsTrioDto> pairsTeams = new List<TeamPairsTrioDto>();
try
{
foreach (DataRow ringRow in ringList.Tables[0].Rows)
{
Rings ring = new Rings(ringRow);
int RingID = Convert.ToInt32(ringRow["RingID"]);
int EntryType = Convert.ToInt32(ringRow["EntryType"]);
int Lho = Convert.ToInt32(ringRow["Lho"]);
ShowDetailsID = Convert.ToInt32(ringRow["ShowDetailsID"]);
if (ringRow.IsNull("ClassID"))
{
continue;
}
int ClassID = Convert.ToInt32(ringRow["ClassID"]);
int ClassNo = Convert.ToInt32(ringRow["ClsNo"]);
DateTime rowDT = Convert.ToDateTime(ringRow["ShowDate"]);
if (rowDT != dt)
{
if (currentRingID != 0)
{
if (ringCnt % MaxColumns != 0)
{
var remind = ringCnt % MaxColumns;
while (remind-- > 0)
{
cell = new PdfPCell(new Phrase(new Chunk(" ", pageFont)));
cell.BorderWidth = 0;
rings.AddCell(cell);
}
}
if (dogsRunningToday.Count() > 0 || UserID == -1)
{
doc.Add(headerPage);
doc.Add(rings);
if (UserID > -1)
{
if (currentUser.UserID != UserID)
{
User defaultHandler = new User(UserID);
}
}
doc.NewPage();
pageCount++;
}
}
dogsRunningToday.Clear();
if (UserID > -1)
{
if (currentUser.UserID == UserID)
{
headerPage = DrawHeader(show, rowDT, currentUser, userShow);
}
else
{
User defaultHandler = new User(UserID);
headerPage = DrawHeader(show, rowDT, defaultHandler, userShow);
}
}
else
{
headerPage = DrawHeader(show, rowDT, null, null);
}
dt = rowDT;
rings = new PdfPTable(ringColumns);
rings.WidthPercentage = 100;
ringCnt = 0;
}
//.........这里部分代码省略.........
示例2: GetProfileReport
public static AnalyticsReport GetProfileReport(string id, IAuthenticator authenticator)
{
AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer() { Authenticator = authenticator });
var data =
service.Data.Ga.Get("ga:" + id, "2012-10-01", "2012-11-01", "ga:visits,ga:bounces,ga:pageviews");
data.Dimensions = "ga:source,ga:keyword,ga:pagePath,ga:city,ga:date,ga:landingPagePath,ga:visitorType";
// data.MaxResults = 500;
GaData garesults = data.Fetch();
AnalyticsReport report = new AnalyticsReport();
report.id = id;
report.JSON = garesults.Rows;
var test = garesults.TotalsForAllResults;
report.TotalVisits = Convert.ToInt32(test["ga:visits"]);
report.TotalPageViews = Convert.ToInt32(test["ga:pageviews"]);
var bounces = Convert.ToInt32(test["ga:bounces"]);
var visits = Convert.ToInt32(test["ga:visits"]);
report.BounceRate = (bounces / visits);
//Referral List
List<string> reflinks = new List<string>();
List<string> keyWordList = new List<string>();
List<string> landingPages = new List<string>();
List<string> pagePathList = new List<string>();
List<string> cityList = new List<string>();
List<string> visitorType = new List<string>();
List<int> dayList = new List<int>();
List<int> newVisitors = new List<int>();
List<int> returningVisitors = new List<int>();
int maxReturningVisitors = 0;
int maxNewVisitors = 0;
foreach (var a in garesults.Rows)
{
string visType = a[6];
var day = Convert.ToInt32(a[4]);
if (dayList.Count() == 0)
{
dayList.Add(day);
}
else
{
var lastday = dayList.Last();
if (day != lastday)
{
dayList.Add(day);
filltoSameSize(newVisitors, returningVisitors);
}
}
int numVisits = Convert.ToInt32(a[7]);
if(visType == "New Visitor"){
newVisitors.Add(numVisits);
report.TotalNewVisitors = (report.TotalNewVisitors + numVisits);
maxNewVisitors = Math.Max(maxNewVisitors, numVisits);
}
else
{
returningVisitors.Add(numVisits);
report.TotalReturningVisitors = (report.TotalReturningVisitors + numVisits);
maxReturningVisitors = Math.Max(maxReturningVisitors, numVisits);
}
reflinks.Add(a[0]);
keyWordList.Add(a[1]);
pagePathList.Add(a[2]);
cityList.Add(a[3]);
dayList.Add(day);
landingPages.Add(a[5]);
visitorType.Add(a[6]);
}
filltoSameSize(newVisitors, returningVisitors);
report.maxNewVisitors = maxNewVisitors;
report.maxReturningVisitors = maxReturningVisitors;
report.newVisitors = newVisitors;
report.retVisitors = returningVisitors;
report.keylist = keyWordList;
report.reflist = reflinks;
report.citylist = cityList;
report.landingpagelist = pagePathList;
report.daylist = dayList;
//KeyWord Entrances
// report.newVisitors = (from pages in arrPage group pages by pages into p where p.Key != null && !p.Key.Contains("Error") orderby p.Count() descending select new { Key = p.Key, Count = p.Count() }).Take(7);
return report;
}
示例3: GetReport
public static AnalyticsReport GetReport(AnalyticsProfile profile, IAuthenticator authenticator)
{
AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer() { Authenticator = authenticator });
var data =
service.Data.Ga.Get("ga:" + profile.id, profile.startDate.ToString("yyyy-MM-dd"), profile.endDate.ToString("yyyy-MM-dd"), "ga:visits,ga:bounces,ga:pageviews");
data.Dimensions = "ga:source,ga:keyword,ga:pagePath,ga:city,ga:date,ga:landingPagePath,ga:visitorType";
// data.MaxResults = 500;
if (data.Fetch() == null)
{
try
{
//reauth if auth fail
IAuthenticator auth = Utils.getCredsnew(AnalyticsService.Scopes.AnalyticsReadonly.GetStringValue());
data =service.Data.Ga.Get("ga:" + profile.id, profile.startDate.ToString("yyyy-MM-dd"), profile.endDate.ToString("yyyy-MM-dd"), "ga:visits,ga:bounces,ga:pageviews");
data.Dimensions = "ga:source,ga:keyword,ga:pagePath,ga:city,ga:date,ga:landingPagePath,ga:visitorType";
}
catch (Exception ex)
{
}
}
GaData garesults = data.Fetch();
AnalyticsReport report = new AnalyticsReport();
report.id = profile.id;
report.JSON = garesults.Rows;
var test = garesults.TotalsForAllResults;
report.TotalVisits = Convert.ToInt32(test["ga:visits"]);
report.TotalPageViews = Convert.ToInt32(test["ga:pageviews"]);
var bounces = Convert.ToInt32(test["ga:bounces"]);
var visits = Convert.ToInt32(test["ga:visits"]);
report.BounceRate = ( visits / 2);
//Referral List
List<string> reflinks = new List<string>();
List<string> keyWordList = new List<string>();
List<string> landingPages = new List<string>();
List<string> cityList = new List<string>();
List<string> pagePathList = new List<string>();
List<string> visitorType = new List<string>();
List<int> dayList = new List<int>();
List<int> totalVisitors = new List<int>();
List<int> newVisitors = new List<int>();
List<int> returningVisitors = new List<int>();
int maxReturningVisitors = 0;
int maxNewVisitors = 0;
if (garesults.Rows != null){
foreach (var a in garesults.Rows)
{
string visType = a[6];
var day = Convert.ToInt32(a[4]);
if (dayList.Count() == 0)
{
dayList.Add(day);
}
else
{
var lastday = dayList.Last();
if (day != lastday)
{
dayList.Add(day);
filltoSameSize(newVisitors, returningVisitors);
}
}
int numVisits = Convert.ToInt32(a[7]);
if (visType == "New Visitor")
{
newVisitors.Add(numVisits);
report.TotalNewVisitors = (report.TotalNewVisitors + numVisits);
maxNewVisitors = Math.Max(maxNewVisitors, numVisits);
totalVisitors.Add(numVisits);
}
else
{
totalVisitors.Add(numVisits);
returningVisitors.Add(numVisits);
report.TotalReturningVisitors = (report.TotalReturningVisitors + numVisits);
maxReturningVisitors = Math.Max(maxReturningVisitors, numVisits);
}
reflinks.Add(a[0]);
keyWordList.Add(a[1]);
pagePathList.Add(a[2]);
cityList.Add(a[3]);
dayList.Add(day);
landingPages.Add(a[5]);
visitorType.Add(a[6]);
}
filltoSameSize(newVisitors, returningVisitors);
report.totalVisitors = totalVisitors;
report.maxNewVisitors = maxNewVisitors;
report.maxReturningVisitors = maxReturningVisitors;
report.newVisitors = newVisitors;
report.retVisitors = returningVisitors;
report.landingpagelist = landingPages;
report.keylist = keyWordList;
report.reflist = reflinks;
report.keylist = keyWordList;
//.........这里部分代码省略.........
示例4: RetrieveSPFs
public JsonResult RetrieveSPFs(int pupilID)
{
if (IsAuthorized())
{
Teacher user = VaKEGradeRepository.Instance.GetTeacher(((Teacher)Session["User"]).ID);
Session["User"] = user;
Pupil pupil = VaKEGradeRepository.Instance.GetPupil(pupilID);
//Session["SelPupilID"] = pupil.ID;
if (pupil != null)
{
List<Database.SPF> spfs = pupil.SPFs.ToList();
GridData gData = new GridData() { page = 1 };
List<RowData> rows = new List<RowData>();
Session["pupilID"] = pupilID;
foreach (SPF spf in spfs)
{
rows.Add(new RowData() { id = spf.ID, cell = new string[] { spf.Subject.Name, spf.Level.ToString() } });
}
gData.records = rows.Count();
gData.total = rows.Count();
gData.rows = rows.ToArray();
return Json(gData, JsonRequestBehavior.AllowGet);
}
return null;
}
return null;
}
示例5: filltoSameSize
public static void filltoSameSize(List<int> firstArray, List<int> secondArray)
{
if (firstArray.Count() < secondArray.Count())
{
firstArray.Add(0);
}
else if (secondArray.Count() < firstArray.Count())
{
secondArray.Add(0);
}
}
示例6: Create
public async Task<ActionResult> Create(IEnumerable<HttpPostedFileBase> file, Result model)
//public ActionResult Create(IEnumerable<HttpPostedFileBase> file, Result model)
{
try
{
// model.
List<Result> checkForResult = new List<Result>();
checkForResult = work.ResultRepository.Get().Where(a => a.Session == model.Session && a.Term == model.Term && a.Class == model.Class).ToList();
if (checkForResult.Count() > 0)
{
List<Level> theLevels = work.LevelRepository.Get().ToList();
List<SelectListItem> theItem = new List<SelectListItem>();
theItem.Add(new SelectListItem() { Text = "None", Value = "" });
foreach (var level in theLevels)
{
theItem.Add(new SelectListItem() { Text = level.LevelName + ":" + level.Type, Value = level.LevelName + ":" + level.Type });
}
ViewData["Class"] = theItem;
ModelState.AddModelError("", "You have uploaded for the class earlier!");
return View();
}
// TODO: Add insert logic here
if (string.IsNullOrEmpty(Request.Files[0].FileName))
{
ModelState.AddModelError("","No Uploaded Document!");
return View();
}//xlsx or xls
if ((Request.Files[0].FileName.EndsWith(".xlsx")) || (Request.Files[0].FileName.EndsWith(".xls")))
{
string fileExtension = System.IO.Path.GetExtension(Request.Files[0].FileName);
// string physicalPath = HttpContext.Server.MapPath("~/Content/") + Request.Files[0].FileName;
HttpPostedFileBase theFile = Request.Files[0];
var fileName = Path.GetFileName(Request.Files[0].FileName);
await new ReadResultExcelFile().Read(fileExtension, model.Class, model.Session, model.Term, theFile);
//new ReadResultExcelFile().Read( fileExtension, model.Class, model.Session, model.Term, theFile);
}
else
{
ModelState.AddModelError("", "The Input File is not a valid Excel file!");
return View();
}
return RedirectToAction("Index");
}
catch
{
List<Level> theLevels = work.LevelRepository.Get().ToList();
List<SelectListItem> theItem = new List<SelectListItem>();
theItem.Add(new SelectListItem() { Text = "None", Value = "" });
foreach (var level in theLevels)
{
theItem.Add(new SelectListItem() { Text = level.LevelName + ":" + level.Type, Value = level.LevelName + ":" + level.Type });
}
ViewData["Class"] = theItem;
return View();
}
}
示例7: RetrieveAllStudents
public JsonResult RetrieveAllStudents()
{
if (IsAuthorized()) {
Teacher user = VaKEGradeRepository.Instance.GetTeacher(((Teacher)Session["User"]).ID);
Session["User"] = user;
List<Database.Pupil> pupils = user.PrimaryClasses.First().Pupils.ToList();
GridData gData = new GridData() { page = 1 };
List<RowData> rows = new List<RowData>();
foreach (Database.Pupil pupil in pupils)
{
rows.Add(new RowData() { id = pupil.ID, cell = new string[] { pupil.LastName, pupil.FirstName, pupil.Religion, pupil.Birthdate.ToShortDateString(), pupil.Gender } });
}
gData.records = rows.Count();
gData.total = rows.Count();
gData.rows = rows.ToArray();
return Json(gData, JsonRequestBehavior.AllowGet);
}
return null;
}
示例8: 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);
}
示例9: ScoreBoardColumnHeaders
private void ScoreBoardColumnHeaders(ShowClasses showClass, PdfPTable callingListTbl, List<CallingListDto> callingList, float[] colWidths)
{
if (TeamPairsManager.isMultiDog(showClass.EntryType))
{
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("RO", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Team Name", headerHFont)))
{
BorderWidth = 0,
Colspan = 2
});
}
else
{
if (showClass.Lho == 1 || showClass.Lho == 2)
{
if (callingList.Any())
{
var item = callingList.First();
var cnt = callingList.Count(x => x.Lho == item.Lho);
var title = $"{(item.Lho == 0 ? "Full Height " : "Lower Height")} ({cnt})";
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(title, headerHFont)))
{
BorderWidth = 0,
Colspan = colWidths.Length,
BackgroundColor = Color.LIGHT_GRAY,
HorizontalAlignment = Element.ALIGN_CENTER,
FixedHeight = 20,
BorderColorBottom = Color.BLACK,
BorderWidthBottom = 2
});
}
else
{
var title = $"Dont Know (9999)";
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(title, headerHFont)))
{
BorderWidth = 0,
Colspan = colWidths.Length,
BackgroundColor = Color.LIGHT_GRAY,
HorizontalAlignment = Element.ALIGN_CENTER,
FixedHeight = 20,
BorderColorBottom = Color.BLACK,
BorderWidthBottom = 2
});
}
}
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("RO", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Ring No", headerHFont))) {BorderWidth = 0});
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Handler", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Dog Name", headerHFont))) { BorderWidth = 0 });
}
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Clears", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Faults", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Time", headerHFont))) { BorderWidth = 0 });
}
示例10: GenerateCommunityExplorerListDetailsExcel
private void GenerateCommunityExplorerListDetailsExcel(HSSFWorkbook workbook, string title, List<CommunityReportDataModel> list)
{
this.rowCount = 0;
var sheet = workbook.CreateSheet(title);
//(Optional) freeze the header row so it is not scrolled
sheet.CreateFreezePane(0, 1);
//Create a header row
var headerRow = sheet.CreateRow(this.rowCount++);
//Set the column names in the header row
headerRow.CreateCell(0).SetCellValue("Name");
headerRow.CreateCell(1).SetCellValue("Individuals");
headerRow.CreateCell(2).SetCellValue("Households");
var dataFormat = workbook.CreateCellStyle();
dataFormat.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0");
int rowNumber = 1;
//Populate the sheet with values from the grid data
foreach (var detail in list)
{
//Create a new row
var row = sheet.CreateRow(rowNumber++);
var idCell = row.CreateCell(0);
idCell.SetCellType(NPOI.SS.UserModel.CellType.String);
idCell.SetCellValue(detail.Name);
var countCell = row.CreateCell(1);
countCell.SetCellType(NPOI.SS.UserModel.CellType.Numeric);
countCell.SetCellValue((double)detail.IndividualCount);
countCell.CellStyle = dataFormat;
var paymentsCell = row.CreateCell(2);
paymentsCell.SetCellType(NPOI.SS.UserModel.CellType.Numeric);
paymentsCell.SetCellValue((double)detail.HouseholdCount);
paymentsCell.CellStyle = dataFormat;
}
//if no data is available, create blank page.
if (list.Count() == 0)
{
var row = sheet.CreateRow(rowNumber++);
row.CreateCell(0).SetCellValue(string.Empty);
row.CreateCell(1).SetCellValue(string.Empty);
row.CreateCell(2).SetCellValue(string.Empty);
}
//set column sizes
for (int i = 0; i <= 3; i++)
{
sheet.AutoSizeColumn(i);
}
}
示例11: SetMetaDataTitle
private void SetMetaDataTitle(FactoryStrategy strategy, List<IApplication> Applications)
{
if (Applications.Count() > 1)
Title = (strategy.isOnlySummary) ? "My Enbloc Assignments" : "My Council Assignments";
else
{
title = "Generic ID";
if (Applications.Count > 0)
{
var application = Applications[0];
switch (application.GetType().ToString())
{
case "CMWModels.CMWRfa":
var rfa = (CMWRfa)application;
title = rfa.RFAPANumber;
break;
case "CMWModels.CMWGrant":
var grant = (CMWGrant)application;
title = grant.FullGrantNum;
break;
default:
var fdappl = (FDApplication)application;
title = fdappl.ProjectNumber;
break;
}
}
}
}
示例12: Content
private IElement Content()
{
var table = new PdfPTable(2);
table.SetWidths(new[] { 1, 3 });
table.WidthPercentage = 100f;
table.SpacingAfter = 5f;
var titles = new List<string>
{
"Date", "Paid By",
"Amount", "In respect of"
};
var bankPayment = _feePayment.Bank != null && _feePayment.ReceiptNumber != null;
var chequePayment = _feePayment.ChequeNumber != null;
if (bankPayment)
{
titles.Add("Bank");
titles.Add("Receipt No");
}
else if (chequePayment)
{
titles.Add("Cheque No");
}
var commentExist = _feePayment.Comment != null;
if (commentExist)
{
titles.Add("Comment");
}
var texts = new List<string>
{
DateTime.Now.ToString(),
_feePayment.PaidBy,
$"{NumberText.NumberToWords((int)_feePayment.Amount)} Naira Only ({_feePayment.Amount} Naira)",
$"{_student.FirstName} {_student.LastName}"
};
if (bankPayment)
{
texts.Add(_feePayment.Bank);
texts.Add(_feePayment.ReceiptNumber);
}
else if (chequePayment)
{
texts.Add(_feePayment.ChequeNumber);
}
if (commentExist)
{
texts.Add(_feePayment.Comment);
}
for (int i = 0; i < titles.Count(); i++)
{
table.AddCell(AddTitle(titles[i].ToUpper(), Font8B));
table.AddCell(AddText(texts[i], Font8));
}
return table;
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
lista = _reporteServicio.FiltrarAgenteDTO(this.dateTimePicker1.Value.Date);
this.dataGridView1.DataSource = lista;
this.nudAusentes.Value = lista.Count(x => x.Ausente == "SI");
this.nudPresentes.Value = Convert.ToDecimal(lista.Count(x => x.Ausente != "SI"));
this.nudTarde.Value = Convert.ToDecimal(lista.Count(x => x.Tarde == "SI"));
}
示例14: saveResultsToPDFToolStripMenuItem_Click
private void saveResultsToPDFToolStripMenuItem_Click(object sender, EventArgs e)
{
BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, false);
iTextSharp.text.Font times = new iTextSharp.text.Font(bfTimes, 12, iTextSharp.text.Font.ITALIC, BaseColor.DARK_GRAY);
Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 42);
PdfWriter pdw = PdfWriter.GetInstance(doc, new FileStream("TextsStats"+DateTime.Now.GetHashCode().ToString() + ".pdf", FileMode.Create));
doc.Open();
Paragraph p = new Paragraph("Text Stats for : " + DateTime.Now, times);
doc.Add(p);
p.Alignment = 1;
PdfPTable pdt = new PdfPTable(4);
pdt.HorizontalAlignment = 1;
pdt.SpacingBefore = 20f;
pdt.SpacingAfter = 20f;
pdt.AddCell("Name of Text");
pdt.AddCell("MSE (Naivna)");
pdt.AddCell("MSE (Gramatika)");
pdt.AddCell("PCT");
c_tekst.SelectedIndex = 0;
c_analiza.SelectedIndex = 0;
foreach (Tekst t in lista_teksta)
{
c_analiza.SelectedIndex = 0;
calculateStats("Pojedinačan tekst", 1);
c_analiza.SelectedIndex = 1;
calculateStats("Pojedinačan tekst", 2);
if(c_tekst.SelectedIndex+1 < c_tekst.Items.Count)
c_tekst.SelectedIndex++;
}
List<StatistikaTekst> cista_lista_PDF = new List<StatistikaTekst>();
List<String> help = new List<String>();
StatistikaTekst ukupno = new StatistikaTekst();
foreach(StatistikaTekst st in lista_PDF)
{
if (!help.Contains(st.Ime_teksta))
{
help.Add(st.Ime_teksta);
ukupno.RMSE_G1 += st.RMSE_G1;
ukupno.RMSE_N1 += st.RMSE_N1;
cista_lista_PDF.Add(st);
}
}
ukupno.Ime_teksta = "TOTAL";
ukupno.RMSE_G1 /= cista_lista_PDF.Count();
ukupno.RMSE_N1 /= cista_lista_PDF.Count();
ukupno.RMSE_G1 = Math.Round(ukupno.RMSE_G1, 5);
ukupno.RMSE_N1 = Math.Round(ukupno.RMSE_N1, 5);
ukupno.Pct_diff = Math.Round(ukupno.RMSE_G1 / ukupno.RMSE_N1, 5);
cista_lista_PDF.Add(ukupno);
foreach (StatistikaTekst st in cista_lista_PDF)
{
pdt.AddCell(st.Ime_teksta);
pdt.AddCell(Convert.ToString(st.RMSE_N1));
pdt.AddCell(Convert.ToString(st.RMSE_G1));
pdt.AddCell(Convert.ToString(st.Pct_diff*100)+'%');
}
/*using (MemoryStream stream = new MemoryStream())
{
chart1.SaveImage(stream, ChartImageFormat.Png);
iTextSharp.text.Image chartImage = iTextSharp.text.Image.GetInstance(stream.GetBuffer());
chartImage.ScalePercent(75f);
chartImage.Alignment = 1;
doc.Add(chartImage);
}*/
doc.Add(pdt);
doc.Close();
using (ExcelPackage ep = new ExcelPackage())
{
//Here setting some document properties
ep.Workbook.Properties.Author = "MasterWordCounter";
ep.Workbook.Properties.Title = "Text Data";
//Create a sheet
ep.Workbook.Worksheets.Add("Text Data");
ExcelWorksheet ws = ep.Workbook.Worksheets[1];
ws.Name = "Text Data"; //Setting Sheet's name
ws.Cells.Style.Font.Size = 11; //Default font size for whole sheet
ws.Cells.Style.Font.Name = "Calibri"; //Default Font name for whole sheet
DataTable dt = new DataTable("TextsStats" + DateTime.Now.GetHashCode().ToString()); //My Function which generates DataTable
dt.Columns.Add("Ime Djela");
dt.Columns.Add("MSE (Naivna)");
dt.Columns.Add("MSE (Gramatika)");
dt.Columns.Add("Procenat (%)");
foreach (StatistikaTekst st in cista_lista_PDF)
{
DataRow dr = dt.NewRow();
dr["Ime Djela"] = (st.Ime_teksta);
dr["MSE (Naivna)"] = st.RMSE_N1;
dr["MSE (Gramatika)"] = st.RMSE_G1;
dr["Procenat (%)"] = st.Pct_diff * 100;
dt.Rows.Add(dr);
}
//Merging cells and create a center heading for out table
ws.Cells[1, 1].Value = "Ime Djela";
ws.Cells[1, 2].Value = "MSE (Naivna)";
ws.Cells[1, 3].Value = "MSE (Gramatika)";
ws.Cells[1, 4].Value = "Procenat (%)";
int colIndex = 1;
//.........这里部分代码省略.........
示例15: CreateToSiemens
public ActionResult CreateToSiemens([Bind(Include = "project_id")] feedbacks feedbacks, List<string> partners)
{
int a = partners.Count();
string[] partnerIDs = new string[a];
AspNetUsers anu;
int inc = 0;
foreach (var partner in partners)
{
anu = db.AspNetUsers.Single(asn => asn.Email == partner);
partnerIDs[inc] = anu.Id;
inc++;
}
inc = 0;
int iterations = 0;
int count = partnerIDs.Count();
iterations = count / 2;
int[] b = new int[a];
if (ModelState.IsValid)
{
foreach (var id in partnerIDs)
{
// return RedirectToAction("IndexMy", "feedbacks", new { perkelt = partnerIDs.Count()});
feedbacks.Id = id;
feedbacks.initiated = null;
feedbacks.received = null;
db.feedbacks.Add(feedbacks);
db.SaveChanges();
b[inc] = feedbacks.feedback_id;
inc++;
}
inc = 0;
foreach (var c in b)
{
foreach (var question in db.questions.Where(q => q.deprecated == "n" && q.for_project_role == "siemens").ToList())
{
feedback_questions feedback_question = new feedback_questions();
feedback_question.feedback_id = c;
feedback_question.question_id = question.question_id;
db.feedback_questions.Add(feedback_question);
db.SaveChanges();
}
}
TempData["successCreatedFeedback"] = "Úspešne ste vytvorili feedback";
return RedirectToAction("IndexForMe", "feedbacks");
//return RedirectToAction("Create", "feedback_questions", new { feedback_id = feedbacks.feedback_id });
}
return RedirectToAction("Index", "locations");
}