/// <summary> /// Initializes a new instance of the <see cref="FilterSettings"/> class. /// </summary> /// <param name="clientParameters">The ClientParameters.</param> public FilterSettings(ClientParameters clientParameters) { PersonWhereSearch = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonWhereSearch", clientParameters.PersonWhereSearch).SetEnable(true); PersonHowSearch = PersonHowSearchFilterSetting.CreateInstance().InitFromQueryString("PersonHowSearch", clientParameters.PersonHowSearch).SetEnable(true); Search = StringQSFilterSetting.CreateInstance().InitFromQueryString("Search", ""); PersonValidAt = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonValidAt", ""); PersonType = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonType", clientParameters.PersonType); Veracity = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonCheck", clientParameters.PersonCheck); Uri myUri = new Uri(HttpContext.Current.Request.Url.AbsoluteUri); string PersonAllBProject = HttpUtility.ParseQueryString(myUri.Query).Get("PersonAllBProject"); clientParameters.PersonAllBProject = Convert.ToInt32(PersonAllBProject); BusinessProject = BusinessProjectFilterSetting.CreateInstance().InitFromQS( "PersonBProject", (clientParameters.PersonBProject == "" ? "0" : clientParameters.PersonBProject), "PersonSubBProject ", clientParameters.PersonSubBProject, "PersonAllBProject ", clientParameters.PersonAllBProject); if (clientParameters.PersonAllBProject != 0) { BusinessProject.SetEnable(true); } PersonArea = PersonAreaFilterSetting.CreateInstance().InitFromQueryString("PersonArea", clientParameters.PersonArea == "" ? "0" : clientParameters.PersonArea); PersonOPForma = UniqueIdQSFilterSetting.CreateInstance().InitFromQueryString("PersonOPForma", clientParameters.PersonOPForma); PersonUsers = PersonUsersFilterSetting.CreateInstance() .SetListAccessor(ids => Kesco.Employees.BusinessLogic.Repository.Employees.GetListByIds(ids)) .InitFromQueryString("PersonUsers", clientParameters.PersonUsers); PersonThemes = PersonThemesFilterSetting.CreateInstance() .SetListAccessor(ids => Repository.PersonThemes.GetListByIds(ids)) .InitFromQS("PersonThemes", clientParameters.PersonThemes, "PersonSubThemes", clientParameters.PersonSubThemes); PersonTUnion = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonTUnion", ""); PersonLink = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonLink", ""); int personID; if (int.TryParse(PersonLink.GetValue(), out personID)) { var p = Repository.Persons.GetInstance(personID); PersonLinkNickname = p != null ? p.Nickname : "#PersonLink"; } else { PersonLinkNickname = ""; } PersonLinkType = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonLinkType", ""); PersonForSend = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonForSend", "0"); PersonAdvSearch = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonAdvSearch", ""); //PersonSelectTop = PersonSelectTopFilterSetting.CreateInstance().InitFromQueryString("PersonSelectTop", 30); }
public ActionResult Create([FromBody] PersonVO person) { if (person == null) { BadRequest(); } return(Ok(PersonLink.CreateLinksPersonVO(_personBussines.Create(person), this.Url))); }
public ActionResult GetById(int id) { PersonVO person = _personBussines.FindById(id); if (person == null) { return(NotFound()); } return(Ok(PersonLink.CreateLinksPersonVO(person, this.Url))); }
public ActionResult Update(int id, [FromBody] PersonVO person) { if (person == null) { BadRequest(); } var personUpdate = _personBussines.Update(person); if (personUpdate == null) { BadRequest(); } return(Ok(PersonLink.CreateLinksPersonVO(personUpdate, this.Url))); }
private PersonLink GetLinkByName(string aName) { PersonLink res = PersonLink.plNone; for (PersonLink pl = PersonLink.plPerson; pl <= PersonLink.plLast; pl++) { if (fLangMan.LS(PersonLinks[(int)pl]) == aName) { res = pl; break; } } return(res); }
public FlowInputDlg(Plugin plugin, IBaseWindow baseWin) { InitializeComponent(); //this.btnClose.Image = GKResources.iBtnCancel; fPlugin = plugin; fLangMan = plugin.LangMan; fBase = baseWin; fSourcesList = new StringList(); cbEventType.Items.AddRange(new object[] { fPlugin.LangMan.LS(FLS.LSID_Birth), fPlugin.LangMan.LS(FLS.LSID_Death), fPlugin.LangMan.LS(FLS.LSID_Marriage) }); PersonLinks = new FLS[] { FLS.LSID_RK_Unk, FLS.LSID_PLPerson, FLS.LSID_Father, FLS.LSID_Mother, FLS.LSID_PLGodparent, FLS.LSID_Spouse, FLS.LSID_Child }; InitGrid(dataGridView1); InitSimpleControls(); InitSourceControls(); for (PersonLink pl = PersonLink.plPerson; pl <= PersonLink.plChild; pl++) { cbPersonLink.Items.Add(fLangMan.LS(PersonLinks[(int)pl])); } SetLang(); }
// TODO: rollback changes when exception! private void ParseSource() { int srcYear; if (!int.TryParse(edSourceYear.Text, out srcYear)) { ShowError(fLangMan.LS(FLS.LSID_SourceYearInvalid)); return; } string srcName = cbSource.Text; string srcPage = edPage.Text; string place = edPlace.Text; GDMSourceRecord srcRec = null; if (!string.IsNullOrEmpty(srcName)) { srcRec = fBase.Context.FindSource(srcName); if (srcRec == null) { srcRec = fBase.Context.Tree.CreateSource(); srcRec.ShortTitle = srcName; } } GDMIndividualRecord iMain = null; int num = dataGridView1.Rows.Count; for (int r = 0; r < num; r++) { DataGridViewRow row = dataGridView1.Rows[r]; string lnk = CheckStr((string)row.Cells[0].Value); string nm = CheckStr((string)row.Cells[1].Value); string pt = CheckStr((string)row.Cells[2].Value); string fm = CheckStr((string)row.Cells[3].Value); string age = CheckStr((string)row.Cells[4].Value); string comment = CheckStr((string)row.Cells[5].Value); if (!string.IsNullOrEmpty(lnk)) { PersonLink link = GetLinkByName(lnk); if (link == PersonLink.plNone) { continue; } GDMSex sx = fBase.Context.DefineSex(nm, pt); GDMIndividualRecord iRec = fBase.Context.CreatePersonEx(nm, pt, fm, sx, false); if (!string.IsNullOrEmpty(age) && ConvertHelper.IsDigits(age)) { int birthYear = srcYear - int.Parse(age); fBase.Context.CreateEventEx(iRec, GEDCOMTagName.BIRT, "ABT " + birthYear.ToString(), ""); } if (!string.IsNullOrEmpty(place)) { GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, GEDCOMTagName.RESI, "", ""); evt.Place.StringValue = place; } if (!string.IsNullOrEmpty(comment)) { GDMNoteRecord noteRec = fBase.Context.Tree.CreateNote(); noteRec.SetNoteText(comment); iRec.AddNote(noteRec); } if (srcRec != null) { iRec.AddSource(srcRec, srcPage, 0); } fBase.NotifyRecord(iRec, RecordAction.raAdd); GDMFamilyRecord family = null; if (link == PersonLink.plPerson) { iMain = iRec; string evName = ""; if (rbSK_Met.Checked) { switch (cbEventType.SelectedIndex) { case 0: evName = GEDCOMTagName.BIRT; break; case 1: evName = GEDCOMTagName.DEAT; break; case 2: evName = GEDCOMTagName.MARR; break; } } if (evName == GEDCOMTagName.BIRT || evName == GEDCOMTagName.DEAT) { GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), ""); evt.Place.StringValue = place; } else if (evName == GEDCOMTagName.MARR) { family = iRec.GetMarriageFamily(true); GDMCustomEvent evt = fBase.Context.CreateEventEx(family, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), ""); evt.Place.StringValue = place; } } else { if (iMain == null) { throw new PersonScanException(fLangMan.LS(FLS.LSID_BasePersonInvalid)); } else { switch (link) { case PersonLink.plFather: case PersonLink.plMother: family = iMain.GetParentsFamily(true); family.AddSpouse(iRec); break; case PersonLink.plGodparent: iMain.AddAssociation(fLangMan.LS(FLS.LSID_PLGodparent), iRec); break; case PersonLink.plSpouse: family = iMain.GetMarriageFamily(true); family.AddSpouse(iRec); break; case PersonLink.plChild: family = iMain.GetMarriageFamily(true); family.AddChild(iRec); break; } } } } } InitSourceControls(); }
public bool SavePersonLink(PersonLink personLink) { return(repoPersonLink.Save(o => o.PersonId == personLink.PersonId && o.LinkPersonId == personLink.LinkPersonId, personLink)); }
public ActionResult GetAll() { List <PersonVO> persons = _personBussines.FindAll(); return(Ok(PersonLink.CreateLinksPersonVO(persons, this.Url))); }