private Report AddedTransactions(FamilyInfo familyInfo) { // Generate the transaction id for cash transactions var existingTransactionsPerDay = entityContext.reportInfo.Where(x => x.Date.Day == DateTime.Today.Day).ToList().Count; var prefixCount = existingTransactionsPerDay <= 0 ? 1 : existingTransactionsPerDay + 1; var transactionId = DateTime.Now.Date.ToString("yyyyMMdd") + "-" + prefixCount; var report = new Report(); if (!string.IsNullOrEmpty(familyInfo.Donation) && !string.IsNullOrWhiteSpace(familyInfo.Donation)) { report = new Report() { Name = $"{familyInfo.FirstName} {familyInfo.LastName}", FromEmailAddress = familyInfo.Email, Net = $"${familyInfo.Donation}", PhoneNo = familyInfo.MobileNo, Date = familyInfo.CreateDate, Time = familyInfo.CreateDate.ToString(Constants.HourFormat), Description = $"SystemDonation", // Plan to LoginUser Reason = familyInfo.DonationReason, TransactionGuid = Guid.NewGuid(), ReferenceTxnID = familyInfo.PrimaryId.ToString().Replace("-", ""), TransactionID = transactionId, UploadDateTime = familyInfo.CreateDate, TypeOfReport = Constants.SystemDonation, CurrencyType = "Cash" }; } return(report); }
public void FamilyInfoTest() { var parentFamilyStatus = ParentFamilyStatus.Full; var motherRelativeStatus = RelativeStatus.Mother; var motherFullName = new FullName("Евдокимова", "Евгения", "Вадимовна"); var motherBirthInfo = new BirthInfo(new DateTime(1980, 1, 1), "г. Барнаул"); var motherPersonInfo = new PersonInfo(motherFullName, motherBirthInfo); var motherWorkPlace = "Магазин игрушек"; var motherInfo = new RelativeInfo(motherRelativeStatus, motherPersonInfo, motherWorkPlace); var fatherRelativeStatus = RelativeStatus.Father; var fatherFullName = new FullName("Евдокимов", "Евгений", "Сергеевич"); var fatherBirthInfo = new BirthInfo(new DateTime(1981, 1, 1), "г. Барнаул"); var fatherPersonInfo = new PersonInfo(fatherFullName, fatherBirthInfo); var fatherWorkPlace = "Завод"; var fatherInfo = new RelativeInfo(fatherRelativeStatus, fatherPersonInfo, fatherWorkPlace); var relatives = new List <RelativeInfo>() { motherInfo, fatherInfo }; var familyInfo = new FamilyInfo(parentFamilyStatus, relatives); Assert.AreEqual(parentFamilyStatus, familyInfo.ParentFamilyStatus); Assert.AreEqual(motherInfo, familyInfo.GetRelative(0)); Assert.AreEqual(fatherInfo, familyInfo.GetRelative(1)); }
private FamilyInfoEntity ToEntity(FamilyInfo familyInfo) { return(new FamilyInfoEntity() { Id = familyInfo.Id, EntityId = new MongoDB.Bson.ObjectId($"{familyInfo.Id}:{familyInfo.VersionId}"), Name = familyInfo.Name, FileBlobId = familyInfo.FileBlobId, Parameters = ToJsonString(familyInfo.Parameters), UserId = familyInfo.UserId, VersionId = familyInfo.VersionId }); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document doc = commandData.Application.ActiveUIDocument.Document; System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); dialog.Filter = "Revit family (*.rfa)|*.rfa|All files (*.*)|*.*"; dialog.Multiselect = false; if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return(Result.Cancelled); } string filePath = dialog.FileName; string folder = System.IO.Path.GetDirectoryName(filePath); string filenameWithoutEx = System.IO.Path.GetFileNameWithoutExtension(filePath); string xmlFile = System.IO.Path.Combine(folder, filenameWithoutEx + ".xml"); Document familyDoc = commandData.Application.Application.OpenDocumentFile(filePath); FamilyInfo fi = new FamilyInfo(familyDoc); System.Xml.Serialization.XmlSerializer xmls = new System.Xml.Serialization.XmlSerializer(typeof(FamilyInfo)); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(xmlFile)) { xmls.Serialize(writer, fi); } TaskDialog.Show("CommandGetFamilyXml", "Успешно обработано! \n" + xmlFile); familyDoc.Close(false); return(Result.Succeeded); }
public async Task <ActionResult> DeleteConfirmed(int id) { FamilyInfo familyInfo = await db.FamilyInfo.FindAsync(id); db.FamilyInfo.Remove(familyInfo); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public int EditMotherDetails(FamilyInfo familyInfo) { using (UnitOfWork unitOfWork = new UnitOfWork(new PsmartContext())) { unitOfWork.FamilyInfoRepository.Update(familyInfo); _results = unitOfWork.Complete(); unitOfWork.Dispose(); return(_results); } }
public async Task <ActionResult> Edit([Bind(Include = "FamilyInfoId,CriminalRecord,Residence,Work,Photo")] FamilyInfo familyInfo) { if (ModelState.IsValid) { db.Entry(familyInfo).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(familyInfo)); }
public async Task <ActionResult> Create([Bind(Include = "FamilyInfoId,CriminalRecord,Residence,Work,Photo")] FamilyInfo familyInfo) { if (ModelState.IsValid) { db.FamilyInfo.Add(familyInfo); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(familyInfo)); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Application app = commandData.Application.Application; string famFilePath1 = FilesWorker.GetFamilyFileByUser("Главное семейство"); if (string.IsNullOrEmpty(famFilePath1)) { return(Result.Cancelled); } Document famdoc1 = app.OpenDocumentFile(famFilePath1); string famFilePath2 = FilesWorker.GetFamilyFileByUser("Семейство для сравнения"); if (string.IsNullOrEmpty(famFilePath2)) { return(Result.Cancelled); } Document famdoc2 = app.OpenDocumentFile(famFilePath2); //try to fix ids shift through a new blank document //FamilyInfo fi1 = GetFamInfoByBlankProjectDocument(famFilePath1, app); //FamilyInfo fi2 = GetFamInfoByBlankProjectDocument(famFilePath2, app); FamilyInfo fi1 = new FamilyInfo(famdoc1); FamilyInfo fi2 = new FamilyInfo(famdoc2); fi2.ApplyIdOffset(fi1); //first time I think that all ids moves to constant distance... naive me //int idOffset = famdoc2.OwnerFamily.Id.IntegerValue - famdoc1.OwnerFamily.Id.IntegerValue; //int idOffset = fi2.List_RefPlanes.First().Id - fi1.List_RefPlanes.First().Id; famdoc1.Close(false); famdoc2.Close(false); string xml1 = fi1.SerializeToXml(); string xml2 = fi2.SerializeToXml(); //the most interesting thing is doing in another solution, look at https://github.com/Tereami/XmlComparer string result = XmlComparer.Comparer.CompareXmls(xml1, xml2); FormResult form = new FormResult(result); form.ShowDialog(); return(Result.Succeeded); }
// GET: FamilyInfoes/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FamilyInfo familyInfo = await db.FamilyInfo.FindAsync(id); if (familyInfo == null) { return(HttpNotFound()); } return(View(familyInfo)); }
/// <summary> /// Adds a family of class names to be highlighted in a SHFB /// installation having the specified path. /// </summary> /// <param name="family">A string used to identify /// the class names.</param> /// <param name="names">The class names to highlight.</param> /// <param name="languages">The languages for which /// the class names need to be highlighted.</param> /// <param name="path"> /// The path of the SHFB installation to update. /// </param> /// <returns>A value equal to <c>0</c> for successful installations; nonzero otherwise.</returns> internal static int AddClassNamesFamily( string family, IEnumerable <string> names, IEnumerable <string> languages, string path) { FamilyInfo updateInfo = new FamilyInfo() { Family = family, Names = names, Languages = languages }; return(Shfb.Update(HighlightingTools.ClassNamesFamilyAdder, updateInfo, path)); }
public ActionResult Edit(Guid id, FamilyInfo collection) { try { // TODO: Add update logic here var familInfo = entityContext.familyInfos.FirstOrDefault(q => q.PrimaryId == id); familInfo.DependentDetails = entityContext.dependentInfos.Where(t => t.PrimaryId == collection.PrimaryId).ToList(); foreach (var dependent in familInfo.DependentDetails) { var changeDependent = collection.DependentDetails.FirstOrDefault(q => q.Id == dependent.Id); if (changeDependent != null) { dependent.DOB = changeDependent.DOB; dependent.Name = changeDependent.Name; dependent.RelationShip = changeDependent.RelationShip; } } familInfo.FirstName = collection.FirstName; familInfo.LastName = collection.LastName; familInfo.Address = collection.Address; familInfo.City = collection.City; familInfo.DateOfBirth = collection.DateOfBirth; familInfo.Email = collection.Email; familInfo.MaritalStatus = collection.MaritalStatus; familInfo.MarriageDate = collection.MarriageDate; familInfo.MobileNo = collection.MobileNo; familInfo.NoOfDependents = collection.NoOfDependents; familInfo.ZipCode = collection.ZipCode; familInfo.IsVolunteer = collection.IsVolunteer; entityContext.Entry(familInfo).State = System.Data.Entity.EntityState.Modified; entityContext.familyInfos.AddOrUpdate(familInfo); entityContext.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public void FamilyInfoGettingExceptionTest() { var parentFamilyStatus = ParentFamilyStatus.Full; var motherRelativeStatus = RelativeStatus.Mother; var motherFullName = new FullName("Евдокимова", "Евгения", "Вадимовна"); var motherBirthInfo = new BirthInfo(new DateTime(1980, 1, 1), "г. Барнаул"); var motherPersonInfo = new PersonInfo(motherFullName, motherBirthInfo); var motherWorkPlace = "Магазин игрушек"; var motherInfo = new RelativeInfo(motherRelativeStatus, motherPersonInfo, motherWorkPlace); var familyInfo = new FamilyInfo(parentFamilyStatus); familyInfo.AddRelative(motherInfo); Assert.IsNull(familyInfo.GetRelative(1)); }
private void SendFamilies(IEnumerable <DocumentDetail> documentDetailList) { if (!_jobParams.CreateFamilyGroups) { return; } FamiliesInfo familiesInfo = new FamiliesInfo(); foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (!String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = (String.IsNullOrEmpty(doc.document.EVLoadFileParentId) || doc.document.EVLoadFileParentId == "0") ? null : doc.document.EVLoadFileParentId; // Debug //Tracer.Warning("LawProcessingWorker.SendFamilies: DocId = {0}, OriginalDocumentId = {1}, OriginalParentId = {2}", // docReferenceId, familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } } SendFamilies(familiesInfo); }
public int AddMotherDetails(FamilyInfo familyInfo) { try { using (UnitOfWork unitOfWork = new UnitOfWork(new PsmartContext())) { unitOfWork.FamilyInfoRepository.Add(familyInfo); _results = unitOfWork.Complete(); unitOfWork.Dispose(); return(_results); } } catch (Exception e) { Console.WriteLine(e); throw; } }
/// <summary> /// Enumerates the file managers that encapsulates the /// updating logic required to add the specified family of class names /// for the specified path. /// </summary> /// <param name="info">The information about the family of class names.</param> /// <param name="path">The path of the SHFB installation to update.</param> /// <returns>The collection of file managers required for installation.</returns> static IEnumerable <FileManager> ClassNamesFamilyAdder( FamilyInfo info, string path) { List <FileManager> managers = new List <FileManager>(); FileManager highlightXml = new HighlightXmlFamilyAdder( Path.Combine(path, "PresentationStyles", "Colorizer", "highlight.xml"), info.Family, info.Names, info.Languages); managers.Add(highlightXml); return(managers); }
public Envelope(PassportInfo passportInfo, MilitaryInfo militaryInfo, CivilInfo civilInfo, Contacts contacts, FamilyInfo familyInfo, DriverInfo driverInfo = null) { if (passportInfo == null) { throw new ArgumentNullException(nameof(passportInfo)); } if (militaryInfo == null) { throw new ArgumentNullException(nameof(passportInfo)); } if (civilInfo == null) { throw new ArgumentNullException(nameof(passportInfo)); } if (contacts == null) { throw new ArgumentNullException(nameof(passportInfo)); } if (familyInfo == null) { throw new ArgumentNullException(nameof(passportInfo)); } PassportInfo = passportInfo; MilitaryInfo = militaryInfo; CivilInfo = civilInfo; Contacts = contacts; FamilyInfo = familyInfo; DriverInfo = driverInfo; }
private static void FillFamilyInfo(priz priz, FamilyInfo familyInfo) { priz.parents = familyInfo.ParentFamilyStatus.ToParentFamilyStatusString(); // I didn't want write this code, but db structure force me do it int curRelativeIdx = 0; RelativeInfo currentRelative = null; currentRelative = familyInfo.GetRelative(curRelativeIdx++); if (currentRelative != null) { priz.relation = currentRelative.RelativeStatus.ToRelativeStatusString(); priz.relative_name = currentRelative.PersonInfo.FullName.Value; priz.relative_birth_date = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat); priz.relative_birth_place = currentRelative.PersonInfo.BirthInfo.Place; priz.relative_work_place = currentRelative.WorkPlace; } currentRelative = familyInfo.GetRelative(curRelativeIdx++); if (currentRelative != null) { priz.relation2 = currentRelative.RelativeStatus.ToRelativeStatusString(); priz.relative_name2 = currentRelative.PersonInfo.FullName.Value; priz.relative_birth_date2 = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat); priz.relative_birth_place2 = currentRelative.PersonInfo.BirthInfo.Place; priz.relative_work_place2 = currentRelative.WorkPlace; } currentRelative = familyInfo.GetRelative(curRelativeIdx++); if (currentRelative != null) { priz.relation3 = currentRelative.RelativeStatus.ToRelativeStatusString(); priz.relative_name3 = currentRelative.PersonInfo.FullName.Value; priz.relative_birth_date3 = currentRelative.PersonInfo.BirthInfo.Date.ToString(DateConstants.RecruitDateFormat); priz.relative_birth_place3 = currentRelative.PersonInfo.BirthInfo.Place; priz.relative_work_place3 = currentRelative.WorkPlace; } }
private void ImportDocumentRelationship(string documentId, Document currentDcbDocument, FamiliesInfo familiesInfo) { // Debug //Tracer.Warning("DCB documentId = {0}", documentId); if (DcbOpticonJobBEO.FamilyRelations.IsEmailDCB) { if (null != currentDcbDocument.children && currentDcbDocument.children.Any()) { foreach (int physicalChildDocumentNumber in currentDcbDocument.children) { FamilyInfo familyInfoRecord1 = new FamilyInfo(null); familyInfoRecord1.OriginalDocumentId = GenerateDocumentIdForEV(physicalChildDocumentNumber.ToString(CultureInfo.InvariantCulture)); familyInfoRecord1.OriginalParentId = GenerateDocumentIdForEV(currentDcbDocument); familiesInfo.FamilyInfoList.Add(familyInfoRecord1); } } // We don't skip standalone documents for Families, because they always can appear to be topmost parents. // And also we need all of them to provide Original to Real Id translation. FamilyInfo familyInfoRecord2 = new FamilyInfo(documentId); familyInfoRecord2.OriginalDocumentId = GenerateDocumentIdForEV(currentDcbDocument.PhysicalNumber.ToString(CultureInfo.InvariantCulture)); familyInfoRecord2.OriginalParentId = null; familiesInfo.FamilyInfoList.Add(familyInfoRecord2); return; } /*One way of maintaining parent-child relationship in DCB is through PARENT_DOCID & DOCID fields * Most of the case it is assumed that PARENT_DOCID & DOCID will have UUID, but in CNClassic there is a * way to map DOCID and PARENT_DOCID field during import process * For Document realtion the first priority is given to PAREN_DOCID & DOCID field */ Field dcbDocIdField = currentDcbDocument.FieldItems.Find(o => o.Code.Equals(DcbOpticonJobBEO.FamilyRelations.DocId)); string dcbDocId = null; if (null != dcbDocIdField) { dcbDocId = ExtractDcbDocumentId(dcbDocIdField.Value, DcbOpticonJobBEO.FamilyRelations.IsDocIDFormatRange); } if (dcbDocId == null) { Tracer.Warning("Potentially bad DCB source data: document {0} has no DocId field", documentId); return; // No point in sending family record with the original document Id missing } Field dcbParentDocIdField = currentDcbDocument.FieldItems.Find(o => o.Code.Equals(DcbOpticonJobBEO.FamilyRelations.ParentDocId)); string dcbParentDocId = null; if (null != dcbParentDocIdField) { dcbParentDocId = ExtractDcbDocumentId(dcbParentDocIdField.Value, DcbOpticonJobBEO.FamilyRelations.IsParentDocIDFormatRange); } FamilyInfo familyInfo = new FamilyInfo(documentId); familyInfo.OriginalDocumentId = GenerateDocumentIdForEV(dcbDocId); familyInfo.OriginalParentId = GenerateDocumentIdForEV(dcbParentDocId); familiesInfo.FamilyInfoList.Add(familyInfo); //Tracer.Trace("Adding Relationship record. Parent = {0}, Child = {1}", threadingEntity.ParentDocumentID, threadingEntity.ChildDocumentID); }
public int EditMotherDetails(FamilyInfo familyInfo) { return(familyInfoManager.EditMotherDetails(familyInfo)); }
public int AddMotherDetails(FamilyInfo familyInfo) { return(familyInfoManager.AddMotherDetails(familyInfo)); }
public Person() { this.FamilyInfo = new FamilyInfo(); }
private void AddFamily(Row rr, FamilyInfo f) { var c = rr.Cells[0]; var img = ImageData.Image.ImageFromId(f.ImageId); if (img != null) { var ratio = img.Ratio(); using (var os = img.ResizeToStream("width=1000&height=1000&mode=max")) { var h = pa.PicHeightPixels; var w = h * ratio; var str = dd.AddImage(os); var pic = str.CreatePicture(h.ToInt(), w.ToInt()); c.Paragraphs[0].InsertPicture(pic); c.Paragraphs[0].Alignment = Alignment.center; } } c.InsertParagraph(); var p = c.InsertParagraph(f.Title, false, pa.namebold); p.Alignment = Alignment.center; var cc = f.Children().ToList(); c.InsertParagraph("", false, pa.font); var t2 = c.InsertTable(cc.Count + 2 + (f.Head2.HasValue() ? 1 : 0), 2); t2.Alignment = Alignment.center; t2.AutoFit = AutoFit.Contents; t2.Rows[0].Cells[1].Width = 0; var row = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(f.Head1, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(f.BirthDay, false, pa.font); if (f.Head2 != null) { row++; t2.Rows[0].Cells[1].Width = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(f.Head2, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(f.BirthDay2, false, pa.font); } foreach (var ch in cc) { row++; t2.Rows[0].Cells[1].Width = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(ch.Display, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(ch.BirthDay, false, pa.font); } row++; t2.Rows[row].MergeCells(0, 1); var cell = t2.Rows[row].Cells[0]; var pg = cell.Paragraphs[0]; var addr = f.FullAddress; if (addr.HasValue()) pg.InsertText("\n" + addr, false, pa.font); var phones = f.Phones; if(phones.HasValue()) pg.InsertText("\n" + phones, false, pa.font); var emails = f.Emails; if(emails.HasValue()) pg.InsertText("\n" + emails, false, pa.font); }
private void SendRelationshipsInfo(IEnumerable <DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } // Debug //Tracer.Warning("DOCID {0} corresponds to the document {1}", doc.document.FieldList[0].FieldValue, docReferenceId.Hint(4)); //if (docReferenceId.Hint(4) == "AFE1") //{ // Tracer.Warning("STOP!"); //} if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } // Family has priority over thread, so if the document is part of the family we ignore its thread //if (familyInfoRecord.OriginalParentId != null) //{ // //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, ConversationIndex reset to null", familyInfoRecord.OriginalDocumentId); // doc.ConversationIndex = null; //} familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // Debug //Tracer.Warning("SendRelationshipsInfo: CollectionId = {0}", doc.document.CollectionId); var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
public ActionResult Next(FamilyInfo family) { family.DependentDetails = new List <DependentInfo>(); return(View("Create", family)); }
private static void FillFamilyInfo(PRIZ priz, FamilyInfo familyInfo) { priz.ODIN_ROD = familyInfo.IsOneParent ? 1 : 0; priz.BEZ_ROD = familyInfo.IsWithoutParents ? 1 : 0; }
private void SendRelationshipsInfo(IEnumerable<DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents. // And also we need all of them to provide Original to Real Id translation. FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (doc.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void AddFamily(Row rr, FamilyInfo f) { var c = rr.Cells[0]; var img = ImageData.Image.ImageFromId(f.ImageId); if (img != null) { var ratio = img.Ratio(); using (var os = img.ResizeToStream("width=1000&height=1000&mode=max")) { var h = pa.PicHeightPixels; var w = h * ratio; var str = dd.AddImage(os); var pic = str.CreatePicture(h.ToInt(), w.ToInt()); c.Paragraphs[0].InsertPicture(pic); c.Paragraphs[0].Alignment = Alignment.center; } } c.InsertParagraph(); var p = c.InsertParagraph(f.Title, false, pa.namebold); p.Alignment = Alignment.center; var cc = f.Children().ToList(); c.InsertParagraph("", false, pa.font); var t2 = c.InsertTable(cc.Count + 2 + (f.Head2.HasValue() ? 1 : 0), 2); t2.Alignment = Alignment.center; t2.AutoFit = AutoFit.Contents; t2.Rows[0].Cells[1].Width = 0; var row = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(f.Head1, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(f.BirthDay, false, pa.font); if (f.Head2 != null) { row++; t2.Rows[0].Cells[1].Width = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(f.Head2, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(f.BirthDay2, false, pa.font); } foreach (var ch in cc) { row++; t2.Rows[0].Cells[1].Width = 0; t2.Rows[row].Cells[0].Paragraphs[0].InsertText(ch.Display, false, pa.font); t2.Rows[row].Cells[1].Paragraphs[0].InsertText(ch.BirthDay, false, pa.font); } row++; t2.Rows[row].MergeCells(0, 1); var cell = t2.Rows[row].Cells[0]; var pg = cell.Paragraphs[0]; var addr = f.FullAddress; if (addr.HasValue()) { pg.InsertText("\n" + addr, false, pa.font); } var phones = f.Phones; if (phones.HasValue()) { pg.InsertText("\n" + phones, false, pa.font); } var emails = f.Emails; if (emails.HasValue()) { pg.InsertText("\n" + emails, false, pa.font); } }
private void SendRelationshipsInfo(IEnumerable<DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } // Debug //Tracer.Warning("DOCID {0} corresponds to the document {1}", doc.document.FieldList[0].FieldValue, docReferenceId.Hint(4)); //if (docReferenceId.Hint(4) == "AFE1") //{ // Tracer.Warning("STOP!"); //} if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } // Family has priority over thread, so if the document is part of the family we ignore its thread //if (familyInfoRecord.OriginalParentId != null) //{ // //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, ConversationIndex reset to null", familyInfoRecord.OriginalDocumentId); // doc.ConversationIndex = null; //} familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // Debug //Tracer.Warning("SendRelationshipsInfo: CollectionId = {0}", doc.document.CollectionId); var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void SendRelationshipsInfo(IEnumerable <DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents. // And also we need all of them to provide Original to Real Id translation. FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (doc.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void SendFamilies(IEnumerable<DocumentDetail> documentDetailList) { if (!_jobParams.CreateFamilyGroups) { return; } FamiliesInfo familiesInfo = new FamiliesInfo(); foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (!String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = (String.IsNullOrEmpty(doc.document.EVLoadFileParentId) || doc.document.EVLoadFileParentId == "0") ? null : doc.document.EVLoadFileParentId; // Debug //Tracer.Warning("LawProcessingWorker.SendFamilies: DocId = {0}, OriginalDocumentId = {1}, OriginalParentId = {2}", // docReferenceId, familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } } SendFamilies(familiesInfo); }
private void SendRelationshipsInfo(IEnumerable<EmailThreadingEntity> rawDocumentRelationships) { // For eDocs we ALWAYS send relationships info //if (!m_Parameters.IsImportFamilyRelations) //{ // return; //} FamiliesInfo familiesInfo = new FamiliesInfo(); ThreadsInfo threadsInfo = new ThreadsInfo(); foreach (EmailThreadingEntity emailThreadingEntity in rawDocumentRelationships) { string docReferenceId = emailThreadingEntity.ChildDocumentID; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (emailThreadingEntity.RelationshipType == ThreadRelationshipEntity.RelationshipType.OutlookEmailThread) { // Sanitize the value emailThreadingEntity.ConversationIndex = String.IsNullOrEmpty(emailThreadingEntity.ConversationIndex) ? null : emailThreadingEntity.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (emailThreadingEntity.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, emailThreadingEntity.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } else { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = docReferenceId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(emailThreadingEntity.ParentDocumentID) ? null : emailThreadingEntity.ParentDocumentID; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } const int BatchSize = 500; if (threadsInfo.ThreadInfoList.Count >= BatchSize) { SendThreads(threadsInfo); threadsInfo.ThreadInfoList.Clear(); } if (familiesInfo.FamilyInfoList.Count >= BatchSize) { SendFamilies(familiesInfo); familiesInfo.FamilyInfoList.Clear(); } } if (threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
public JsonResult Create(FamilyInfo familyInfo) { string status = ""; if (familyInfo.MarriageDate != null) { familyInfo.MaritalStatus = "Married"; } StringBuilder sb = new StringBuilder(); try { // TODO: Add insert logic here Guid transactionId = Guid.NewGuid(); if (familyInfo.MarriageDate == DateTime.MinValue) { familyInfo.MarriageDate = null; } familyInfo.CreateDate = DateTime.Now; familyInfo.PrimaryId = transactionId; var famInfo = entityContext.familyInfos.FirstOrDefault(q => q.FirstName == familyInfo.FirstName && q.LastName == familyInfo.LastName && q.DateOfBirth == familyInfo.DateOfBirth); if (famInfo != null && !string.IsNullOrEmpty(famInfo.FirstName)) { var donorName = $"{familyInfo.FirstName} + ' ' + {familyInfo.LastName}"; status = $"{donorName} is already registered."; if (!string.IsNullOrWhiteSpace(familyInfo.Donation)) { var report = AddedTransactions(familyInfo); if (!string.IsNullOrWhiteSpace(familyInfo.Donation) && !string.IsNullOrWhiteSpace(report.Net)) { entityContext.reportInfo.Add(report); } status += $"--Thanks for the Donation of ${familyInfo.Donation}. "; entityContext.SaveChanges(); // Generated PDF Receipt and Send email attachment. if (!string.IsNullOrWhiteSpace(familyInfo.Donation) && !string.IsNullOrWhiteSpace(report.TransactionID)) { ReceiptGenerator.GenerateDonationReceiptPdf(new Donation() { Name = report.Name, Email = report.FromEmailAddress, DonationAmount = report.Net, DonationType = "Cash", Phone = report.PhoneNo, Reason = report.Reason }, report.TransactionID); status = status + $"we sent the tax recepit to your mentioned mail id"; } } } else { familyInfo?.DependentDetails?.ForEach(s => s.PrimaryId = transactionId); entityContext.familyInfos.Add(familyInfo); var report = AddedTransactions(familyInfo); if (!string.IsNullOrWhiteSpace(familyInfo.Donation) && !string.IsNullOrWhiteSpace(report.Net)) { entityContext.reportInfo.Add(report); } entityContext.SaveChanges(); status = $"Record Saved.--Thanks for the Donation of ${ familyInfo.Donation}. "; // Generated PDF Receipt and Send email attachment. if (!string.IsNullOrWhiteSpace(familyInfo.Donation) && !string.IsNullOrWhiteSpace(report.TransactionID)) { ReceiptGenerator.GenerateDonationReceiptPdf(new Donation() { Name = report.Name, Email = report.FromEmailAddress, DonationAmount = report.Net, DonationType = "Cash", Phone = report.PhoneNo, Reason = report.Reason }, report.TransactionID); status = status + $" We sent the tax recepit to your mentioned mail id"; } } ModelState.Clear(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { sb.AppendFormat(ve.ErrorMessage + ","); } } return(Json(sb.ToString(), JsonRequestBehavior.AllowGet)); } return(Json(status, JsonRequestBehavior.AllowGet)); }
private void ImportDocumentRelationship(string documentId, Document currentDcbDocument, FamiliesInfo familiesInfo) { // Debug //Tracer.Warning("DCB documentId = {0}", documentId); if (DcbOpticonJobBEO.FamilyRelations.IsEmailDCB) { if (null != currentDcbDocument.children && currentDcbDocument.children.Any()) { foreach (int physicalChildDocumentNumber in currentDcbDocument.children) { FamilyInfo familyInfoRecord1 = new FamilyInfo(null); familyInfoRecord1.OriginalDocumentId = GenerateDocumentIdForEV(physicalChildDocumentNumber.ToString(CultureInfo.InvariantCulture)); familyInfoRecord1.OriginalParentId = GenerateDocumentIdForEV(currentDcbDocument); familiesInfo.FamilyInfoList.Add(familyInfoRecord1); } } // We don't skip standalone documents for Families, because they always can appear to be topmost parents. // And also we need all of them to provide Original to Real Id translation. FamilyInfo familyInfoRecord2 = new FamilyInfo(documentId); familyInfoRecord2.OriginalDocumentId = GenerateDocumentIdForEV(currentDcbDocument.PhysicalNumber.ToString(CultureInfo.InvariantCulture)); familyInfoRecord2.OriginalParentId = null; familiesInfo.FamilyInfoList.Add(familyInfoRecord2); return; } /*One way of maintaining parent-child relationship in DCB is through PARENT_DOCID & DOCID fields Most of the case it is assumed that PARENT_DOCID & DOCID will have UUID, but in CNClassic there is a way to map DOCID and PARENT_DOCID field during import process For Document realtion the first priority is given to PAREN_DOCID & DOCID field */ Field dcbDocIdField = currentDcbDocument.FieldItems.Find(o => o.Code.Equals(DcbOpticonJobBEO.FamilyRelations.DocId)); string dcbDocId = null; if (null != dcbDocIdField) { dcbDocId = ExtractDcbDocumentId(dcbDocIdField.Value, DcbOpticonJobBEO.FamilyRelations.IsDocIDFormatRange); } if (dcbDocId == null) { Tracer.Warning("Potentially bad DCB source data: document {0} has no DocId field", documentId); return; // No point in sending family record with the original document Id missing } Field dcbParentDocIdField = currentDcbDocument.FieldItems.Find(o => o.Code.Equals(DcbOpticonJobBEO.FamilyRelations.ParentDocId)); string dcbParentDocId = null; if (null != dcbParentDocIdField) { dcbParentDocId = ExtractDcbDocumentId(dcbParentDocIdField.Value, DcbOpticonJobBEO.FamilyRelations.IsParentDocIDFormatRange); } FamilyInfo familyInfo = new FamilyInfo(documentId); familyInfo.OriginalDocumentId = GenerateDocumentIdForEV(dcbDocId); familyInfo.OriginalParentId = GenerateDocumentIdForEV(dcbParentDocId); familiesInfo.FamilyInfoList.Add(familyInfo); //Tracer.Trace("Adding Relationship record. Parent = {0}, Child = {1}", threadingEntity.ParentDocumentID, threadingEntity.ChildDocumentID); }
public override int GetHashCode() { return(PassportInfo.GetHashCode() ^ MilitaryInfo.GetHashCode() ^ CivilInfo.GetHashCode() ^ Contacts.GetHashCode() ^ FamilyInfo.GetHashCode() ^ DriverInfo.GetHashCode()); }
private static FamilyInfo BuildFamilyInfo(priz priz) { var parentFamilyStatus = priz.parents.ToParentFamilyStatusEnum(); var familyInfo = new FamilyInfo(parentFamilyStatus); if (!string.IsNullOrWhiteSpace(priz.relation)) { DateTime?birthdate = priz.relative_birth_date.GetDateTime(); if (!birthdate.HasValue) { throw new ArgumentException(nameof(priz)); } var fullName = new FullName(priz.relative_name); var birthInfo = new BirthInfo(date: birthdate.Value, place: priz.relative_birth_place); var personInfo = new PersonInfo(fullName, birthInfo); var relative = new RelativeInfo(relativeStatus: priz.relation.ToRelativeStatusEnum(), personInfo: personInfo, workPlace: priz.relative_work_place); familyInfo.AddRelative(relative); } if (!string.IsNullOrWhiteSpace(priz.relation2)) { DateTime?birthdate = priz.relative_birth_date2.GetDateTime(); if (!birthdate.HasValue) { throw new ArgumentException(nameof(priz)); } var fullName = new FullName(priz.relative_name2); var birthInfo = new BirthInfo(date: birthdate.Value, place: priz.relative_birth_place2); var personInfo = new PersonInfo(fullName, birthInfo); var relative = new RelativeInfo(relativeStatus: priz.relation2.ToRelativeStatusEnum(), personInfo: personInfo, workPlace: priz.relative_work_place2); familyInfo.AddRelative(relative); } if (!string.IsNullOrWhiteSpace(priz.relation3)) { DateTime?birthdate = priz.relative_birth_date3.GetDateTime(); if (!birthdate.HasValue) { throw new ArgumentException(nameof(priz)); } var fullName = new FullName(priz.relative_name3); var birthInfo = new BirthInfo(date: birthdate.Value, place: priz.relative_birth_place3); var personInfo = new PersonInfo(fullName, birthInfo); var relative = new RelativeInfo(relativeStatus: priz.relation3.ToRelativeStatusEnum(), personInfo: personInfo, workPlace: priz.relative_work_place3); familyInfo.AddRelative(relative); } return(familyInfo); }