本文整理汇总了C#中iTextSharp.text.List.Last方法的典型用法代码示例。如果您正苦于以下问题:C# List.Last方法的具体用法?C# List.Last怎么用?C# List.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.List
的用法示例。
在下文中一共展示了List.Last方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: CreateCoordinates
/// <summary>
/// Creates the coordinates for cropping.
/// </summary>
/// <param name="whites">Coordinates of white pixels at the edge of the image.</param>
/// <param name="width">Width that will be cropped.</param>
/// <param name="height">Height that will be cropped.</param>
/// <returns>List of Coordinates.</returns>
private List<System.Drawing.Rectangle> CreateCoordinates(List<int> whites, int width, int height)
{
List<System.Drawing.Rectangle> rectangles = new List<System.Drawing.Rectangle>();
for (int i = 0; i < whites.Count; i++)
{
if (i == 0)
{
rectangles.Add(new System.Drawing.Rectangle(0, i, width, whites[i]));
}
else
{
if (whites[i] == whites.Last())
{
int croppedHeight = height - whites[i];
rectangles.Add(new System.Drawing.Rectangle(0, whites[i], width, croppedHeight));
continue;
}
if (((whites[i] - 1) == whites[i - 1]) && ((whites[i] + 1) == whites[i + 1]))
{
continue;
}
else
{
int croppedHeight = whites[i + 1] - whites[i];
rectangles.Add(new System.Drawing.Rectangle(0, whites[i], width, croppedHeight));
i++;
}
}
}
return rectangles;
}
示例3: 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;
}
示例4: FillTable
private void FillTable(PdfPTable pdfTable, List<StoreReport> allReports)
{
var mainHeaderCell = GetCustomizedCell("Aggregated Sales Report", 1, TABLE_COLUMNS, 15);
pdfTable.AddCell(mainHeaderCell);
mainHeaderCell.Padding = 0f;
var currentDate = allReports.First().Date;
SetHeadersContent(pdfTable, currentDate);
decimal currentSum = 0;
decimal grandTotalSum = 0;
var isDateChanged = false;
foreach (var monthReport in allReports)
{
if (isDateChanged)//monthReport.Date != currentDate)
{
SetHeadersContent(pdfTable, monthReport.Date);
isDateChanged = false;
}
foreach (var product in monthReport.Products)
{
AddProductInfo(product, pdfTable);
}
currentSum += monthReport.TotalSum;
grandTotalSum += monthReport.TotalSum;
if (!monthReport.Date.Equals(currentDate))// || monthReport.Equals(allReports.First()))
{
SetTotalSumRow(pdfTable, currentSum, monthReport);
currentDate = monthReport.Date;
currentSum = 0;
isDateChanged = true;
}
}
SetTotalSumRow(pdfTable, currentSum, allReports.Last());
SetGrandTotalSumRow(pdfTable, grandTotalSum);
}