public ActionResult UpdateRelation(int id, int id1, int id2, string value) { var r = DbUtil.Db.RelatedFamilies.SingleOrDefault(rr => rr.FamilyId == id1 && rr.RelatedFamilyId == id2); r.FamilyRelationshipDesc = value.Truncate(256); DbUtil.Db.SubmitChanges(); var m = new FamilyModel(id); return View("Family/Related", m); }
public ActionResult DeleteRelation(int id, int id1, int id2) { var r = DbUtil.Db.RelatedFamilies.SingleOrDefault(rf => rf.FamilyId == id1 && rf.RelatedFamilyId == id2); DbUtil.Db.RelatedFamilies.DeleteOnSubmit(r); DbUtil.Db.SubmitChanges(); var m = new FamilyModel(id); return View("Family/Related", m); }
/// <summary> /// Display a friendly greeting at the top of the screen. /// </summary> /// <param name="name">Name of user for the salutation</param> private async void UpdateGreeting(string name) { var now = DateTime.Now; var greeting = now.Hour < 12 ? "Good morning" : now.Hour < 18 ? "Good afternoon" : /* otherwise */ "Good night"; var person = (string.IsNullOrEmpty(name) || name == App.EVERYONE) ? "!" : $", {name}!"; TextGreeting.Text = $"{greeting}{person}"; if (!string.IsNullOrEmpty(name) && (name != App.EVERYONE)) { await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { var SpeakGreeting = $"{greeting} {name}"; var notes = taskPanel.CountNotes(FamilyModel.PersonFromName(name)); if (notes > 0) { if (notes == 1) { SpeakGreeting += ",there is a note for you."; } else { SpeakGreeting += $",there are {notes} notes for you."; } } await this._speechManager.SpeakAsync( SpeakGreeting, this._media); }); } }
public async Task <FamilyModel> AddFamilyAsync(FamilyModel family) { // Authorize user // Validate input #region Validate input /// TODO: think of a strategy for validation => one solution to have one validation class that creates only /// one SQL call to check different validations => only one SQL access for validation // check at least one insuree in the family NotEmptyFamilyValidator notEmptyFamilyValidator = new NotEmptyFamilyValidator(null); OnlyOneHeadInFamilyValidator onlyOneHeadInFamilyValidator = new OnlyOneHeadInFamilyValidator(notEmptyFamilyValidator); onlyOneHeadInFamilyValidator.Validate(family); // check each insuree number is correct and unique /// TODO: add only one validator for the Insuree class as it will be used here and in the InsureeLogic IInsureeLogic insureeLogic = this.imisModules.GetInsureeManagementModule().GetInsureeLogic(); UniqueInsureeNumberValidator uniqueInsureeNumberValidator = new UniqueInsureeNumberValidator(insureeLogic, insureeNumberValidator); foreach (InsureeModel insuree in family.Insurees) { await uniqueInsureeNumberValidator.ValidateAsync(insuree.CHFID); } #endregion // Execute business behaviour FamilyModel newFamily = await familyRepository.AddNewFamilyAsync(family); // Validate results // Validate data access rights // Return results return(newFamily); }
public ActionResult BookAmenities() { omodel.GetModel.lstamenities = HttpContext.Application["amenitielst"] as List <string>; LoginModel user = (LoginModel)Session["user"]; if (user == null) { return(RedirectToAction("Login", "HomePage")); } DataSet ds = ModelManger.GetBookedDetail(user.Email); DataTable dt = new DataTable(); dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { omodel.GetModel.Name = dr.ItemArray[0].ToString(); omodel.GetModel.Cell = dr.ItemArray[1].ToString(); omodel.GetModel.Block = dr.ItemArray[2].ToString(); omodel.GetModel.Flat_no = Convert.ToInt32(dr.ItemArray[3]); } dt = ds.Tables[1]; foreach (DataRow dr in dt.Rows) { FamilyModel fm = new FamilyModel(); fm.Id = Convert.ToInt32(dr.ItemArray[0]); fm.Name = dr.ItemArray[1].ToString(); fm.Cell = dr.ItemArray[2].ToString(); fm.Block = dr.ItemArray[3].ToString(); fm.Flat_no = Convert.ToInt32(dr.ItemArray[4]); fm.Booking_for = dr.ItemArray[5].ToString(); fm.On_date = dr.ItemArray[6].ToString(); fm.On_time = dr.ItemArray[7].ToString(); omodel.lstmodel.Add(fm); } return(View(omodel)); }
public IActionResult Post([FromBody] FamilyModel familyModel) { try { if (!ModelState.IsValid) { var errors = new List <string>(); foreach (var state in ModelState) { foreach (var error in state.Value.Errors) { errors.Add(error.ErrorMessage); } } return(BadRequest(new { message = errors })); } var user = _dbContext.User.Where(x => x.Id == familyModel.UserId).FirstOrDefault(); if (user != null) { Family family = Mapper.Map <Family>(familyModel); _dbContext.Family.Add(family); _dbContext.SaveChanges(); return(Created($"api/family/{family.Id}", family)); } else { return(NotFound(new { message = "user does not exist" })); } } catch (Exception ex) { return(StatusCode(500, new { message = ex.Message })); } }
public ActionResult <FamilyModel> UpdateFamily( [FromBody] FamilyModel family ) { if (ModelState.IsValid) { var obj = _service.GetById(family.Id); if (obj != null) { obj.Update(family.Name, User.Identity.Name); _service.Update(obj); return(family); } else { return(NotFound("Registro não encontrado")); } } else { return(BadRequest(ModelState)); } }
public async Task ActivityTimeLineAdd(FamilyModel argFamilyModel) { // No Timeline functionality so ignore this }
public async Task VerificationWithVoiceReturn(System.Net.Http.HttpRequestMessage request) { string Lang = "en-US"; string Text = ""; if (Request.Form["lang"] != null) { Lang = Request.Form["lang"].ToString(); } string uploadFileName = Request.Files[0].FileName; if (string.IsNullOrEmpty(uploadFileName)) { if (Lang == "zh-TW") { Text = "找不到上傳相片"; } else { Text = "can't find upload media file"; } } else { try { FamilyModel faceDetect = new FamilyModel(Request.Files[0].InputStream); FamilyVerifyResult result = await faceDetect.Verification(); if (result.IsIdentical) { if (Lang == "zh-TW") { Text = "你是家人, " + result.memberName + ". 信心指數 : " + result.Confidence; } else { Text = "You are family, " + result.memberName + ". Confidence : " + result.Confidence; } } else { if (Lang == "zh-TW") { Text = "你不是家人"; } else { Text = "You are Not family"; } } } catch (Exception) { if (Lang == "zh-TW") { Text = "無法辨識相片裡的臉孔"; } else { Text = "Can't identify Image Face"; } } } TTSpeech tts = new TTSpeech(Text, Lang); byte[] voiceByte = tts.GetSpeech(); if (tts.speechStream != null) { Response.Clear(); Response.AddHeader("Content-Length", voiceByte.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=speech.wav"); Response.OutputStream.Write(voiceByte, 0, voiceByte.Length); Response.Flush(); Response.End(); } else { Response.Clear(); Response.Flush(); Response.End(); } }
public void SetContent(FamilyModel familyModel) { this.mFamilyModel = familyModel; mTexture2DFather = mResLoader.LoadSync <Texture2D>("ic_head_father"); mTexture2DMother = mResLoader.LoadSync <Texture2D>("ic_head_mother"); mTexture2DGrandFather = mResLoader.LoadSync <Texture2D>("ic_head_grand_father"); mTexture2DGrandMother = mResLoader.LoadSync <Texture2D>("ic_head_grand_mother"); mTexture2DBrother = mResLoader.LoadSync <Texture2D>("ic_head_brother"); mTexture2DSister = mResLoader.LoadSync <Texture2D>("ic_head_sister"); if (familyModel.logoUrl.IsNotNullAndEmpty()) { ImageDownloadUtils.Instance.SetAsyncImage(familyModel.logoUrl, ImgHead); } else if (familyModel.babyRelation.Equals("父亲")) { ImgHead.sprite = Sprite.Create(mTexture2DFather, new Rect(0, 0, mTexture2DFather.width, mTexture2DFather.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("母亲")) { ImgHead.sprite = Sprite.Create(mTexture2DMother, new Rect(0, 0, mTexture2DMother.width, mTexture2DMother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("祖父")) { ImgHead.sprite = Sprite.Create(mTexture2DGrandFather, new Rect(0, 0, mTexture2DGrandFather.width, mTexture2DGrandFather.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("祖母")) { ImgHead.sprite = Sprite.Create(mTexture2DGrandMother, new Rect(0, 0, mTexture2DGrandMother.width, mTexture2DGrandMother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("哥哥")) { ImgHead.sprite = Sprite.Create(mTexture2DBrother, new Rect(0, 0, mTexture2DBrother.width, mTexture2DBrother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("姐姐")) { ImgHead.sprite = Sprite.Create(mTexture2DSister, new Rect(0, 0, mTexture2DSister.width, mTexture2DSister.height), Vector2.one * 0.5f); } TextMobile.text = familyModel.mobile; if (familyModel.id == PlayerPrefsUtil.GetUserId()) { TextRelation.text = "我"; } else { TextRelation.text = mFamilyModel.babyRelation; } if (familyModel.isManager == 1) { ImgAdmin.gameObject.SetActive(true); } else { ImgAdmin.gameObject.SetActive(false); } }
public ActionResult RelatedFamilies(int id) { var m = new FamilyModel(id); return View("Family/Related", m); }
public ActionResult FamilyMembers(int id) { var m = new FamilyModel(id); return View("Family/Members", m); }
public FamilyViewModel(FamilyModel familyModel) { _familyModel = familyModel; }
public ActionResult FamilyMembers(int id) { var m = new FamilyModel(id); return(View("Family/Members", m)); }
private Func <PersonWithMetadata, Tuple <bool, bool, bool> > GetHasFatherHasMotherHasSpouse(FamilyModel familyModel) { return(person => { if (person.BooleanSamples == null || !person.BooleanSamples.ContainsKey(PersonStatisticKeys.HasFather) || !person.BooleanSamples.ContainsKey(PersonStatisticKeys.HasMother) || !person.BooleanSamples.ContainsKey(PersonStatisticKeys.HasSpouse)) { return familyModel.HasFatherHasMotherHasSpouse(person); } return new Tuple <bool, bool, bool>(person.BooleanSamples[PersonStatisticKeys.HasFather], person.BooleanSamples[PersonStatisticKeys.HasMother], person.BooleanSamples[PersonStatisticKeys.HasSpouse]); }); }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async Task ActivityTimeLineAdd(FamilyModel argFamilyModel) #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { // No Timeline functionality so ignore this }
public void OnReceiveMsg(ReceiveMsgOrder receiveMsgOrder) { string[] msg = null; if (receiveMsgOrder.MsgContent.IndexOf(MessageTypes.NSP) > -1) { msg = receiveMsgOrder.MsgContent.Split(MessageTypes.NSP.ToCharArray()); } // ilogger.Logger(string.Format("接收到的数据:{0}-{1}", receiveMsgOrder.ModuleType, receiveMsgOrder.MsgContent)); if (receiveMsgOrder.Sign == 0) { XWT.MessageBox.Show(receiveMsgOrder.MsgContent, "提示", MessageBoxButton.OK, MessageBoxImage.Information); return; } switch (receiveMsgOrder.ModuleType) { #region 返回个人信息_PER case MessageTypes.PER: this.UserID = msg[0]; this.CardWord = msg[1]; this.UserName = msg[2]; this.ImgSrc = msg[3]; //存储用户信息 this.regionManager.Regions[RegionTypes.CardRegion].Context = msg; break; #endregion #region 返回游戏成就_ACH case MessageTypes.ACH: //更新 foreach (AchieveViewModel viewmodel in achieveList) { if (viewmodel.GameName == msg[0]) { viewmodel.Level = msg[1]; viewmodel.Rank = msg[2]; viewmodel.Total = msg[3]; viewmodel.Single = msg[4]; return; } } //添加 _achieveModel = AchieveModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[4]); achieveList.Add(new AchieveViewModel(_achieveModel)); //this.AllAchieves.Add(new AchieveViewModel(_achieveModel)); this.Achieve++; ChangePage(this._pagingAchieve.CurrentPage == 0 ? 1 : this._pagingAchieve.CurrentPage, Paging.ACH, this._pagingAchieve); break; #endregion #region 返回消息_MSG case MessageTypes.MSG: string msginfo = msg[0] + "," + GetString.GetRandomCode(GetString.Code.StrAndNum, 4); _msgModel = MsgModel.CreateModel(msginfo, msg[0], msg[1], msg[2], msg[3]); msgList.Add(new MsgViewModel(_msgModel)); this.Message++; ChangePage(this._pagingMsg.CurrentPage == 0 ? 1 : this._pagingMsg.CurrentPage, Paging.MSG, this._pagingMsg); break; #endregion #region 修改密码返回的信息_SET case MessageTypes.SET: this.PassWord = ""; this.NewPassWord = ""; this.ConPassWord = ""; XWT.MessageBox.Show(receiveMsgOrder.MsgContent, "提示", MessageBoxButton.OK, MessageBoxImage.Information); break; #endregion #region 返回好友信息_FRI case MessageTypes.FRI: switch (msg[5]) { case MessageTypes.Friend: _friendModel = FriendModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[5], msg[4] == MessageTypes.N ? true : false, msg[4] == MessageTypes.N ? false : true); this.AllFriends.Add(new FriendViewModel(_friendModel)); this.Friend++; break; case MessageTypes.Family: _familyModel = FamilyModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[5], msg[4] == MessageTypes.N ? true : false, msg[4] == MessageTypes.N ? false : true); this.AllFamilys.Add(new FamilyViewModel(_familyModel)); this.Friend++; break; case MessageTypes.Black: _blackModel = BlackModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[5], msg[4] == MessageTypes.N ? true : false, false); this.AllBlacks.Add(new BlackViewModel(_blackModel)); this.Friend++; break; } break; #endregion #region 返回查找好友结果_SFR case MessageTypes.SFR: _resultModel = ResultModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[1] == this.CardWord ? false : true, msg[4] == MessageTypes.N ? true : false); this.AllResults.Add(new ResultViewModel(_resultModel)); break; #endregion #region 好友上线通知_UPL case MessageTypes.UPL: foreach (FriendViewModel friend in this.AllFriends.Where(f => f.FriendID == receiveMsgOrder.MsgContent)) { friend.FriendStatus = false; friend.MenuIsEnabled = true; } foreach (FamilyViewModel family in this.AllFamilys.Where(f => f.FriendID == receiveMsgOrder.MsgContent)) { family.FriendStatus = false; family.MenuIsEnabled = true; } break; #endregion #region 好友下线通知_OFF case MessageTypes.OFF: foreach (FriendViewModel friend in this.AllFriends.Where(f => f.FriendID == receiveMsgOrder.MsgContent)) { friend.FriendStatus = true; friend.MenuIsEnabled = false; } foreach (FamilyViewModel family in this.AllFamilys.Where(f => f.FriendID == receiveMsgOrder.MsgContent)) { family.FriendStatus = true; family.MenuIsEnabled = false; } break; #endregion #region 询问好友添加请求_ASK case MessageTypes.ASK: string msginfo1 = MessageTypes.F + "," + GetString.GetRandomCode(GetString.Code.StrAndNum, 4) + "," + msg[0]; _msgModel = MsgModel.CreateModel(msginfo1, MessageTypes.F, "请求添加您为好友.", "", msg[1]); msgList.Add(new MsgViewModel(_msgModel)); this.Message++; ChangePage(this._pagingMsg.CurrentPage == 0 ? 1 : this._pagingMsg.CurrentPage, Paging.MSG, this._pagingMsg); break; #endregion #region 返回查找好友资料进行添加_AGR case MessageTypes.AGR: //添加信息提示 string msginfo2 = MessageTypes.T + "," + GetString.GetRandomCode(GetString.Code.StrAndNum, 4); _msgModel = MsgModel.CreateModel(msginfo2, MessageTypes.T, "对方同意您的添加请求.", "", msg[1]); msgList.Add(new MsgViewModel(_msgModel)); this.Message++; ChangePage(this._pagingMsg.CurrentPage == 0 ? 1 : this._pagingMsg.CurrentPage, Paging.MSG, this._pagingMsg); //添加好友 _friendModel = FriendModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[5], msg[4] == MessageTypes.N ? true : false, msg[4] == MessageTypes.N ? false : true); this.AllFriends.Add(new FriendViewModel(_friendModel)); this.Friend++; //添加信息提示 string msginfo3 = MessageTypes.T + "," + GetString.GetRandomCode(GetString.Code.StrAndNum, 4); _msgModel = MsgModel.CreateModel(msginfo3, MessageTypes.T, "新的好友添加成功.", "", "系统"); msgList.Add(new MsgViewModel(_msgModel)); this.Message++; ChangePage(this._pagingMsg.CurrentPage == 0 ? 1 : this._pagingMsg.CurrentPage, Paging.MSG, this._pagingMsg); break; #endregion #region 返回查找好友资料进行添加_AFR case MessageTypes.AFR: //添加好友信息 _friendModel = FriendModel.CreateModel(msg[0], msg[1], msg[2], msg[3], msg[5], msg[4] == MessageTypes.N ? true : false, msg[4] == MessageTypes.N ? false : true); this.AllFriends.Add(new FriendViewModel(_friendModel)); this.Friend++; //添加信息提示 string msginfo4 = MessageTypes.T + "," + GetString.GetRandomCode(GetString.Code.StrAndNum, 4); _msgModel = MsgModel.CreateModel(msginfo4, MessageTypes.T, "新的好友添加成功.", "", "系统"); msgList.Add(new MsgViewModel(_msgModel)); this.Message++; ChangePage(this._pagingMsg.CurrentPage == 0 ? 1 : this._pagingMsg.CurrentPage, Paging.MSG, this._pagingMsg); break; #endregion #region 对方将自己删除,此处也将对方删除_DFR case MessageTypes.DFR: foreach (FriendViewModel friend in this.AllFriends) { if (friend.FriendID == receiveMsgOrder.MsgContent) { this.AllFriends.Remove(friend); break; } } if (this.Friend > 0) { this.Friend--; } break; #endregion #region 返回移动好友结果,本地进行移动_MFR case MessageTypes.MFR: switch (msg[1]) { #region 该好友原来在“我的好友”组 case MessageTypes.Friend: foreach (FriendViewModel friend in this.AllFriends) { if (friend.FriendID == msg[0]) { //从该组移除 this.AllFriends.Remove(friend); switch (msg[2]) { //现移动到“我的家族” case MessageTypes.Family: _familyModel = FamilyModel.CreateModel(friend.FriendID, friend.FriendCard, friend.FriendName, friend.FriendImg, MessageTypes.Family, friend.FriendStatus, friend.MenuIsEnabled); this.AllFamilys.Add(new FamilyViewModel(_familyModel)); break; //现移动到“黑名单” case MessageTypes.Black: _blackModel = BlackModel.CreateModel(friend.FriendID, friend.FriendCard, friend.FriendName, friend.FriendImg, MessageTypes.Black, friend.FriendStatus, false); this.AllBlacks.Add(new BlackViewModel(_blackModel)); break; } break; } } break; #endregion #region 该好友原来在“我的家族”组 case MessageTypes.Family: foreach (FamilyViewModel family in this.AllFamilys) { if (family.FriendID == msg[0]) { //从该组移除 this.AllFamilys.Remove(family); switch (msg[2]) { //现移动到“我的好友” case MessageTypes.Friend: _friendModel = FriendModel.CreateModel(family.FriendID, family.FriendCard, family.FriendName, family.FriendImg, MessageTypes.Friend, family.FriendStatus, family.MenuIsEnabled); this.AllFriends.Add(new FriendViewModel(_friendModel)); break; //现移动到“黑名单” case MessageTypes.Black: _blackModel = BlackModel.CreateModel(family.FriendID, family.FriendCard, family.FriendName, family.FriendImg, MessageTypes.Black, family.FriendStatus, false); this.AllBlacks.Add(new BlackViewModel(_blackModel)); break; } break; } } break; #endregion #region 该好友原来在“黑名单”组 case MessageTypes.Black: foreach (BlackViewModel black in this.AllBlacks) { if (black.FriendID == msg[0]) { //从该组移除 this.AllBlacks.Remove(black); switch (msg[2]) { //现移动到“我的好友” case MessageTypes.Friend: _friendModel = FriendModel.CreateModel(black.FriendID, black.FriendCard, black.FriendName, black.FriendImg, MessageTypes.Friend, black.FriendStatus, !black.FriendStatus); this.AllFriends.Add(new FriendViewModel(_friendModel)); break; //现移动到“我的家族” case MessageTypes.Family: _familyModel = FamilyModel.CreateModel(black.FriendID, black.FriendCard, black.FriendName, black.FriendImg, MessageTypes.Friend, black.FriendStatus, !black.FriendStatus); this.AllFamilys.Add(new FamilyViewModel(_familyModel)); break; } break; } } break; #endregion } break; #endregion } //MessageBox.Show(receiveMsgOrder.MsgContent); //ReceiveMsgEvent msgEvent = receive_Aggregator.GetEvent<ReceiveMsgEvent>(); //if (subscriptionToken != null) // msgEvent.Unsubscribe(subscriptionToken); }
public void SetContent(FamilyModel familyModel, int type) { this.mFamilyModel = familyModel; mTexture2DTransfer = mResLoader.LoadSync <Texture2D>("toggle_transfer_sel"); mTexture2DSubtract = mResLoader.LoadSync <Texture2D>("toggle_subtract_sel"); mTexture2DFather = mResLoader.LoadSync <Texture2D>("ic_head_father"); mTexture2DMother = mResLoader.LoadSync <Texture2D>("ic_head_mother"); mTexture2DGrandFather = mResLoader.LoadSync <Texture2D>("ic_head_grand_father"); mTexture2DGrandMother = mResLoader.LoadSync <Texture2D>("ic_head_grand_mother"); mTexture2DBrother = mResLoader.LoadSync <Texture2D>("ic_head_brother"); mTexture2DSister = mResLoader.LoadSync <Texture2D>("ic_head_sister"); if (familyModel.logoUrl.IsNotNullAndEmpty()) { ImageDownloadUtils.Instance.SetAsyncImage(familyModel.logoUrl, ImgHead); } else if (familyModel.babyRelation.Equals("父亲")) { ImgHead.sprite = Sprite.Create(mTexture2DFather, new Rect(0, 0, mTexture2DFather.width, mTexture2DFather.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("母亲")) { ImgHead.sprite = Sprite.Create(mTexture2DMother, new Rect(0, 0, mTexture2DMother.width, mTexture2DMother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("祖父")) { ImgHead.sprite = Sprite.Create(mTexture2DGrandFather, new Rect(0, 0, mTexture2DGrandFather.width, mTexture2DGrandFather.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("祖母")) { ImgHead.sprite = Sprite.Create(mTexture2DGrandMother, new Rect(0, 0, mTexture2DGrandMother.width, mTexture2DGrandMother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("哥哥")) { ImgHead.sprite = Sprite.Create(mTexture2DBrother, new Rect(0, 0, mTexture2DBrother.width, mTexture2DBrother.height), Vector2.one * 0.5f); } else if (familyModel.babyRelation.Equals("姐姐")) { ImgHead.sprite = Sprite.Create(mTexture2DSister, new Rect(0, 0, mTexture2DSister.width, mTexture2DSister.height), Vector2.one * 0.5f); } TextMobile.text = familyModel.mobile; if (familyModel.id == PlayerPrefsUtil.GetUserId()) { TextRelation.text = "我"; } else { TextRelation.text = mFamilyModel.babyRelation; } //0:移除,1:转让 if (type == 0) { Checkmark.sprite = Sprite.Create(mTexture2DSubtract, new Rect(0, 0, mTexture2DSubtract.width, mTexture2DSubtract.height), Vector2.one * 0.5f); } else { Checkmark.sprite = Sprite.Create(mTexture2DTransfer, new Rect(0, 0, mTexture2DTransfer.width, mTexture2DTransfer.height), Vector2.one * 0.5f); } }
public dlwsController(IOptions <AppSettings> appSettings, IOptions <FamilyModel> familyModel) { _appSettings = appSettings.Value; _familyModel = familyModel.Value; }
/// <summary> /// load families from external storage. /// </summary> /// <param name="familyRepository"> /// The family repository. /// </param> /// <returns> /// Flag indicating if the family data was loaded. /// </returns> public async Task <bool> LoadFamiliesAsync() { // RepositoryModelType<FamilyModel, HLinkFamilyModel> await DataStore.CN.MajorStatusAdd("Loading Family data").ConfigureAwait(false); { // Load notes try { // Run query var de = from el in localGrampsXMLdoc.Descendants(ns + "family") select el; // get family fields TODO // Loop through results to get the Families foreach (XElement familyElement in de) { FamilyModel loadFamily = DV.FamilyDV.NewModel(); // Family attributes loadFamily.LoadBasics(GetBasics(familyElement)); //loadFamily.Id = (string)familyElement.Attribute("id"); ////if (loadFamily.Id == "F0152") ////{ ////} //loadFamily.Handle = (string)familyElement.Attribute("handle"); //loadFamily.Change = GetDateTime((string)familyElement.Attribute("change")); //loadFamily.Priv = SetPrivateObject((string)familyElement.Attribute("priv")); // Family fields // relationship type XElement tempRelationship = familyElement.Element(ns + "rel"); if (tempRelationship != null) { loadFamily.GFamilyRelationship = (string)tempRelationship.Attribute("type"); } // father element XElement tempFather = familyElement.Element(ns + "father"); if (tempFather != null) { loadFamily.GFather.HLinkKey = (string)tempFather.Attribute("hlink"); } // mother element XElement tempMother = familyElement.Element(ns + "mother"); if (tempMother != null) { loadFamily.GMother.HLinkKey = (string)tempMother.Attribute("hlink"); } // ChildRef loading var thisORElement = from thisORElementEl in familyElement.Descendants(ns + "childref") select thisORElementEl; if (thisORElement.Any()) { // load child object references foreach (XElement thisLoadORElement in thisORElement) { HLinkPersonModel t = new HLinkPersonModel { // load the hlink HLinkKey = (string)thisLoadORElement.Attribute("hlink"), }; loadFamily.GChildRefCollection.Add(t); } } // Citation References loadFamily.GCitationRefCollection = GetCitationCollection(familyElement); // Event References loadFamily.GEventRefCollection = GetEventCollection(familyElement); // ObjectRef loading loadFamily.GMediaRefCollection = await GetObjectCollection(familyElement).ConfigureAwait(false); loadFamily.GNoteRefCollection = GetNoteCollection(familyElement); loadFamily.GTagRefCollection = GetTagCollection(familyElement); // set the Home image or symbol now that everything is laoded loadFamily = SetHomeImage(loadFamily); // save the family DV.FamilyDV.FamilyData.Add(loadFamily); localGrampsCommonLogging.LogVariable("Family Name", loadFamily.Handle); } } catch (Exception e) { // TODO handle this await DataStore.CN.MajorStatusAdd(e.Message).ConfigureAwait(false); throw; } } // now let everyone know that we have finished await DataStore.CN.MajorStatusDelete().ConfigureAwait(false); return(true); }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// Task. /// </returns> public override void PopulateViewModel() { FamilyObject = DV.FamilyDV.GetModelFromHLink(BaseNavParamsHLink); if (!(FamilyObject is null)) { BaseTitle = FamilyObject.FamilyDisplayName; BaseTitleIcon = CommonConstants.IconFamilies; // Get media image HLinkHomeImageModel personImage = FamilyObject.HomeImageHLink; Contract.Assert(FamilyObject.HomeImageHLink != null, FamilyObject.Id); personImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(personImage); // Get basic details CardGroup t = new CardGroup { Title = "Header Details" }; t.Add(new CardListLineCollection { new CardListLine("Card Type:", "Family Detail"), new CardListLine("Family Display Name:", FamilyObject.FamilyDisplayName), new CardListLine("Family Relationship:", FamilyObject.GFamilyRelationship), new CardListLine("Father Name:", FamilyObject.GFather.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), new CardListLine("Mother Name:", FamilyObject.GMother.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), }); // Add Model details t.Add(DV.FamilyDV.GetModelInfoFormatted(FamilyObject)); // Add parent link t.Add(new ParentLinkModel { Parents = localFamilyModel, }); BaseDetail.Add(t); // Detail reference BaseDetail.Add(FamilyObject.GEventRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GChildRefCollection.GetCardGroup()); // TODO , "Children"); BaseDetail.Add(FamilyObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GAttributeCollection); BaseDetail.Add(FamilyObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.BackHLinkReferenceCollection.GetCardGroup()); string outFamEvent; if (FamilyObject.GEventRefCollection.Count > 0) { // TODO Handle this outFamEvent = FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GType + ": " + FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GDate.ShortDate; } // TODO localActivitySession = await CommonTimeline.AddToTimeLine("Family", // localFamilyModel, localFamilyModel.HomeImageHLink.DeRef.MediaStorageFilePath, // "Family: " + localFamilyModel.FamilyDisplayName, outFamEvent).ConfigureAwait(false); // TODO //CommonTimeline.FinishActivitySessionAsync(localActivitySession); } } }
public IHttpActionResult Post(FamilyModel baseRequest) { var response = service.SaveFamily(baseRequest); return(Ok(response)); }
public dlwsController(IOptions <AppSettings> appSettings, IOptions <FamilyModel> familyModel, ILoggerFactory logger) { _appSettings = appSettings.Value; _familyModel = familyModel.Value; _logger = logger.CreateLogger("dlwsController"); }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// Task. /// </returns> public override void PopulateViewModel() { FamilyObject = DV.FamilyDV.GetModelFromHLink(BaseNavParamsHLink); if (!(FamilyObject is null)) { BaseTitle = FamilyObject.FamilyDisplayName; BaseTitleIcon = CommonConstants.IconFamilies; // Trigger refresh of View fields via INotifyPropertyChanged RaisePropertyChanged(string.Empty); // Get basic details //CardGroup t = new CardGroup { Title = "Header Details" }; BaseDetail.Add(new CardListLineCollection { new CardListLine("Card Type:", "Family Detail"), new CardListLine("Family Display Name:", FamilyObject.FamilyDisplayName), new CardListLine("Family Relationship:", FamilyObject.GFamilyRelationship), new CardListLine("Father Name:", FamilyObject.GFather.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), new CardListLine("Mother Name:", FamilyObject.GMother.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), }); // Add Model details BaseDetail.Add(DV.FamilyDV.GetModelInfoFormatted(FamilyObject)); // Add parent link BaseDetail.Add(new ParentLinkModel { Parents = localFamilyModel, }); //BaseDetail.Add(t); // Detail reference //BaseDetail.Add(FamilyObject.GEventRefCollection.GetCardGroup()); //BaseDetail.Add(FamilyObject.GChildRefCollection.GetCardGroup()); // TODO , "Children"); //BaseDetail.Add(FamilyObject.GCitationRefCollection.GetCardGroup()); //BaseDetail.Add(FamilyObject.GMediaRefCollection.GetCardGroup()); //BaseDetail.Add(FamilyObject.GNoteRefCollection.GetCardGroup()); //BaseDetail.Add(FamilyObject.GAttributeCollection); //BaseDetail.Add(FamilyObject.GTagRefCollection.GetCardGroup()); string outFamEvent; if (FamilyObject.GEventRefCollection.Count > 0) { // TODO Handle this outFamEvent = FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GType + ": " + FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GDate.ShortDate; } // TODO localActivitySession = await CommonTimeline.AddToTimeLine("Family", // localFamilyModel, localFamilyModel.HomeImageHLink.DeRef.MediaStorageFilePath, // "Family: " + localFamilyModel.FamilyDisplayName, outFamEvent).ConfigureAwait(false); // TODO //CommonTimeline.FinishActivitySessionAsync(localActivitySession); } _PlatformSpecific.ActivityTimeLineAdd(FamilyObject); } }
public ActionResult RelatedFamilies(int id) { var m = new FamilyModel(id); return(View("Family/Related", m)); }
private Model GetFamilyData() { var model = new FamilyModel { Name = _name, Filepath = _filePath }; //todo var fam = _fam; var doc = _doc; var paramSet = fam.Parameters.ForwardIterator(); //var paramList = new List<ElementParameter>(); while (paramSet.MoveNext()) { var p = (Parameter)paramSet.Current; var name = p.Definition.Name; var value = ParameterUtils.ParameterToString(doc, p); if (String.IsNullOrWhiteSpace(value)) { value = "空"; } var mfP = new ElementParameter { Id = p.Id.IntegerValue, Name = name, Value = value }; if (p.IsShared) { mfP.Guid = p.GUID.ToString(); } model.Parameters.Add(mfP); } var type = doc.FamilyManager.CurrentType; var famParams = doc.FamilyManager.Parameters; //var typeParamList = new List<ElementParameter>(); if (famParams != null) { var famIter = famParams.ForwardIterator(); while (famIter.MoveNext()) { var p = (FamilyParameter)famIter.Current; var pDef = p.Definition; var name = pDef.Name; var value = ParameterUtils.ParameterToString(doc, p, type); if (String.IsNullOrWhiteSpace(value)) { value = "空"; } var param = new ElementParameter { Id = p.Id.IntegerValue, Name = name, Value = value }; if (p.IsShared) { param.Guid = p.GUID.ToString(); } model.FamParameters.Add(param); } } Category cate = null; if (fam.Category != null) { cate = fam.Category; } if (fam.FamilyCategory != null) { cate = fam.FamilyCategory; } if (cate != null) { model.Category = new ElementCategory { Id = cate.Id.IntegerValue, Name = cate.Name }; } model.Family = fam.GetFamily(doc); return(_model = model); }
public BaseResponse <FamilyModel> SaveFamily(FamilyModel request) { return(base.Save <DC_Family, FamilyModel>(request, (q) => q.ID == request.ID)); }
/// <summary> /// load families from external storage. /// </summary> /// <param name="familyRepository"> /// The family repository. /// </param> /// <returns> /// Flag indicating if the family data was loaded. /// </returns> public async Task <bool> LoadFamiliesAsync() { // RepositoryModelType<FamilyModel, HLinkFamilyModel> _iocCommonNotifications.DataLogEntryAdd("Loading Family data"); { // Load notes try { // Run query var de = from el in localGrampsXMLdoc.Descendants(ns + "family") select el; // get family fields TODO // Loop through results to get the Families foreach (XElement familyElement in de) { FamilyModel loadFamily = new FamilyModel(); // Family attributes loadFamily.LoadBasics(GetBasics(familyElement)); if (loadFamily.Id == "F0151") { } // Family fields // relationship type XElement tempRelationship = familyElement.Element(ns + "rel"); if (tempRelationship != null) { loadFamily.GFamilyRelationship = (string)tempRelationship.Attribute("type"); } // father element XElement tempFather = familyElement.Element(ns + "father"); if (tempFather != null) { loadFamily.GFather.HLinkGlyphItem.ImageType = Common.CommonEnums.HLinkGlyphType.TempLoading; loadFamily.GFather.HLinkKey = new HLinkKey((string)tempFather.Attribute("hlink")); } // mother element XElement tempMother = familyElement.Element(ns + "mother"); if (tempMother != null) { loadFamily.GMother.HLinkGlyphItem.ImageType = Common.CommonEnums.HLinkGlyphType.TempLoading; loadFamily.GMother.HLinkKey = new HLinkKey((string)tempMother.Attribute("hlink")); } loadFamily.GDate = GetDate(familyElement.Element(ns + "date")); loadFamily.GAttributeCollection = GetAttributeCollection(familyElement); loadFamily.GChildRefCollection = GetChildRefCollection(familyElement); // Citation References loadFamily.GCitationRefCollection = GetCitationCollection(familyElement); // Event References loadFamily.GEventRefCollection = GetEventCollection(familyElement); loadFamily.GLDSOrdCollection = GetLDSOrdCollection(familyElement); // ObjectRef loading loadFamily.GMediaRefCollection = await GetObjectCollection(familyElement).ConfigureAwait(false); loadFamily.GNoteRefCollection = GetNoteCollection(familyElement); loadFamily.GTagRefCollection = GetTagCollection(familyElement); // set the Home image or symbol now that everything is laoded loadFamily = SetHomeImage(loadFamily); // save the family DV.FamilyDV.FamilyData.Add(loadFamily); _iocCommonLogging.LogVariable("Family Name", loadFamily.HLinkKey.Value); } } catch (Exception e) { // TODO handle this _iocCommonNotifications.DataLogEntryAdd(e.Message); throw; } } _iocCommonNotifications.DataLogEntryReplace("Family load complete"); return(true); }