本文整理汇总了C#中iTextSharp.text.List.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# List.Contains方法的具体用法?C# List.Contains怎么用?C# List.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.List
的用法示例。
在下文中一共展示了List.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SystemHistoryTextual
public ActionResult SystemHistoryTextual()
{
// Get the user
var user = userRepository.GetUserByUsername(User.Identity.Name);
//var allPolls = new List<Poll>();
var allPolls = user.ManagedPolls;
var unique = new List<Poll>();
foreach (Poll poll in allPolls) { if (!unique.Contains(poll)) unique.Add(poll); }
allPolls = unique;
IDictionary<Poll, IList<User>> creatorList = new Dictionary<Poll, IList<User>>();
IDictionary<Poll, int> attendanceList = new Dictionary<Poll, int>();
foreach (var poll in allPolls)
{
// Get poll creators
creatorList.Add(poll, userRepository.GetCreatorsOfPoll(poll));
// Get poll attendance
int attendance = 0;
foreach (var participant in poll.participants)
{
if (participant.attended)
{
attendance += 1;
}
}
attendanceList.Add(poll, attendance);
}
var viewModel = new PollReportViewModel(allPolls, creatorList, attendanceList);
return View(viewModel);
}
示例2: GetJobFormHTMLForStoreNonVisit
private string GetJobFormHTMLForStoreNonVisit(JobFormNew JobFormNew)
{
try
{
List<string> parentIDList = new List<string>();
List<string> controlIDList = new List<string>();
int imagecount = 0;
List<WorkersInMotion.Model.ViewModel.JobFormValueDetails> FormValues = new List<WorkersInMotion.Model.ViewModel.JobFormValueDetails>();
StringBuilder sbJobForm = new StringBuilder();
// sbJobForm.Append("<div style='page-break-before:always'> </div>");
sbJobForm.Append("<html>");
sbJobForm.Append("<head><script type='text/javascript' src='http://maps.googleapis.com/maps/api/js?sensor=false'></script></head>");
sbJobForm.Append("<body>");
#region Generate JobForm
if (JobFormNew.JobFormHeading != null)
{
sbJobForm.Append("<div id='" + JobFormNew.JobFormHeading.JobGUID + "' name='" + JobFormNew.JobFormHeading.JobGUID + "'>");
sbJobForm.Append("<div align='center'>");
sbJobForm.Append("<table style='width:100%' align='center' cellpadding='0'>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td colspan='2' style='font-size:18px;font-family:verdana;font-weight:bold;text-align:center;'>" + JobFormNew.JobFormHeading.JobName + " Report</td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td colspan='2' style='font-size:18px;font-family:verdana;font-weight:bold;text-align:center;'> </td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 65%;' align='left'>Client Name :<span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.PlaceName + "</span> </td>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 35%;' align='left'>Client ID :<span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.PlaceID + "</span> </td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 65%;' align='left'>Store ID :<span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.MarketID + "</span> </td>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 35%;' align='left'>Check-In :<span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.CheckInTime + "</span> </td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 65%;' align='left'>Store Name : <span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.MarketName + "</span></td>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;width: 35%;' align='left'>Check-Out : <span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.CheckOutTime + "</span></td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("<tr>");
sbJobForm.Append("<td style='font-size:12px;font-family:verdana;font-weight:bold;text-align:left;' align='left'>Address :<span style='font-weight:normal;'>" + JobFormNew.JobFormHeading.MarketAddress + "</span> </td>");
sbJobForm.Append("</tr>");
sbJobForm.Append("</table>");
sbJobForm.Append("</div>");
sbJobForm.Append("<a name='" + JobFormNew.JobFormHeading.JobGUID + "' style='text-decoration: none;'> </a>");
sbJobForm.Append("<hr style='boder:1px solid black;width:100%'/>");
}
else
{
sbJobForm.Append("<div>");
}
if (JobFormNew != null && JobFormNew.FormValues != null)
{
foreach (var item1 in JobFormNew.FormValues)
{
if ((item1.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.parentID == -100) || (item1.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.controlParentLabel == "Email") || (item1.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.controlParentLabel == "Phone"))
{
if (!controlIDList.Contains(item1.ControlID.ToString()))
{
//if (!parentIDList.Contains(item1.parentID.ToString()))
//{
// parentIDList.Add(item1.parentID.ToString());
sbJobForm.Append("<div style='padding-top:5px;padding-bottom:5px'>");
sbJobForm.Append("<p style='color:black;font-weight:bold;font-size:12px;margin-left:1px;'>" + item1.controlParentLabel + "</p>");
sbJobForm.Append("<table style='width:100%' align='left' cellpadding='0'>");
sbJobForm.Append("<tr>");
foreach (var items in JobFormNew.FormValues.Where(one => (one.parentID == item1.parentID && one.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT) || ((one.ControlLabel == "Email" || one.ControlLabel == "Phone") && one.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT)))
{
if (!controlIDList.Contains(items.ControlID.ToString()))
{
controlIDList.Add(items.ControlID.ToString());
sbJobForm.Append("<td align='left' style='width:25%'>");
sbJobForm.Append("<span style='padding-left:0px;line-height:20px;font-size:10px;'>" + items.Value + "</span>");
// sbJobForm.Append("<p> </p>");
sbJobForm.Append("</td>");
}
}
sbJobForm.Append("</tr>");
sbJobForm.Append("</table>");
sbJobForm.Append("</div>");
}
}
//}
//else if ((item1.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.parentID == -101) || (item1.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.controlParentLabel == "Date"))
//{
// if (!parentIDList.Contains(item1.parentID.ToString()))
// {
// parentIDList.Add(item1.parentID.ToString());
// sbJobForm.Append("<div style='padding-top:5px;padding-bottom:5px'>");
// sbJobForm.Append("<p style='color:black;font-weight:bold;font-size:12px;margin-left:1px;'>" + item1.controlParentLabel + "</p>");
// sbJobForm.Append("<table style='width:100%' align='left' cellpadding='0'>");
// sbJobForm.Append("<tr>");
// sbJobForm.Append("<td align='left'>");
// foreach (var items in JobFormNew.FormValues.Where(one => (one.parentID == item1.parentID && ((one.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && item1.parentID == -101) || (one.ControlType == WorkersInMotion.Model.ViewModel.ControlType.CONTROL_TYPE_EDIT && one.ControlLabel == "Date")))))
// {
// if (!controlIDList.Contains(items.ControlID.ToString()))
// {
//.........这里部分代码省略.........
示例3: GeneratePDF
//.........这里部分代码省略.........
{
pVisit.Append("<tr>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Region</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Store ID</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Store Name</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Visit Date</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Status</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Field Manager</td>");
pVisit.Append("<td style='font-weight:bold;border-color:black;font-size:10px;font-family:verdana'>Details</td>");
pVisit.Append("</tr>");
pVisit.Append("</thead>");
pVisit.Append("<tbody>");
}
pVisit.Append("</tbody>");
pVisit.Append("</table>");
pVisit.Append("</div>");
if (pdfcontent == "StoreVisit" && Session["StoreVisit"] != null)
{
List<StoreVisit> visit = new List<StoreVisit>();
visit = (List<StoreVisit>)Session["StoreVisit"];
if (visit.Count > 0)
{
List<string> jobNameList = new List<string>();
foreach (StoreVisit item in visit)
{
JobFormNew pJobFormView = new JobFormNew();
Job _job = new Job();
_job = _IJobRepository.GetJobByID(item.JobGUID);
if (_job != null)
{
ViewBag.JobName = _job.JobName;
if (!jobNameList.Contains(_job.JobGUID.ToString()))
{
jobNameList.Add(_job.JobGUID.ToString());
if (!string.IsNullOrEmpty(_job.JobForm))
{
pJobFormView = JobFormJsonConvert(_job.JobForm, "PDFImageURL", _job.JobGUID.ToString());
}
if (pJobFormView != null && pJobFormView.FormValues != null && pJobFormView.FormValues.Count > 0)
{
pJobFormView.FormValues.OrderBy(x => x.ControlID);
// pVisit.Append(GetJobFormHTMLForStoreVisit(pJobFormView, _job.JobName, _job.JobGUID.ToString(), _job.CustomerStopGUID.ToString(), _job.JobGUID.ToString(), _job.StatusCode != null ? Convert.ToInt32(_job.StatusCode) : 6));
}
}
}
}
}
}
else if (pdfcontent == "StoreNonVisit" && Session["StoreNonVisit"] != null)
{
List<MarketModel> nonvisit = new List<MarketModel>();
nonvisit = (List<MarketModel>)Session["StoreNonVisit"];
if (nonvisit.Count > 0)
{
List<string> jobNameList = new List<string>();
foreach (MarketModel item in nonvisit)
{
JobFormNew pJobFormView = new JobFormNew();
Job _job = new Job();
Market _market = _IMarketRepository.GetMarketByID(new Guid(item.MarketGUID));
if (_market != null)
{
_job = _IJobRepository.GetJobByCustomerStopGUID(new Guid(item.MarketGUID));
示例4: ConflictLogic
/// <summary>
/// Adds conflicts to the database depending upon the current state of the election.
/// </summary>
/// <param name="session">A valid session.</param>
protected virtual void ConflictLogic(ISession session)
{
List<ElectionConflict> conflicts = ElectionConflict.FindElectionConflicts(session, ID);
foreach (ElectionConflict conflict in conflicts)
NHibernateHelper.Delete(session, conflict);
ITransaction transaction = session.BeginTransaction();
// Get the current committee
Committee committee = Committee.FindCommittee(session, PertinentCommittee);
// Get the users who won the election.
Dictionary<string, int> winners = GetResults(session);
List<User> winningUsers = new List<User>();
foreach (string email in winners.Keys)
{
winningUsers.Add(User.FindUser(session, email));
}
// Get the users on the committee.
List<User> members = User.FindUsers(session, committee.Name);
// List all of the departments currently present on the committee.
// and use a parallel list to store the ID of the other department
// member so we can add it to the conflict later.
List<DepartmentType> departments = new List<DepartmentType>();
List<int> secID = new List<int>();
foreach (User i in members)
{
departments.Add(i.Department);
secID.Add(i.ID);
}
// For each user who won, add a new conflict if their department
// is already present on the list. Adding, departments as we go.
// Also raise conflicts if the winning users hold officer positions,
// or if they already serve on a committee.
foreach (User i in winningUsers)
{
// check if they have a prior committment
if (i.OfficerPosition != OfficerPositionType.None ||
i.CurrentCommittee != User.NoCommittee)
{
ElectionConflict conflict = new ElectionConflict();
conflict.Election = ID;
conflict.FirstUser = i.ID;
conflict.SecUser = ElectionConflict.SecondUserNotApplicable;
conflict.Type = ConflictType.ElectedToMultipleCommittees;
session.SaveOrUpdate(conflict);
}
// check for department-based conflicts
if(departments.Contains(i.Department))
{
ElectionConflict conflict = new ElectionConflict();
conflict.Election = ID;
conflict.FirstUser = i.ID;
conflict.SecUser = secID[departments.IndexOf(i.Department)];
conflict.Type = ConflictType.TooManyDeptMembers;
session.SaveOrUpdate(conflict);
}
}
session.Flush();
NHibernateHelper.Finished(transaction);
}
示例5: FiltersPartial
public ActionResult FiltersPartial(int? param)
{
List<AllOptionsModel> readyList = new List<AllOptionsModel>();
AllOptionsModel readyModel = new AllOptionsModel();
List<string> list = new List<string>();
var producers = from x in db.ProdutcsToCategories
where x.CatId == param
select x.Product.Producer;
foreach (var producer in producers)
{
if (producer != null)
{
if (!list.Contains(producer))
list.Add(producer);
}
}
readyModel.listString = list.ToList();
var option = from x in db.Options
where x.categoryId == param
select x;
List<OptionModel> om = new List<OptionModel>();
foreach (var opt in option)
{
OptionModel model = new OptionModel();
model.option = opt;
var option2 = from x in db.OptionValues
where x.ValueId == opt.ValuesId
select x;
List<OptionValue> ovl = new List<OptionValue>();
foreach (var optionValue in option2)
{
if (optionValue != null)
{
//model.optionValueList.Add(optionValue);
ovl.Add(optionValue);
}
}
model.optionValueList = ovl;
om.Add(model);
//readyModel.optionList.Add(model);
}
readyModel.optionList = om;
readyList.Add(readyModel);
return View("FiltersPartial", readyModel);
}
示例6: Fill
/// <summary>
/// Displays form fiels for chosed identifiers.
/// </summary>
/// <param name="formCollection">object that encapsulates chosed identifiers for reporting</param>
public ActionResult Fill(FormCollection formCollection)
{
if (Session["OrganisationID"] == null)
{
TempData["accessError"] = "Vaše session vypršela, nebo nejste přihlášen.";
return RedirectToAction("LogOn", "Organisation");
}
bool standardSubsectors = true;
bool specialisedSubsectorsCorrect = true;
this.TempData.Clear();
foreach (var key in formCollection.AllKeys)
{
if (!key.StartsWith("S"))
{
int subsectorID = Convert.ToInt32(key);
var subsector = db.SubsectorsESG.Where(s => s.ID == subsectorID).SingleOrDefault();
char[] delimiter2 = { ',' };
string[] identifiers2 = formCollection[key].Split(delimiter2);
IList<int> intIdentifiers1 = new List<int>();
foreach (var item in identifiers2)
{
intIdentifiers1.Add(Convert.ToInt32(item));
TempData[key + "-" + item] = "checked";
}
int countScope1 = subsector.KeyPerformanceIdentifiers.Where(kpi => kpi.Scope == 1).Count();
int countScope1Check = subsector.KeyPerformanceIdentifiers
.Where(kpi => kpi.Scope == 1)
.Where(kpi => intIdentifiers1.Contains(kpi.ID))
.Count();
if (countScope1 != countScope1Check)
{
standardSubsectors = false;
}
}
if (key.StartsWith("S"))
{
char[] delimiter = { '-' };
string[] parts = key.Split(delimiter);
int subsectorID = Convert.ToInt32(parts[1]);
var subsector = db.SpecialisedSubsectorsESG.Where(s => s.ID == subsectorID).SingleOrDefault();
char[] delimiter2 = { ',' };
string[] identifiers2 = formCollection[key].Split(delimiter2);
IList<int> intIdentifiers = new List<int>();
foreach (var item in identifiers2)
{
intIdentifiers.Add(Convert.ToInt32(item));
TempData["S-" + subsectorID + "-" + item] = "checked";
}
int countScope1 = subsector.SpecialisedIdentifiers.Where(kpi => kpi.Scope == 1 && kpi.Activated).Count();
int countScope1Check = subsector.SpecialisedIdentifiers
.Where(si => si.Scope == 1 && si.Activated)
.Where(si => intIdentifiers.Contains(si.ID))
.Count();
if (countScope1 != countScope1Check)
{
specialisedSubsectorsCorrect = false;
}
}
}
if (formCollection.AllKeys.Where(s => !s.StartsWith("S")).Count() == 0)
{
TempData["errorFound"] = "errorFound";
TempData["notChosedStandardSubsector"] = "Musi být zvolen alespoň 1 standardní podsektor a všechny jeho identifikátory rozsahu 1.";
return RedirectToAction("Choose");
}
if (!standardSubsectors || !specialisedSubsectorsCorrect)
{
TempData["errorFound"] = "errorFound";
TempData["notChosedStandardSubsector"] = "Musi být zvolen alespoň 1 standardní podsektor a všechny jeho identifikátory rozsahu 1.";
return RedirectToAction("Choose");
}
ChosedIdentifiers chosedIdentifiers = null;
chosedIdentifiers = new ChosedIdentifiers();
foreach (var key in formCollection.AllKeys)
{
if (key.StartsWith("S"))
//.........这里部分代码省略.........
示例7: UpdateExplanationValidationField
protected void UpdateExplanationValidationField()
{
HealthStatements collection = (HealthStatements)(Session["HealthStatements"]);
List<String> QuestionsToAnswer = new List<String>();
foreach (System.Web.UI.WebControls.ListItem li in cmbQuestion.Items)
{
if (!QuestionsToAnswer.Contains(li.Value))
{
QuestionsToAnswer.Add(li.Value);
}
}
foreach (HealthStatement hs in collection.MyHealthStatements)
{
if (QuestionsToAnswer.Contains(hs.QuestionNum))
{
QuestionsToAnswer.Remove(hs.QuestionNum);
}
}
//Update field used for validation.
NumExplanationsRequired.Value = QuestionsToAnswer.Count.ToString();
}
示例8: RegisterProfesor
public ActionResult RegisterProfesor(Profesor profesor)
{
if (ModelState.IsValid)
{
if (profesor.Password == profesor.ConfirmPassword)
{
IRepositorio<Profesor> repositorioProfesor = new ProfesorRepositorio();
var miProfesor = repositorioProfesor.GetByUniqueAtribute(profesor.Username);
IRepositorio<Alumno> repositorioAlumno = new AlumnoRepositorio();
var miAlumno = repositorioAlumno.GetByUniqueAtribute(profesor.Username);
if (miProfesor == null && miAlumno == null)
{
MembershipCreateStatus createStatus = MembershipService.CreateUser(profesor.Username,
profesor.Password,
profesor.Nombre.Substring(0, 1) + profesor.Apellido + "@ucab.edu.ve");
if (createStatus == MembershipCreateStatus.Success)
{
if (Roles.RoleExists("Profesor"))
{
Roles.AddUserToRole(profesor.Username, "Profesor");
}
else
{
Roles.CreateRole("Profesor");
Roles.AddUserToRole(profesor.Username, "Profesor");
}
profesor.CreationDate = DateTime.Today;
var prof = repositorioProfesor.GetById(profesor.Cedula);
var flag = prof == null ? repositorioProfesor.Save(profesor) : repositorioProfesor.Update(profesor);
if (flag.CompareTo("true") == 0)
{
Session["cedula"] = profesor.Cedula;
IRepositorio<Actividad> repositorioActividad = new ActividadRepositorio();
var listActividades =
repositorioActividad.GetAll().Where(a => a.Profesor == profesor.Cedula &&
a.Periodo.CompareTo(_periodoActual) == 0 &&
a.Tipo.CompareTo("Clase") == 0).ToList();
var misMaterias = new List<Materium>();
IRepositorio<Materium> repositorioMateria = new MateriumRepositorio();
foreach (var actividad in listActividades)
{
var materia = repositorioMateria.GetById(actividad.IdMateria);
materia.Seccion = actividad.Seccion;
if (!misMaterias.Contains(materia))
{
misMaterias.Add(materia);
}
}
profesor.Materiums = misMaterias;
FormsService.SignIn(profesor.Username, false /* createPersistentCookie */);
return View("ConfigurationProfesor", profesor);
}
else
{
ModelState.AddModelError("saveAlumno", "Oops! Ha ocurrido un error inesperado, vuelva a intentarlo.");
}
}
else
{
ModelState.AddModelError("passOrUsername", AccountValidation.ErrorCodeToString(createStatus));
}
}
else
{
ModelState.AddModelError("passOrUsername", "Oops!! El nombre de usuario ya existe, por favor intente con otro.");
}
}
else
{
ModelState.AddModelError("contrasenia", "Las contraseñas no coinciden.");
}
}
return View(profesor);
}
示例9: IsValidFileExtension
public static bool IsValidFileExtension(string extension)
{
extension = extension.Replace(".", "");
IEnumerable<string> extensions = new List<string> { "pdf", "doc", "docx", "odt", "txt", "xls", "xlsx", "ods", "ppt", "pptx", "odp" };
return extensions.Contains(extension);
}
示例10: printRingForUser
//.........这里部分代码省略.........
{
ix = clsName.IndexOf(" ");
clsName = clsName.Substring(0, ix) + " " + grades + " " + clsName.Substring(ix + 1);
}
if (dogsList.Tables[0].Rows.Count > 0)
{
Phrase[] tmpCells = new Phrase[3];
tmpCells[0] = new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogInClass));
tmpCells[1] = new Phrase(new Chunk(clsName, dogInClass));
tmpCells[2] = new Phrase(new Chunk(String.Format("({0})", DogsInClass), dogInClass));
int countDogs = 0;
int DefaultHandler;
Paragraph p = new Paragraph();
foreach (DataRow dogRow in dogsList.Tables[0].Rows)
{
int DogID = Convert.ToInt32(dogRow["DogID"]);
DefaultHandler = Convert.ToInt32(dogRow["DefaultHandler"]);
if (DefaultHandler == 0) DefaultHandler = -1;
if ((DefaultHandler == -1 && currentUser.UserID == UserID) ||
(DefaultHandler == UserID)
)
{
if (countDogs == 0)
{
cell = new PdfPCell(tmpCells[0]);
cell.BorderWidth = 0;
cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
classDetailsTable.AddCell(cell);
p.Add(tmpCells[1]);
p.Add(Chunk.NEWLINE);
}
if (!dogsRunningToday.Contains(DogID))
{
dogsRunningToday.Add(DogID);
}
String img = "<img src='data:image/gif;base64," + CreateImage(dogRow["DogColour"].ToString()) + "' />";
String dogName = dogRow["DogName"].ToString();
if (dogName.Length == 0)
{
dogName = dogRow["KCName"].ToString();
}
var chunk = new Chunk(" ", dogDetailsInClass);
chunk.SetBackground(new Color( System.Drawing.ColorTranslator.FromHtml(dogRow["DogColour"].ToString()) ));
p.Add(new Phrase(chunk));
p.Add(new Phrase(new Chunk(String.Format(" [{1}] {0}", dogName, dogRow["RO"]), dogDetailsInClass)));
p.Add(Chunk.NEWLINE);
int AltHandler = Convert.ToInt32(dogRow["AltHandler"]);
String HandlerName = "";
if (AltHandler > 0)
{
User u = new User(AltHandler);
HandlerName = u.Name;
html += "<div class='altHandler'>Handler:" + AltHandler + "</div>";
p.Add(Chunk.NEWLINE);
p.Add(new Phrase(new Chunk(String.Format("Handler:", AltHandler),dogInClass)));
}
countDogs++;
}
else
{
if (defaultUsers != null && defaultUsers.IndexOf(DefaultHandler) == -1)
{
示例11: 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;
//.........这里部分代码省略.........
示例12: GetListOfUserNames
/// <summary>
/// GetLIstOfUserNames Method Definition
/// </summary>
/// <param name="projectName"></param>
/// <returns></returns>
public Boolean GetListOfUserNames(string projectName)
{
dtView.DataSource = null;
dtView.Rows.Clear();
_glUsers.Clear();
if (projectName == "ALL")
{
lstProjects.Items.Clear();
lstProjects.Items.Add("All TFS Projects");
lstProjects.Items.Add("");
teamProjects = _versionControl.GetAllTeamProjects(false);
foreach (TeamProject tp in teamProjects)
{
lstProjects.Items.Add(tp.Name);
Identity[] appGroups = _securityService.ListApplicationGroups(tp.ArtifactUri.AbsoluteUri);
foreach (Identity group in appGroups)
{
Identity[] groupMembers = _securityService.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
if (groupMembers.Length == 0) break;
foreach (Identity member in groupMembers)
{
if (member.Members.Length == 0) break;
if (member.Members != null)
{
foreach (string memberSid in member.Members)
{
Identity memberInfo = _securityService.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.None);
if (memberInfo.Type != IdentityType.WindowsUser) continue;
if (_glUsers.Contains(memberInfo.Sid))
_userDetail = (UserDetails)_glUsers[memberInfo.Sid];
else
_userDetail = new UserDetails(memberInfo);
//update the project and permission
_userDetail.TeamProject = tp.Name;
_userDetail.Permission = group.DisplayName;
_userDetail.UpdateProjectAndPermission(tp.Name, group.DisplayName);
if (_glUsers.ContainsKey(memberInfo.Sid))
_glUsers.Remove(memberInfo.Sid);
_glUsers.Add(memberInfo.Sid, _userDetail);
}
}
}
}
}
}
else if (projectName == "")
{
}
else
{
TeamProject teamproject = _versionControl.GetTeamProject(projectName);
Identity[] appGroups = _securityService.ListApplicationGroups(teamproject.ArtifactUri.AbsoluteUri);
List<Identity> usernames = new List<Identity>();
foreach (Identity group in appGroups)
{
Identity[] groupMembers = _securityService.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
foreach (Identity member in groupMembers)
{
if (member.Members != null)
{
foreach (string memberSid in member.Members)
{
Identity memberInfo = _securityService.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.None);
if (memberInfo.Type != IdentityType.WindowsUser) continue;
if (usernames.Contains(memberInfo))
_userDetail = (UserDetails)_glUsers[memberInfo.Sid];
else
_userDetail = new UserDetails(memberInfo);
//update the project and permission
_userDetail.TeamProject = teamproject.Name;
_userDetail.Permission = group.DisplayName;
_userDetail.UpdateProjectAndPermission(teamproject.Name, group.DisplayName);
if (_glUsers.ContainsKey(memberInfo.Sid))
_glUsers.Remove(memberInfo.Sid);
_glUsers.Add(memberInfo.Sid, _userDetail);
}
}
}
}
}
//.........这里部分代码省略.........
示例13: ICS109
public ActionResult ICS109(Guid id)
{
var mission = this.db.Missions.Include("Log").Single(f => f.Id == id);
string pdfTemplate = Server.MapPath(Url.Content("~/Content/forms/ics109-log.pdf"));
using (MemoryStream result = new MemoryStream())
{
iTextSharp.text.Document resultDoc = new iTextSharp.text.Document();
PdfCopy copy = new PdfCopy(resultDoc, result);
resultDoc.Open();
Queue<Tuple<string, string, string>> rows = null;
int numPages = -1;
int totalRows = 0;
int page = 1;
List<string> operators = new List<string>();
do
{
using (MemoryStream filledForm = new MemoryStream())
{
iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(pdfTemplate);
//// create and populate a string builder with each of the
//// field names available in the subject PDF
//StringBuilder sb = new StringBuilder();
//foreach (var de in pdfReader.AcroFields.Fields)
//{
// sb.Append(de.Key.ToString() + Environment.NewLine);
//}
//// Write the string builder's content to the form's textbox
using (MemoryStream buf = new MemoryStream())
{
PdfStamper stamper = new PdfStamper(pdfReader, buf);
var fields = stamper.AcroFields;
if (rows == null)
{
rows = Fill109Rows(mission.Log.OrderBy(f => f.Time), fields, "topmostSubform[0].Page1[0].SUBJECTRow1[0]");
totalRows = rows.Count;
}
foreach (var field in fields.Fields)
{
fields.SetField(field.Key, "");
}
int currentRow = 1;
operators.Clear();
while (rows.Count > 0 && fields.GetField("topmostSubform[0].Page1[0].SUBJECTRow" + currentRow.ToString() + "[0]") != null)
{
var row = rows.Dequeue();
fields.SetField("topmostSubform[0].Page1[0].TIMERow" + currentRow.ToString() + "[0]", row.Item1);
fields.SetField("topmostSubform[0].Page1[0].SUBJECTRow" + currentRow.ToString() + "[0]", row.Item2);
if (!operators.Contains(row.Item3)) operators.Add(row.Item3);
currentRow++;
}
// Now we know how many rows on a page. Figure out how many pages we need for all rows.
if (numPages < 0)
{
int rowsPerPage = currentRow - 1;
int remainder = totalRows % currentRow;
numPages = ((remainder == 0) ? 0 : 1) + (totalRows / currentRow);
}
if (numPages > 0)
{
fields.SetField("topmostSubform[0].Page1[0]._1_Incident_Name[0]", " " + mission.Title);
fields.SetField("topmostSubform[0].Page1[0]._3_DEM_KCSO[0]", " " + mission.StateNumber);
fields.SetField("topmostSubform[0].Page1[0]._5_RADIO_OPERATOR_NAME_LOGISTICS[0]", string.Join(",", operators.Distinct()));
fields.SetField("topmostSubform[0].Page1[0].Text30[0]", string.Format("{0:yyyy-MM-dd}", mission.Log.DefaultIfEmpty().Min(f => (f == null) ? (DateTime?)null : f.Time)));
fields.SetField("topmostSubform[0].Page1[0].Text31[0]", string.Format("{0:yyyy-MM-dd}", mission.Log.DefaultIfEmpty().Max(f => (f == null) ? (DateTime?)null : f.Time)));
fields.SetField("topmostSubform[0].Page1[0].Text28[0]", page.ToString());
fields.SetField("topmostSubform[0].Page1[0].Text29[0]", numPages.ToString());
fields.SetField("topmostSubform[0].Page1[0].DateTime[0]", DateTime.Now.ToString(" MMM d, yyyy HH:mm"));
fields.SetField("topmostSubform[0].Page1[0]._8_Prepared_by_Name[0]", Strings.DatabaseName);
fields.RemoveField("topmostSubform[0].Page1[0].PrintButton1[0]");
}
stamper.FormFlattening = false;
stamper.Close();
pdfReader = new PdfReader(buf.ToArray());
copy.AddPage(copy.GetImportedPage(pdfReader, 1));
page++;
}
}
//copy.Close();
} while (rows != null && rows.Count > 0);
resultDoc.Close();
return File(result.ToArray(), "application/pdf", mission.StateNumber + "_ICS109_CommLog.pdf");
//.........这里部分代码省略.........
示例14: ConfigurationProfesor
public ActionResult ConfigurationProfesor()
{
IRepositorio<Profesor> repositorioProfesor = new ProfesorRepositorio();
var miCedula = (int)Session["cedula"];
var profesor = repositorioProfesor.GetById(miCedula);
IRepositorio<Actividad> repositorioActividad = new ActividadRepositorio();
var listActividades =
repositorioActividad.GetAll().Where(a => a.Profesor == profesor.Cedula &&
a.Periodo.CompareTo(_periodoActual) == 0 &&
a.Tipo.CompareTo("Clase") == 0);
var misMaterias = new List<Materium>();
IRepositorio<Materium> repositorioMateria = new MateriumRepositorio();
foreach (var actividad in listActividades)
{
var materia = repositorioMateria.GetById(actividad.IdMateria);
materia.Seccion = actividad.Seccion;
if (!misMaterias.Contains(materia))
{
var listActividadEval = repositorioActividad.GetAll().Where(a => a.Tipo.CompareTo("Evaluacion") == 0 &&
a.Periodo.CompareTo(_periodoActual) == 0 &&
a.Profesor == miCedula &&
a.Seccion == materia.Seccion &&
a.IdMateria == materia.IdMateria).ToList();
if (listActividadEval.Count == 0)
{
misMaterias.Add(materia);
}
}
}
profesor.Materiums = misMaterias;
return View(profesor);
}
示例15: button5_Click
private void button5_Click(object sender, EventArgs e)
{
List<string> employeeIdToRemove = new List<string>();
if (EmployeesDataGrid.SelectedRows.Count > 0)
{
foreach (DataGridViewRow row in EmployeesDataGrid.SelectedRows)
{
//MessageBox.Show( row.Cells["EmployeeID"].Value.ToString());
if (!employeeIdToRemove.Contains(row.Cells["EmployeeID"].Value.ToString()))
{
employeeIdToRemove.Add(row.Cells["EmployeeID"].Value.ToString());
}
}
}
else if (EmployeesDataGrid.SelectedCells.Count > 0)
{
foreach (DataGridViewCell cell in EmployeesDataGrid.SelectedCells)
{
DataGridViewRow row = EmployeesDataGrid.Rows[cell.RowIndex];
//MessageBox.Show(row.Cells["EmployeeID"].Value.ToString());
if (!employeeIdToRemove.Contains(row.Cells["EmployeeID"].Value.ToString()))
{
employeeIdToRemove.Add(row.Cells["EmployeeID"].Value.ToString());
}
}
}
foreach (string ID in employeeIdToRemove)
{
DialogResult confirm = MessageBox.Show("Are you sure you want to Delete employee ID# " + ID,
"Confirm Delete",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button2);
if (confirm == DialogResult.Yes)
{
Controller controller = new Controller(database);
controller.RemoveEmployee(ID);
EmployeesDataGrid.DataSource = null;
EmployeesDataGrid.Update();
EmployeesDataGrid.Refresh();
List<Employee> data;
data = this.database.SelectAllEmployee();
EmployeesDataGrid.DataSource = data;
EmployeesDataGrid.Update();
EmployeesDataGrid.Refresh();
}
}
}