protected void btnSave_Click(object sender, EventArgs e) { FamilyMembers objFamilyMembers = new FamilyMembers(); objFamilyMembers.FamilyMemberName = txtFamilyMemberName.Text; if (!string.IsNullOrEmpty(hfFamilyMemberID.Value.ToString())) { objFamilyMembers.UpdatedBy = UserAuthentication.GetUserId(this.Page); objFamilyMembers.UpdatedDate = DateTime.Now; objFamilyMembers.FamilyMemberID = Convert.ToInt32(hfFamilyMemberID.Value); objFamilyMembers.FamilyMemberName = txtFamilyMemberName.Text; FamilyMembersBO.UpdateFamilyMembers(objFamilyMembers); } else { objFamilyMembers.CreatedBy = UserAuthentication.GetUserId(this.Page); objFamilyMembers.CreatedDate = DateTime.Now; FamilyMembersBO.InsertFamilyMembers(objFamilyMembers); } txtFamilyMemberName.Text = string.Empty; hfFamilyMemberID.Value = string.Empty; loadFamilyMember(); }
public ActionResult FamilyMemberList(string familyName, string address = null, string tel = null) { FamilyMembers model = new FamilyMembers(); model.Family = new Family(); model.Family.FamilyName = familyName; model.Family.Address = address; model.Family.Tel = tel; var customers = this._customerService.GetCustomers().Where(m => m.FamilyName.Equals(familyName)).ToList(); if (customers.Count() > 0) { model.Family = new Family { FamilyName = familyName, Address = customers.FirstOrDefault().Address, Tel = customers.FirstOrDefault().Tel }; List <FamilyMember> familyMembers = TranformCustomersToModel(customers); model.Familymembers = familyMembers; } else { model.Familymembers = new List <FamilyMember>(); } return(View(model)); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var result = new List <ValidationResult>(); result.AddRange(FirstOnsetDate.ValidatePastDate(nameof(FirstOnsetDate), true)); result.AddRange(LastMedicalConsultationDate.ValidatePastDate(nameof(LastMedicalConsultationDate), true)); for (var i = 0; i <= PhysicianInfos.Count - 1; i++) { result.AddRange(PhysicianInfos[i].Validate($"{nameof(PhysicianInfos)}[{i}]")); } if (string.IsNullOrWhiteSpace(Diagnosis)) { result.Add(new ValidationResult(string.Empty, new[] { nameof(Diagnosis) })); } if (string.IsNullOrWhiteSpace(OnsetDescription)) { result.Add(new ValidationResult(string.Empty, new[] { nameof(OnsetDescription) })); } if (string.IsNullOrWhiteSpace(HasFamilyMemberWithSameProblem)) { result.Add(new ValidationResult(string.Empty, new[] { nameof(HasFamilyMemberWithSameProblem) })); } if (HasFamilyMemberWithSameProblem == "O") { result.AddRange(FamilyMembers.Validate(nameof(FamilyMembers), true)); } return(result); }
private void AddFamilyMember() { var familyMember = new FamilyMember(); _family.CurrentChild.FamilyMembers.Add(familyMember); FamilyMembers.Add(familyMember); }
public FamilyMemberListViewModel(FamilyRepository family) { _family = family; family.CurrentChild.FamilyMembers.ForEach(_ => FamilyMembers.Add(_)); NewFamilyMemberCommand = new Command(AddFamilyMember); }
public async Task <IActionResult?> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "put", Route = "dishes/{dishId}/rating")] HttpRequest req, string dishId ) { var(authenticationStatus, authenticationResponse) = await req.HttpContext.AuthenticateAzureFunctionAsync(); if (!authenticationStatus) { return(authenticationResponse); } var dish = await _dishRepository.GetDishAsync(Guid.Parse(dishId)); if (dish is null) { return(new BadRequestObjectResult("DISH_NOT_FOUND")); } var userId = Guid.Parse(req.HttpContext.User.GetNameIdentifierId() !); if (!_authz.Authorize(userId, dish.FamilyId, Resources.Dish, Actions.Update)) { return(new UnauthorizedResult()); } var dishRating = await req.GetBodyAs <UpdateDishRatingCommandModel>(); if (dishRating is null || dishRating.FamilyMemberId is null) { return(new BadRequestObjectResult("MISSING_VALUES")); } var family = await _familyRepository.GetFamily(dish.FamilyId); var familyMemberId = Guid.Parse(dishRating.FamilyMemberId); var familyMember = family !.FamilyMembers.FirstOrDefault(w => w.Id == familyMemberId); if (familyMember is null) { return(new BadRequestObjectResult("FAMILYMEMBER_NOT_FOUND_IN_FAMILY")); } // verify that you're rating as yourself or on behalf of a user that doesn't have autonomy - rating on behalf of other autonomus users is not allowed if (!familyMember.Id.Equals(userId) && familyMember.HasAutonomy) { return(new BadRequestObjectResult("NOT_ALLOWED")); } dish.SetRating(familyMemberId, dishRating.GetRatingInDomainFormat()); await _dishRepository.SaveAsync(dish); return(new OkResult()); }
public static void LoadFamilyFromProperties() { FamilyMembers.Clear(); if (Application.Current.Properties.ContainsKey(FAMILY_MEMBERS_PROPERTIES_KEY)) { string json = Application.Current.Properties[FAMILY_MEMBERS_PROPERTIES_KEY] as string; if (json != null) { List <FamilyMember> theFam = Newtonsoft.Json.JsonConvert.DeserializeObject <List <FamilyMember> >(json); FamilyMembers.AddRange(theFam); } } }
public void SetFamilyMembersInSession(FamilyMembers familyMembers) { if (familyMembers?.FamilyMembersDetails == null) { return; } var collection = SessionState.UserSession.GetDataCollection <List <FamilyMembersDetails> >(Constants.FamilyResearch_FamilyMembers_Table); if (collection == null) { foreach (var iter in familyMembers.FamilyMembersDetails) { SessionState.UserSession.AddItemInDataCollection <FamilyMembersDetails>(Constants.FamilyResearch_FamilyMembers_Table, iter); } } }
private static Person GetPerson(string personInfo) { Person person; var isInfoDate = DateTime.TryParseExact(personInfo, "d/M/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime personBirthDate); if (!isInfoDate) { person = FamilyMembers.Where(p => p.Name == personInfo).First(); } else { person = FamilyMembers.Where(p => p.BirthDate == personBirthDate).First(); } return(person); }
public XmlElement ToXmlElement(XmlHelper helper) { var xmlElement = helper.CreateElement(nameof(AboutIllnessModel).Replace("Model", string.Empty)); xmlElement.AppendChild(helper.CreateElement(nameof(FirstOnsetDate), helper.TransformerDate(FirstOnsetDate))); xmlElement.AppendChild(helper.CreateElement(nameof(OnsetDescription), OnsetDescription)); xmlElement.AppendChild(helper.CreateElement(nameof(LastMedicalConsultationDate), helper.TransformerDate(LastMedicalConsultationDate))); xmlElement.AppendChild(helper.CreateElement(nameof(PhysicianInfos), PhysicianInfos.Select(x => x.ToXmlElement(helper)).ToList())); xmlElement.AppendChild(helper.CreateElement(nameof(Diagnosis), Diagnosis)); xmlElement.AppendChild(helper.CreateElement(nameof(HasFamilyMemberWithSameProblem), (HasFamilyMemberWithSameProblem == "O").ToString())); if (HasFamilyMemberWithSameProblem == "O") { xmlElement.AppendChild(helper.CreateElement(nameof(FamilyMembers), FamilyMembers.ToXmlElement(helper))); } return(xmlElement); }
public ActionResult FamilyMemberListDetail(string familyName, string address, string tel) { FamilyMembers model = new FamilyMembers(); model.Family = new Family(); model.Family.FamilyName = familyName; model.Family.Address = address; model.Family.Tel = tel; model.Familymembers = new List <FamilyMember>(); var customers = this._customerService.GetCustomers().Where(m => m.FamilyName.Equals(familyName)).ToList(); if (customers != null) { model.Familymembers = TranformCustomersToModel(customers); } else { } return(PartialView(model)); }
private void GetFamilyMembers(GenericProfileData profileData) { Print($"Getting rows", ConsoleColor.Blue); var rows = _driver.FindElementsByXPath("//div[@id='family']//div[@class='_4g34']"); foreach (var row in rows) { var family = new FamilyMembers(); var name = ElementIsPresent(row, By.ClassName("_52jb"), true)?.Text; var relation = ElementIsPresent(row, By.ClassName("_52jg"), true)?.Text; var url = ElementIsPresent(row, By.CssSelector("a"), true)?.GetAttribute("href"); Print($"Adding name {name}, relation {relation}, url {url}", ConsoleColor.DarkGreen); family.Name = name; family.Relation = relation; family.Url = url; profileData.AddData("FamilyMembers", family); } }
public void GetFamilyMembersFromSession() { var collection = SessionState.UserSession.GetDataCollection <List <FamilyMembersDetails> >(Constants.FamilyResearch_FamilyMembers_Table); if (collection != null) { FamilyMembers = new FamilyMembers(); FamilyMembers.FamilyMembersDetails = new FamilyMembersDetails[collection.Count]; if (FamilyMembersId > 0) { FamilyMembers.Id = Convert.ToInt32(FamilyMembersId); } for (int index = 0; index < collection.Count; index++) { FamilyMembers.FamilyMembersDetails[index] = collection[index]; if (FamilyMembersId > 0) { FamilyMembers.FamilyMembersDetails[index].FamilyMembersId = FamilyMembers.Id; } } } }
private void SaveFamilies(int Id, IEnumerable <FamilyViewModel> members, int currMembers = 0) { //Save Family member details // var Id = member.IcomMembersId; int intFamMbrs = currMembers; var allFamilyMembers = members; if (allFamilyMembers != null) { foreach (var fm in allFamilyMembers) { if (!string.IsNullOrWhiteSpace(fm.FamilyFullName)) { var fM = new FamilyMembers { DOB = fm.FamilyDOB, FullName = fm.FamilyFullName, IcomMembersId = Id, DateAdded = DateTime.Now, PrimaryMember = fm.IsPrimary }; db.FamilyMembers.Add(fM); if (CalculateAge((DateTime)fm.FamilyDOB) >= 18) { intFamMbrs++; } } } } db.SaveChanges(); var currMember = db.IcomMembers.Find(Id); currMember.AmountCharged = Convert.ToDecimal(intFamMbrs * 120.0M); db.Entry(currMember).State = EntityState.Modified; db.SaveChanges(); }
public ActionResult UpdateFamily(FamilyMembers members) { try { var family = new MemberFamilyMetaData { Name = members.Name, Sex = int.Parse(members.Gender), DateOfBirth = members.DateOfBirth, Relationship = members.Relationship, MemberId = members.MemberId }; var updated = _memberRepository.UpdateFamilyMembers(family); if (updated) { return(Redirect("View/" + members.MemberId)); } return(Redirect("Error")); } catch (Exception e) { return(Redirect("Error")); } }
public static void AddMember(Person familyMember) { FamilyMembers.Add(familyMember); }
public void AddMember(string name, int age) { FamilyMembers.Add(new Person(name, age)); }
public void CRUD_Operations_With_Array_of_objects() { using (var store = GetDocumentStore()) { using (var newSession = store.OpenSession()) { var family = new FamilyMembers() { Members = new [] { new member() { Name = "Hibernating Rhinos", Age = 8 }, new member() { Name = "RavenDB", Age = 4 } } }; newSession.Store(family, "family/1"); newSession.SaveChanges(); var newFamily = newSession.Load <FamilyMembers>("family/1"); newFamily.Members = new[] { new member() { Name = "RavenDB", Age = 4 }, new member() { Name = "Hibernating Rhinos", Age = 8 } }; var changes = newSession.Advanced.WhatChanged(); Assert.Equal(1, changes.Count); Assert.Equal(4, changes["family/1"].Length); Array.Sort(changes["family/1"], (x, y) => x.FieldFullName.CompareTo(y.FieldFullName)); Assert.Equal("Name", changes["family/1"][1].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][1].Change); Assert.Equal("Hibernating Rhinos", changes["family/1"][1].FieldOldValue.ToString()); Assert.Equal("RavenDB", changes["family/1"][1].FieldNewValue.ToString()); Assert.Equal("Age", changes["family/1"][0].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][0].Change); Assert.Equal(8L, changes["family/1"][0].FieldOldValue); Assert.Equal(4L, changes["family/1"][0].FieldNewValue); Assert.Equal("Name", changes["family/1"][3].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][3].Change); Assert.Equal("RavenDB", changes["family/1"][3].FieldOldValue.ToString()); Assert.Equal("Hibernating Rhinos", changes["family/1"][3].FieldNewValue.ToString()); Assert.Equal("Age", changes["family/1"][2].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][2].Change); Assert.Equal(4L, changes["family/1"][2].FieldOldValue); Assert.Equal(8L, changes["family/1"][2].FieldNewValue); newFamily.Members = new[] { new member() { Name = "Toli", Age = 5 }, new member() { Name = "Boki", Age = 15 } }; changes = newSession.Advanced.WhatChanged(); Assert.Equal(1, changes.Count); Assert.Equal(4, changes["family/1"].Length); Array.Sort(changes["family/1"], (x, y) => x.FieldFullName.CompareTo(y.FieldFullName)); Assert.Equal("Name", changes["family/1"][1].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][1].Change); Assert.Equal("Hibernating Rhinos", changes["family/1"][1].FieldOldValue.ToString()); Assert.Equal("Toli", changes["family/1"][1].FieldNewValue.ToString()); Assert.Equal("Age", changes["family/1"][0].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][0].Change); Assert.Equal(8L, changes["family/1"][0].FieldOldValue); Assert.Equal(5L, changes["family/1"][0].FieldNewValue); Assert.Equal("Name", changes["family/1"][3].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][3].Change); Assert.Equal("RavenDB", changes["family/1"][3].FieldOldValue.ToString()); Assert.Equal("Boki", changes["family/1"][3].FieldNewValue.ToString()); Assert.Equal("Age", changes["family/1"][2].FieldName); Assert.Equal(DocumentsChanges.ChangeType.FieldChanged, changes["family/1"][2].Change); Assert.Equal(4L, changes["family/1"][2].FieldOldValue); Assert.Equal(15L, changes["family/1"][2].FieldNewValue); } } }
public FamilyMemberListViewModel() { CurrentChild.FamilyMembers.ForEach(_ => FamilyMembers.Add(_)); NewFamilyMemberCommand = new Command(AddFamilyMember); }
public Person GetOldestMember(Family family) { return(FamilyMembers.OrderByDescending(x => x.Age).First()); }
protected void Page_Load(object sender, EventArgs e) { var labelNameFormat = Request.QueryString["format"]; int?qid = Request.QueryString["id"].ToInt2(); var r = Response; r.Clear(); var useweb = Request.QueryString["web"]; string header = @"<html xmlns:x=""urn:schemas-microsoft-com:office:excel""> <head> <meta http-equiv=Content-Type content=""text/html; charset=utf-8""> <style> <!--table br {mso-data-placement:same-cell;} tr {vertical-align:top;} td.Text {mso-number-format:\@} --> </style> </head> <body>"; r.Charset = ""; if (!qid.HasValue && labelNameFormat != "Groups") { r.Write("no queryid"); r.Flush(); r.End(); } if (useweb != "true") { r.ContentType = "application/vnd.ms-excel"; r.AddHeader("Content-Disposition", "attachment;filename=CMSPeople.xls"); } r.Write(header); var ctl = new MailingController(); var useTitles = Request.QueryString["titles"]; ctl.UseTitles = useTitles == "true"; var dg = new DataGrid(); dg.EnableViewState = false; switch (labelNameFormat) { case "Individual": dg.DataSource = ExportPeople.FetchExcelList(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "IndividualPicture": GridView1.EnableViewState = false; GridView1.AllowPaging = false; GridView1.DataSource = ExportPeople.FetchExcelListPics(qid.Value, maxExcelRows); GridView1.DataBind(); GridView1.RenderControl(new HtmlTextWriter(r.Output)); break; case "Library": dg.DataSource = ExportPeople.FetchExcelLibraryList(qid.Value); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Family": dg.DataSource = ctl.FetchExcelFamily(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "FamilyMembers": FamilyMembers.EnableViewState = false; FamilyMembers.AllowPaging = false; FamilyMembers.DataSource = ExportPeople.FetchExcelListFamilyMembers(qid.Value); FamilyMembers.DataBind(); FamilyMembers.RenderControl(new HtmlTextWriter(r.Output)); break; case "AllFamily": dg.DataSource = ExportPeople.FetchExcelListFamily(qid.Value); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "ParentsOf": dg.DataSource = ctl.FetchExcelParents(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "CouplesEither": dg.DataSource = ctl.FetchExcelCouplesEither(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "CouplesBoth": dg.DataSource = ctl.FetchExcelCouplesBoth(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Involvement": dg.DataSource = ExportInvolvements.InvolvementList(qid.Value); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Children": dg.DataSource = ExportInvolvements.ChildrenList(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Church": dg.DataSource = ExportInvolvements.ChurchList(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Attend": dg.DataSource = ExportInvolvements.AttendList(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Organization": dg.DataSource = ExportInvolvements.OrgMemberList(qid.Value); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Groups": dg.DataSource = ExportInvolvements.OrgMemberListGroups(); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; case "Promotion": dg.DataSource = ExportInvolvements.PromoList(qid.Value, maxExcelRows); dg.DataBind(); dg.RenderControl(new HtmlTextWriter(r.Output)); break; } r.Write("</body></HTML>"); r.Flush(); r.End(); }
public static int InsertFamilyMembers(FamilyMembers objFamilyMembers) { return new FamilyMembersDAO().InsertFamilyMembers(objFamilyMembers); }
internal void Refine() { FamilyMembers.Refine(HasFamilyMemberWithSameProblem == "O"); }
public static FamilyMembers GetFamilyMembers(int FamilyMemberID) { FamilyMembers objFamilyMembers = new FamilyMembers(); return (FamilyMembers)(new FamilyMembersDAO().FillDTO(objFamilyMembers, "FamilyMemberID=" + FamilyMemberID)); }
public static int UpdateFamilyMembers(FamilyMembers objFamilyMembers) { return new FamilyMembersDAO().UpdateFamilyMembers(objFamilyMembers); }