private async Task <PersonDetail> UpdateDetailOnImplementationAsync(PersonDetail value) { PersonDetail pd = null; await _db.StoredProcedure("[Demo].[spPersonUpdateDetail]") .Params((p) => PersonData.DbMapper.Default.MapToDb(value, p, Mapper.OperationTypes.Update)) .TableValuedParam("@WorkHistoryList", WorkHistoryData.DbMapper.Default.CreateTableValuedParameter(value.History)) .ReselectRecordParam() .SelectQueryMultiSetAsync( new MultiSetSingleArgs <Person>(PersonData.DbMapper.Default, (r) => { pd = new PersonDetail(); pd.CopyFrom(r); }, false, true), new MultiSetCollArgs <WorkHistoryCollection, WorkHistory>(WorkHistoryData.DbMapper.Default, (r) => pd.History = r)); return(pd); }
// GET: PersonDetails/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonDetail personDetail = db.PersonDetails.Find(id); if (personDetail == null) { return(HttpNotFound()); } return(View(personDetail)); }
public void ConvertNumtoAlphaTest() { Mock <IConvertAmount> convertAmtObj = new Mock <IConvertAmount>(); ConversionController conversionControllerObj = new ConversionController(convertAmtObj.Object); PersonDetail personDetails = new PersonDetail(); personDetails.Name = "Hemant"; personDetails.Amount = "123"; var result = conversionControllerObj.ConvertNumtoAlpha(personDetails) as JsonResult; var mockResult = GetTestPersonDetails(); Assert.AreEqual(result.Data, mockResult.Data); }
public override async Task InitializeAsync(object navigationData) { if (navigationData != null) // For edit { int persondId = (int)navigationData; PersonDetail = await _personService.GetPersonDetailsAsync(persondId) as PersonDetail; await base.InitializeAsync(navigationData); } else // For save { PersonDetail = new PersonDetail(); } }
private PersonDetail getPersonDetail(string personId) { PersonDetail pDetail = null; foreach (PersonDetail personDetail in matchedPersons) { if (personDetail.getPersonId() == personId) { pDetail = personDetail; Console.WriteLine("###-->> Matched against list of person = " + personId); break; } } return(pDetail); }
public bool Index(PersonDetail person) { var client = new ElasticClient(Setting.ConnectionSettings); try { var index = client.Index(person); return(index.Created); } catch (Exception ex) { Console.WriteLine(" Excepton Message : " + ex.Message); } return(false); }
static void AddPerson() { //123這個人 Person person_123 = new Person("123"); //123的個人文件 PersonDetail detail_123 = new PersonDetail() { FileName = "123文件" }; //加入字典中 PersonValues.Add(person_123, detail_123); //True 表示字典裡有這個人(Person 類別)的資料 bool get = PersonValues.ContainsKey(person_123); }
private static PersonFile UploadFile(PersonDetail objPerson, HttpPostedFileBase file) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(HttpContext.Current.Server.MapPath("~/PersonFiles"), fileName); file.SaveAs(path); var objFile = new PersonFile() { FileName = fileName, IsActive = true, PersonId = objPerson.Id }; return(objFile); }
private async Task <PersonDetail> GetDetailOnImplementationAsync(Guid id) { PersonDetail pd = null; System.Diagnostics.Debug.WriteLine($"One, Thread: {System.Threading.Thread.CurrentThread.ManagedThreadId }"); await GetAsync(id); System.Diagnostics.Debug.WriteLine($"Two, Thread: {System.Threading.Thread.CurrentThread.ManagedThreadId }"); await _db.StoredProcedure("[Demo].[spPersonGetDetail]") .Param(DbMapper.Default.GetParamName(nameof(PersonDetail.Id)), id) .SelectQueryMultiSetAsync( new MultiSetSingleArgs <Person>(PersonData.DbMapper.Default, (r) => { pd = new PersonDetail(); pd.CopyFrom(r); }, isMandatory: false), new MultiSetCollArgs <WorkHistoryCollection, WorkHistory>(WorkHistoryData.DbMapper.Default, (r) => pd.History = r)); return(pd); }
// POST api/PersonDetail public void Post([FromBody] PersonDetail person) { if (!ModelState.IsValid) { throw new Exception("Validation failed"); } try { _generalRepository.SavePerson(person.ToDataModel()); } catch { throw new Exception("An error occurred"); } }
public bool AddPerson(PersonDetail personDetail) { try { using (var db = new PersonContext()) { db.PersonDetails.Add(personDetail); db.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public PersonDetail BuildDetailedPerson(int reference, string domain) { PersonDetail person = new PersonDetail() { ID = reference, Age = new Random().Next(18, 100), Name = personNameGenerator.GenerateRandomFirstAndLastName(), Occupation = occupationGeneratorService.GetRandomOccupation(), WeeklyHoursWorked = new Random().Next(10, 60), MaritalStatus = GetRandomMaritalStatus() }; person.Href = domain + "/api/people/" + person.ID; return(person); }
public ActionResult Create(PersonDetail model, HttpPostedFileBase file) { try { // TODO: Add insert logic here if (ModelState.IsValid) { _service.AddPersonDetails(model, file); } return(RedirectToAction("Index")); } catch { return(View()); } }
protected override void OnSetUp() { using (var session = OpenSession()) using (var tx = session.BeginTransaction()) { var person1 = new Person { FirstName = "Jack" }; session.Save(person1); var person2 = new Person { FirstName = "Robert" }; session.Save(person2); var personDetail = new PersonDetail { LastName = "Smith", Person = person1 }; session.Save(personDetail); tx.Commit(); } }
public JsonResult ConvertNumtoAlpha(PersonDetail personDetails) { if (personDetails != null && !string.IsNullOrEmpty(personDetails?.Name) && personDetails?.Amount != null) { var model = _convertAmountRepo.ConvertAmountToAplha(personDetails); return(new JsonResult() { Data = new { outPut = model, StatusCode = 200 }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } return(new JsonResult() { Data = new { outPut = "", StatusCode = 400 }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
/// <summary> /// Adds the primary person to the group. This is the person that entered /// all the information on the screen. /// </summary> /// <param name="personDetails">The person to be added.</param> /// <param name="group">The group to add the person to.</param> /// <param name="rockContext">The rock context.</param> /// <returns>The <see cref="GroupMember"/> instance that identifies the person in the group.</returns> private GroupMember AddPrimaryPersonToGroup(PersonDetail personDetails, Group group, RockContext rockContext) { var personService = new PersonService(rockContext); Person person = null; // Need to re-load the person since we are going to modify and we // need control of the context the person is in. if (AutofillForm && RequestContext.CurrentPerson != null) { person = personService.Get(RequestContext.CurrentPerson.Id); } if (person == null) { // If not logged in, try to match to an existing person. var matchQuery = new PersonService.PersonMatchQuery(personDetails.FirstName, personDetails.LastName, personDetails.Email, personDetails.MobilePhone); person = personService.FindPerson(matchQuery, true); } // If we have an existing person, update their personal information. if (person != null) { person.FirstName = personDetails.FirstName; person.LastName = personDetails.LastName; if (personDetails.Email.IsNotNullOrWhiteSpace()) { person.Email = personDetails.Email; } if (PhoneNumber.CleanNumber(personDetails.MobilePhone).IsNotNullOrWhiteSpace()) { int phoneNumberTypeId = DefinedValueCache.Get(SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE).Id; person.UpdatePhoneNumber(phoneNumberTypeId, "+1", personDetails.MobilePhone, personDetails.IsMessagingEnabled, null, rockContext); } } else { person = CreateNewPerson(personDetails.FirstName, personDetails.LastName, personDetails.Email, personDetails.MobilePhone, personDetails.IsMessagingEnabled); PersonService.SaveNewPerson(person, rockContext, null, false); } return(AddPersonToGroup(person, group, rockContext)); }
/// <summary> /// Gets the person details. /// </summary> /// <param name="person">The person.</param> /// <returns>The person details data.</returns> private PersonDetail GetPersonDetails(Person person) { var personDetails = new PersonDetail { FirstName = person.FirstName, LastName = person.LastName, Email = person.Email, }; var phone = person.GetPhoneNumber(Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE.AsGuid()); if (phone != null) { personDetails.MobilePhone = phone.NumberFormatted; personDetails.IsMessagingEnabled = phone.IsMessagingEnabled; } return(personDetails); }
public IOutData SavePerson(IInData input) { string message = ""; try{ PersonDetail personDetail = ((PersonDetail)input); Console.Clear(); message = personDetail.name + " is added in database successfully"; var personId = this._VansawaliContext.Person.Max(pd => pd.PersonId) + 1; this._VansawaliContext.Person.Add(new Person { PersonId = personId, Name = personDetail.name, ParentId = personDetail.parentId, VillageId = personDetail.villageId, RelationId = personDetail.relationId, Gender = personDetail.sex == 1?true:false, ShortDesc = personDetail.shortDesc, //public string imageString; DateOfBirth = personDetail.dateOfBirth, MarriageDate = personDetail.marriageDate, LiveTill = personDetail.liveTill, IsValid = true }); if (!string.IsNullOrEmpty(personDetail.imageString)) { string filename = saveImageInFolder(personDetail.imageString); this._VansawaliContext.PersonImage.Add( new PersonImage { PersonId = personId, ImageUrl = filename }); } this._VansawaliContext.SaveChanges(); }catch (Exception ex) { message = ex.Message; throw new Exception("Exception", ex); } return(new Output { Message = message }); }
public static bool DeleteData(PersonDetail data) { using (IDbConnection dbConnection = DBConnection.Connection) { dbConnection.Open(); using (var tran = dbConnection.BeginTransaction()) { try { DapperExtensions.DapperExtensions.SetMappingAssemblies(new[] { typeof(PersonDetail).Assembly }); dbConnection.Delete(data, tran); tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); return(false); } } } }
public void ConvertNumtoAlphaTest() { Mock <IConvertAmount> convertAmtObj = new Mock <IConvertAmount>(); PersonDetail personDetails = new PersonDetail(); personDetails.Name = "Hemant"; personDetails.Amount = "123"; PersonDetail personDetailsMock = new PersonDetail() { Name = "Hemant", Amount = "one hundred and twenty three dollar" }; convertAmtObj.Setup(x => x.ConvertAmountToAplha(personDetails)).Returns(personDetailsMock); ConversionController conversionControllerObj = new ConversionController(convertAmtObj.Object); var result = conversionControllerObj.ConvertNumtoAlpha(personDetails) as JsonResult; Assert.AreEqual(200, GetVal <int>(result, "StatusCode")); Assert.AreEqual("Hemant", GetVal <PersonDetail>(result, "outPut").Name); Assert.AreEqual("one hundred and twenty three dollar", GetVal <PersonDetail>(result, "outPut").Amount); }
private static Uri SavePerson(CompetitionDetail competition, PersonDetail selectedPerson) { Uri newOfficialUri = null; do { Console.Write("Enter adjudicator char or [nothing] for Chairman: "); string adjudicatorChar = Console.ReadLine(); OfficialDetail official = new OfficialDetail() { CompetitionId = competition.Id, Min = selectedPerson.Min }; if (adjudicatorChar == string.Empty || adjudicatorChar.Contains("nothing")) { official.Task = "Chairman"; } else { official.Task = "Adjudicator"; official.AdjudicatorChar = adjudicatorChar; } try { newOfficialUri = apiClient.SaveOfficial(official); } catch (ApiException ex) { Console.WriteLine(ex.InnerException.Message); return(null); } } while (false); return(newOfficialUri); }
public JsonResult Search(string name) { List <PersonDetail> searchList = new List <PersonDetail>(); var userid = Convert.ToString(Session["UserId"]); var result = obj.GetSearchList(name); var followingList = obj.GetAllFollowing(userid); foreach (var item in result) { PersonDetail obj = new PersonDetail(); obj.Name = item.FullName; obj.UserName = item.User_id; obj.IsFollowing = followingList.Count > 0 ? followingList.Any(x => x.Following_id == item.User_id) : false; obj.IsSelfUser = item.User_id == userid ? true :false; searchList.Add(obj); } return(Json(searchList, JsonRequestBehavior.AllowGet)); }
public void CopyFrom_SubEntityCollClone() { var pf = new PersonDetail { History = new WorkHistoryCollection { new WorkHistory { Name = "Blah" } } }; var pt = new PersonDetail { History = new WorkHistoryCollection { new WorkHistory { Name = "Blah" } } }; pf.AcceptChanges(); pt.AcceptChanges(); pt.CopyFrom(pf); Assert.IsTrue(pt.IsChanged); // Collections always cloned - therefore changed. Assert.AreNotSame(pf.History, pt.History); }
protected override void OnSetUp() { using (var session = OpenSession()) using (var tx = session.BeginTransaction()) { var person1 = new Person { FirstName = "Jack" }; _person1Id = (int)session.Save(person1); var person2 = new Person { FirstName = "Robert" }; _person2Id = (int)session.Save(person2); var personDetail = new PersonDetail { LastName = "Smith", Person = person1 }; _personDetailId = (int)session.Save(personDetail); tx.Commit(); } }
public void Insert_single_and_multiple_with_generic_repository_and_rule_success() { var genericPerson = new MongoRepositoryBase <Person, TestConnection, PersonMapper>(); Person person = new Person("ferhat", "candas", DateTime.Now.AddYears(-15), 2000.52); List <PersonAddress> personAddresses = new List <PersonAddress>() { new PersonAddress("Fatih mah", "a", "Istanbul"), new PersonAddress("Kıvanc mah", "b", "Izmir"), new PersonAddress("Kemaliye mah", "c", "Trabzon"), }; var personDetail = new PersonDetail("*****@*****.**", "905379106194"); person.Addresses = personAddresses; person.PersonDetail = personDetail; genericPerson.Insert(person, x => x.Name == "test" || x.Name == "test2"); var personData = genericPerson.First(x => x.Id == person.Id, x => x.Name == "test" || x.Name == "test2"); personData.Name.Should().Be(person.Name); personData.Surname.Should().Be(person.Surname); personData.BirthDate.ToString("dd MM yyyy HH:mm:ss").Should().Be(person.BirthDate.ToString("dd MM yyyy HH:mm:ss")); personData.Salary.Should().Be(person.Salary); personData.Id.Should().Be(person.PersonDetail.PersonId); personData.PersonDetail.PersonId.Should().Be(person.PersonDetail.PersonId); personData.PersonDetail.Phone.Should().Be(person.PersonDetail.Phone); personData.PersonDetail.Email.Should().Be(person.PersonDetail.Email); personData.Addresses.ForEach(x => { x.PersonId.Should().Be(person.Id); }); }
public void CopyFrom_SubEntityCopy() { var pf = new PersonDetail { Address = new Address { City = "Bardon" } }; var pt = new PersonDetail { Address = new Address { City = "Bardon" } }; pf.AcceptChanges(); pt.AcceptChanges(); pt.CopyFrom(pf); Assert.IsFalse(pt.IsChanged); Assert.AreNotSame(pf.Address, pt.Address); // Should result in a copyfrom. pf.Address = new Address { City = "Ashgrove" }; pt.CopyFrom(pf); Assert.IsTrue(pt.IsChanged); Assert.AreNotSame(pf.Address, pt.Address); Assert.AreEqual("Ashgrove", pt.Address.City); // Should result in a clone. pt.Address = null; pf.AcceptChanges(); pt.AcceptChanges(); pt.CopyFrom(pf); Assert.IsTrue(pt.IsChanged); Assert.AreNotSame(pf.Address, pt.Address); Assert.AreEqual("Ashgrove", pt.Address.City); }
private static PersonDetail ChoosePerson() { // pick one person PersonDetail selectedPerson = null; do { Console.Write("Enter person MIN: "); string min = Console.ReadLine(); try { selectedPerson = apiClient.GetPerson(int.Parse(min)); } catch (ApiException ex) { Console.WriteLine(ex.InnerException.Message); } } while (selectedPerson == null); Console.WriteLine(); return(selectedPerson); }
public async Task <IActionResult> GetPersonDetail([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var personDetail = await _context.PersonDetails.FindAsync(id); if (personDetail == null) { return(NotFound()); } var pd = new PersonDetail() { Id = personDetail.PersonId, FirstName = personDetail.FirstName, LastName = personDetail.LastName, PhoneNumbers = (from pn in personDetail.PhoneDetails select pn.PhoneNumber).ToList() }; return(Ok(pd)); }
public webobj.PersonDetail getPerson(string personId) { PersonDetail personDetail = null; webobj.PersonDetail webPersonDetail = null; DataAccess dataAccess = new DataAccess(); List <PersonDetail> persons = dataAccess.retrievePersonDetail(personId); if (persons != null && persons.Count > 0) { personDetail = persons.FirstOrDefault(); webPersonDetail = new webobj.PersonDetail(); webPersonDetail.PersonId = personDetail.getPersonId(); webPersonDetail.FirstName = personDetail.getFirstName(); webPersonDetail.LastName = personDetail.getLastName(); webPersonDetail.MiddleName = personDetail.getMiddleName(); webPersonDetail.Prefix = personDetail.getPrefix(); webPersonDetail.Suffix = personDetail.getSuffix(); webPersonDetail.LastName = personDetail.getLastName(); webPersonDetail.DateOfBirth = personDetail.getDOB(); webPersonDetail.DateOfBirthText = personDetail.getDOBText(); webPersonDetail.StreetAddress = personDetail.getStreetAddress(); webPersonDetail.City = personDetail.getCity(); webPersonDetail.State = personDetail.getState(); webPersonDetail.PostalCode = personDetail.getPostalCode(); webPersonDetail.Country = personDetail.getCountry(); webPersonDetail.Profession = personDetail.getProfession(); webPersonDetail.FatherName = personDetail.getFatherName(); webPersonDetail.CellNbr = personDetail.getCellNbr(); webPersonDetail.HomePhoneNbr = personDetail.getHomePhoneNbr(); webPersonDetail.WorkPhoneNbr = personDetail.getWorkPhoneNbr(); webPersonDetail.Email = personDetail.getEmail(); webPersonDetail.PassportPhoto = personDetail.getPassportPhoto() != null?Converter.ImageToBase64(personDetail.getPassportPhoto(), System.Drawing.Imaging.ImageFormat.Bmp) : ""; } return(webPersonDetail); }
/// <summary> /// Create a new PersonDetail object. /// </summary> /// <param name="personID">Initial value of PersonID.</param> /// <param name="personCategory">Initial value of PersonCategory.</param> public static PersonDetail CreatePersonDetail(int personID, short personCategory) { PersonDetail personDetail = new PersonDetail(); personDetail.PersonID = personID; personDetail.PersonCategory = personCategory; return personDetail; }
public IActionResult UpdateDetail([FromBody] PersonDetail value, Guid id) { return(new WebApiPut <PersonDetail>(this, () => Factory.Create <IPersonManager>().UpdateDetailAsync(WebApiActionBase.Value(value), id), operationType: OperationType.Update, statusCode: HttpStatusCode.OK, alternateStatusCode: null)); }
/// <summary> /// There are no comments for PersonDetailSet in the schema. /// </summary> public void AddToPersonDetailSet(PersonDetail personDetail) { base.AddObject("PersonDetailSet", personDetail); }
public void addAwardTitleEntry(GameDate date, Person p, PersonDetail.Title title) { this.addPersonInGameBiography(p, date, String.Format(yearTableStrings["awardTitle_p"], title.Name)); }
public static void generatePersonDetailReport(User user, string personId) { List <PersonDetail> personDetailList = new DataAccess().retrievePersonDetail(personId); Console.WriteLine("# of Persons found = " + personDetailList.Count()); PersonDetail personDetail = personDetailList.FirstOrDefault(); //Paragraph Title Font iTextSharp.text.Font paragraphTitleFont = FontFactory.GetFont("Arial", 16); iTextSharp.text.Font paragraphSubTitleFont = FontFactory.GetFont("Arial", 14); Document doc = new Document(iTextSharp.text.PageSize.LETTER, 30, 30, 42, 35); string datetimePref = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); string pdfPath = ConfigurationManager.AppSettings["PersonReportPath"] + "-" + datetimePref + ".pdf"; PdfWriter pdfWriter = PdfWriter.GetInstance(doc, new FileStream(pdfPath, FileMode.Create)); //Event for Watermark PdfWriterEvents writerEvent = new PdfWriterEvents(ConfigurationManager.AppSettings["WatermarkConfidential"]); pdfWriter.PageEvent = writerEvent; //Event for Page number PageEventHelper pageEventHelper = new PageEventHelper(); pdfWriter.PageEvent = pageEventHelper; doc.Open(); //add title doc.AddTitle("Person Detail Report"); doc.AddHeader("Person Detail Report", "Person Detail Report"); //Add Company Logo & Company Name PdfPTable logoAndTitle = new PdfPTable(2); float[] cellWidths = new float[] { 100f, 100f }; logoAndTitle.SetWidths(cellWidths); iTextSharp.text.Image iTextCompanyLogoImage = null; if (AFISMain.clientSetup != null) { if (AFISMain.clientSetup.CompanyLogo != null) { iTextCompanyLogoImage = iTextSharp.text.Image.GetInstance(AFISMain.clientSetup.CompanyLogo, System.Drawing.Imaging.ImageFormat.Bmp); iTextCompanyLogoImage.ScaleAbsolute(60f, 60f); } } else { //Default image in case, image is not available iTextCompanyLogoImage = iTextSharp.text.Image.GetInstance(ConfigurationManager.AppSettings["DefaultCompanyLogo"]); } logoAndTitle.AddCell(new PdfPCell(iTextCompanyLogoImage)); string titleStr = AFISMain.clientSetup.LegalName + "\n" + AFISMain.clientSetup.AddressLine + "\n" + AFISMain.clientSetup.City + ", " + AFISMain.clientSetup.State + " " + AFISMain.clientSetup.PostalCode + "\n" + AFISMain.clientSetup.Country + "\n"; logoAndTitle.AddCell(new PdfPCell(new Phrase(titleStr, paragraphTitleFont))); doc.Add(logoAndTitle); iTextSharp.text.Font contentFont = iTextSharp.text.FontFactory.GetFont("Webdings", 20, iTextSharp.text.Font.BOLD); Paragraph paragraphReportTitle = new Paragraph("Person Detail Report\n", contentFont); paragraphReportTitle.Alignment = Element.ALIGN_CENTER; Paragraph paragraphReportSubTitle = new Paragraph(); paragraphReportSubTitle.Add("By: " + user.getFirstName() + " " + user.getLastName() + ", ID: " + user.getPersonId() + "\n"); paragraphReportSubTitle.Add("At: " + DateTime.Now.ToString() + "\n"); paragraphReportSubTitle.Alignment = Element.ALIGN_CENTER; doc.Add(paragraphReportTitle); doc.Add(paragraphReportSubTitle); if (personDetail != null) { //Adding the Passport size photo System.Drawing.Image passportPhoto = personDetail.getPassportPhoto(); if (passportPhoto != null) { iTextSharp.text.Image passportPic = iTextSharp.text.Image.GetInstance(passportPhoto, System.Drawing.Imaging.ImageFormat.Bmp); passportPic.ScaleAbsolute(120f, 120f); doc.Add(passportPic); } //Adding the person detail Paragraph paragraphDemographyTitle = new Paragraph("Demographic Information:\n", paragraphTitleFont); doc.Add(paragraphDemographyTitle); Paragraph paragraphDemographyDetail = new Paragraph(); paragraphDemographyDetail.Add("ID: " + personDetail.getPersonId() + "\n"); paragraphDemographyDetail.Add("Name: " + " " + personDetail.getPrefix() + " " + personDetail.getFirstName() + " " + personDetail.getMiddleName() + " " + personDetail.getLastName() + " " + personDetail.getSuffix() + "\n"); paragraphDemographyDetail.Add("Date of Birth (DOB): " + ((DateTime)personDetail.getDOB()).ToString("yyyy-MM-dd") + "\n"); paragraphDemographyDetail.Add("Father's Name: " + personDetail.getFatherName() + "\n"); paragraphDemographyDetail.Add("Address: " + personDetail.getStreetAddress() + ", " + personDetail.getCity() + ", " + personDetail.getState() + " " + personDetail.getPostalCode() + ", " + personDetail.getCountry() + "\n"); paragraphDemographyDetail.Add("Profession: " + personDetail.getProfession() + "\n"); paragraphDemographyDetail.Add("Cell#: " + personDetail.getCellNbr() + ", Home Phone#: " + personDetail.getHomePhoneNbr() + ", Work Phone#: " + personDetail.getWorkPhoneNbr() + "\n"); paragraphDemographyDetail.Add("Email: " + personDetail.getEmail() + "\n\n"); doc.Add(paragraphDemographyDetail); } //Adding Person's Physical Characteristocs DataAccess dataAccess = new DataAccess(); PersonPhysicalChar personPhysicalChar = dataAccess.retrievePersonPhysicalCharacteristics(personId); if (personPhysicalChar != null) { Paragraph paragraphPhysicalCharTitle = new Paragraph("Physical Characteristics:\n", paragraphTitleFont); doc.Add(paragraphPhysicalCharTitle); Paragraph paragraphPhysicalChar = new Paragraph(); paragraphPhysicalChar.Add("Height: " + personPhysicalChar.Height + ", Weight: " + personPhysicalChar.Weight + ", Eye Color: " + personPhysicalChar.EyeColor); paragraphPhysicalChar.Add(", Hair Color: " + personPhysicalChar.HairColor + "\n"); paragraphPhysicalChar.Add("Complexion: " + personPhysicalChar.Complexion + ", Build Type: " + personPhysicalChar.BuildType); paragraphPhysicalChar.Add(", Birth Mark: " + personPhysicalChar.BirthMark + ", Other Identifiable Mark: " + personPhysicalChar.IdMark + "\n"); string dod = personPhysicalChar.DOD.ToString("yyyy") == "9998" ? "N/A" : personPhysicalChar.DOD.ToString("yyyy-MM-dd"); paragraphPhysicalChar.Add("Gender: " + personPhysicalChar.Gender + ", Date Of Death: " + dod + "\n\n"); doc.Add(paragraphPhysicalChar); } //Adding Person's Criminal records List <CriminalRecord> criminalRecs = dataAccess.getCriminalRecords(personId); Console.WriteLine("###-->> # of Criminal recotds = " + criminalRecs.Count); if (criminalRecs.Count > 0) { Paragraph paragraphCriminalRecs = new Paragraph("Criminal Records:\n", paragraphTitleFont); doc.Add(paragraphCriminalRecs); foreach (CriminalRecord criminalRec in criminalRecs) { Paragraph paragraphCriminalRecCaseId = new Paragraph("Case ID - " + criminalRec.CaseId + ":", paragraphSubTitleFont); doc.Add(paragraphCriminalRecCaseId); Paragraph paragraphCriminalRec = new Paragraph(); string crimeDate = criminalRec.CrimeDate.ToString("yyyy") == "9998" ? "N/A" : criminalRec.CrimeDate.ToString("yyyy-MM-dd"); string arrestDate = criminalRec.ArrestDate.ToString("yyyy") == "9998" ? "N/A" : criminalRec.ArrestDate.ToString("yyyy-MM-dd"); string sentenceDate = criminalRec.SentencedDate.ToString("yyyy") == "9998" ? "N/A" : criminalRec.SentencedDate.ToString("yyyy-MM-dd"); string releaseDate = criminalRec.ReleaseDate.ToString("yyyy") == "9998" ? "N/A" : criminalRec.ReleaseDate.ToString("yyyy-MM-dd"); string paroleDate = criminalRec.ParoleDate.ToString("yyyy") == "9998" ? "N/A" : criminalRec.ParoleDate.ToString("yyyy-MM-dd"); paragraphCriminalRec.Add("Crime Date: " + crimeDate + ", Crime Location: " + criminalRec.CrimeLocation + "\n"); paragraphCriminalRec.Add("Court: " + criminalRec.Court + ", Court Address: " + criminalRec.CourtAddress + ", Statute: " + criminalRec.Statute + "\n"); paragraphCriminalRec.Add("Arret Date: " + arrestDate + ", Arrest Agency: " + criminalRec.ArrestAgency + "\n"); paragraphCriminalRec.Add("Sentence Date: " + sentenceDate + ", Release Date: " + releaseDate + ", Parole date: " + paroleDate + "\n"); paragraphCriminalRec.Add("Criminal Alert Level: " + criminalRec.CriminalAlertLevel + ", Criminal Alert Message: " + criminalRec.CriminalAlertMsg + "\n"); paragraphCriminalRec.Add("Crime Detail: " + criminalRec.CrimeDetail + "\n"); doc.Add(paragraphCriminalRec); } Paragraph paragraphNewLine = new Paragraph(); paragraphNewLine.Add("\n"); doc.Add(paragraphNewLine); } //add table for fingerprints Paragraph paragraphFingerprints = new Paragraph("Fingerprint(s):\n\n", paragraphTitleFont); doc.Add(paragraphFingerprints); PdfPTable fingerprintsTable = new PdfPTable(5); float[] widths = new float[] { 40f, 40f, 40f, 40f, 40f }; fingerprintsTable.SetWidths(widths); //Add Headers to the table fingerprintsTable.AddCell(new PdfPCell(new Phrase("RT"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("RI"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("RM"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("RR"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("RL"))); PdfPCell imageRTCell = null; PdfPCell imageRICell = null; PdfPCell imageRMCell = null; PdfPCell imageRRCell = null; PdfPCell imageRLCell = null; PdfPCell imageLTCell = null; PdfPCell imageLICell = null; PdfPCell imageLMCell = null; PdfPCell imageLRCell = null; PdfPCell imageLLCell = null; //Default image in case, image is not available iTextSharp.text.Image iTextDefaultFpImage = iTextSharp.text.Image.GetInstance(ConfigurationManager.AppSettings["DefaultFpImagePath"]); List <MyPerson> persons = new DataAccess().retrievePersonFingerprintsById(personId); Console.WriteLine("####-->> # of persons retrived = " + persons.Count); if (persons.Count > 0) { MyPerson person = persons.FirstOrDefault(); //Get all the fingerprints of the matched person List <Fingerprint> fps = person.Fingerprints; Console.WriteLine("###-->> # of Fps retrived = " + fps.Count); for (int i = 0; i < fps.Count; i++) { MyFingerprint fp = (MyFingerprint)fps.ElementAt(i); if (fp.Fingername != null) { if (fp.Fingername.Equals(MyFingerprint.RightThumb)) { System.Drawing.Image imageRT = fp.AsBitmap; if (imageRT != null) { Console.WriteLine("###-->> RT"); iTextSharp.text.Image iTextImgRT = iTextSharp.text.Image.GetInstance(imageRT, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgRT.ScaleAbsolute(60f, 60f); imageRTCell = new PdfPCell(iTextImgRT); imageRTCell.HorizontalAlignment = Element.ALIGN_CENTER; imageRTCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.RightIndex)) { System.Drawing.Image imageRI = fp.AsBitmap; if (imageRI != null) { Console.WriteLine("###-->> RI"); iTextSharp.text.Image iTextImgRI = iTextSharp.text.Image.GetInstance(imageRI, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgRI.ScaleAbsolute(60f, 60f); imageRICell = new PdfPCell(iTextImgRI); imageRICell.HorizontalAlignment = Element.ALIGN_CENTER; imageRICell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.RightMiddle)) { System.Drawing.Image imageRM = fp.AsBitmap; if (imageRM != null) { Console.WriteLine("###-->> RM"); iTextSharp.text.Image iTextImgRM = iTextSharp.text.Image.GetInstance(imageRM, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgRM.ScaleAbsolute(60f, 60f); imageRMCell = new PdfPCell(iTextImgRM); imageRMCell.HorizontalAlignment = Element.ALIGN_CENTER; imageRMCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.RightRing)) { System.Drawing.Image imageRR = fp.AsBitmap; if (imageRR != null) { Console.WriteLine("###-->> RR"); iTextSharp.text.Image iTextImgRR = iTextSharp.text.Image.GetInstance(imageRR, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgRR.ScaleAbsolute(60f, 60f); imageRRCell = new PdfPCell(iTextImgRR); imageRRCell.HorizontalAlignment = Element.ALIGN_CENTER; imageRRCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.RightLittle)) { System.Drawing.Image imageRL = fp.AsBitmap; if (imageRL != null) { Console.WriteLine("###-->> RL"); iTextSharp.text.Image iTextImgRL = iTextSharp.text.Image.GetInstance(imageRL, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgRL.ScaleAbsolute(60f, 60f); imageRLCell = new PdfPCell(iTextImgRL); imageRLCell.HorizontalAlignment = Element.ALIGN_CENTER; imageRLCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.LeftThumb)) { System.Drawing.Image imageLT = fp.AsBitmap; if (imageLT != null) { Console.WriteLine("###-->> LT"); iTextSharp.text.Image iTextImgLT = iTextSharp.text.Image.GetInstance(imageLT, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgLT.ScaleAbsolute(60f, 60f); imageLTCell = new PdfPCell(iTextImgLT); imageLTCell.HorizontalAlignment = Element.ALIGN_CENTER; imageLTCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.LeftIndex)) { System.Drawing.Image imageLI = fp.AsBitmap; if (imageLI != null) { Console.WriteLine("###-->> LI"); iTextSharp.text.Image iTextImgLI = iTextSharp.text.Image.GetInstance(imageLI, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgLI.ScaleAbsolute(60f, 60f); imageLICell = new PdfPCell(iTextImgLI); imageLICell.HorizontalAlignment = Element.ALIGN_CENTER; imageLICell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.LeftMiddle)) { System.Drawing.Image imageLM = fp.AsBitmap; if (imageLM != null) { Console.WriteLine("###-->> LM"); iTextSharp.text.Image iTextImgLM = iTextSharp.text.Image.GetInstance(imageLM, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgLM.ScaleAbsolute(60f, 60f); imageLMCell = new PdfPCell(iTextImgLM); imageLMCell.HorizontalAlignment = Element.ALIGN_CENTER; imageLMCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.LeftRing)) { System.Drawing.Image imageLR = fp.AsBitmap; if (imageLR != null) { Console.WriteLine("###-->> LR"); iTextSharp.text.Image iTextImgLR = iTextSharp.text.Image.GetInstance(imageLR, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgLR.ScaleAbsolute(60f, 60f); imageLRCell = new PdfPCell(iTextImgLR); imageLRCell.HorizontalAlignment = Element.ALIGN_CENTER; imageLRCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } else if (fp.Fingername.Equals(MyFingerprint.LeftLittle)) { System.Drawing.Image imageLL = fp.AsBitmap; if (imageLL != null) { Console.WriteLine("###-->> LL"); iTextSharp.text.Image iTextImgLL = iTextSharp.text.Image.GetInstance(imageLL, System.Drawing.Imaging.ImageFormat.Bmp); iTextImgLL.ScaleAbsolute(60f, 60f); imageLLCell = new PdfPCell(iTextImgLL); imageLLCell.HorizontalAlignment = Element.ALIGN_CENTER; imageLLCell.VerticalAlignment = Element.ALIGN_MIDDLE; } } } } //add the Right-Hand fingerprints if (imageRTCell != null) { fingerprintsTable.AddCell(imageRTCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageRICell != null) { fingerprintsTable.AddCell(imageRICell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageRMCell != null) { fingerprintsTable.AddCell(imageRMCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageRRCell != null) { fingerprintsTable.AddCell(imageRRCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageRLCell != null) { fingerprintsTable.AddCell(imageRLCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } //add 2nd row on the table fingerprintsTable.AddCell(new PdfPCell(new Phrase("LT"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("LI"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("LM"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("LR"))); fingerprintsTable.AddCell(new PdfPCell(new Phrase("LL"))); //add the Left-Hand fingerprints if (imageLTCell != null) { fingerprintsTable.AddCell(imageLTCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageLICell != null) { fingerprintsTable.AddCell(imageLICell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageLMCell != null) { fingerprintsTable.AddCell(imageLMCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageLRCell != null) { fingerprintsTable.AddCell(imageLRCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } if (imageLLCell != null) { fingerprintsTable.AddCell(imageLLCell); } else { fingerprintsTable.AddCell(new PdfPCell(iTextDefaultFpImage, true)); } }//end-if - persons //add Table for fingerprints doc.Add(fingerprintsTable); doc.Close(); Console.WriteLine("PDF Generated successfully..."); System.Diagnostics.Process.Start(pdfPath); }//end generatePersonDetailReport
protected void set_person_details_widgets () { person.Refresh(); if (person.PersonDetails == null ||person.PersonDetails.Count == 0) { person_details = new PersonDetail (); } else { person_details = (PersonDetail)person.PersonDetails[0]; } number_of_sons.Active = person_details.NumberOfSons; scholarity_level.Active = person_details.ScholarityLevel; most_recent_job.Active = person_details.MostRecentJob; is_spanish_speaker.Activate = person_details.Id < 1 ? true : person_details.IsSpanishSpeaker; indigenous_group.Active = person_details.IndigenousGroup; }
protected void person_detail_save () { if (person_details == null) { person_details = new PersonDetail(); } person_details.NumberOfSons = number_of_sons.Active; person_details.ScholarityLevel = scholarity_level.Active as ScholarityLevel; //person_details.Religion = religion.Active as Religion; // person_details.EthnicGroup = ethnic_group.Active as EthnicGroup; person_details.MostRecentJob = most_recent_job.Active as Job; //person_details.IndigenousGroup = indigenous_group.Text; person_details.IndigenousGroup = indigenous_group.Active as IndigenousGroup; person_details.IsSpanishSpeaker = is_spanish_speaker.Value (); person_details.Person = person; if (person_details.IsValid()) { person_details.SaveAndFlush (); } else { Console.WriteLine( String.Join(",", person_details.ValidationErrorMessages) ); new ValidationErrorsDialog (person_details.PropertiesValidationErrorMessages, (Gtk.Window)this.Toplevel); } }