public ActionResult signup(string username) { Father f = new Father(); f.username = username; f.last_login = DateTime.Now; if (ModelState.IsValid == true) { sc.Fathers.Add(f); sc.SaveChanges(); Session["user"] = username; Session["id"] = f.f_id; return(RedirectToAction("StudentList", "Students")); } else { return(null); } }
public void FlattenFatherSonDtoForGrandsonDtoForgetFlattenSimpleClassOk() { //SETUP //Mapper.Register<Grandson, FlattenSimpleClass>(); //If you don't supply the mapping it does not happen Mapper.Register <Father, FlattenFatherSonDtoForGrandsonDto>() .Flatten(); Mapper.Compile(CompilationTypes.Source); //ATTEMPT var father = Father.CreateOne(); var dto = Mapper.Map <Father, FlattenFatherSonDtoForGrandsonDto>(father); //VERIFY Assert.AreEqual("Father", dto.MyString); //This is mapped by the normal ExpressMapper Assert.AreEqual(1, dto.MyInt); //This is mapped by the normal ExpressMapper Assert.AreEqual("Son", dto.SonMyString); Assert.AreEqual(2, dto.SonMyInt); Assert.AreEqual(null, dto.SonGrandson); }
public void FlattenFatherSonGrandsonLowerCaseDtoCaseSensativeOk() { //SETUP Mapper.Register <Father, FlattenFatherSonGrandsonLowerCaseDto>() .CaseSensitive(true) .Flatten(); Mapper.Compile(CompilationTypes.Source); //ATTEMPT var dto = Mapper.Map <Father, FlattenFatherSonGrandsonLowerCaseDto>(Father.CreateOne()); //VERIFY Assert.AreEqual(null, dto.mystring); //This is mapped by the normal ExpressMapper Assert.AreEqual(0, dto.myInt); //This is mapped by the normal ExpressMapper Assert.AreEqual(null, dto.sonMyString); Assert.AreEqual(0, dto.Sonmyint); Assert.AreEqual(null, dto.SongrandsonmYstring); Assert.AreEqual(null, dto.sonGrandsonMyInt); }
public int GetSiblingIndex() { Transform father = Father.FindObject(File); if (father == null) { return(0); } for (int i = 0; i < father.Children.Count; i++) { PPtr <Transform> child = father.Children[i]; if (child.PathID == PathID) { return(i); } } throw new Exception("Transorm hasn't been found among father's children"); }
public void FlattenFatherSonGrandsonDtoCaseSensativeOk() { //SETUP Mapper.Register <Father, FlattenFatherSonGrandsonDto>().CaseSensitive(true) .Flatten(); Mapper.Compile(CompilationTypes.Source); //ATTEMPT var father = Father.CreateOne(); var dto = Mapper.Map <Father, FlattenFatherSonGrandsonDto>(father); //VERIFY Assert.AreEqual("Father", dto.MyString); //This is mapped by the normal ExpressMapper Assert.AreEqual(1, dto.MyInt); //This is mapped by the normal ExpressMapper Assert.AreEqual("Son", dto.SonMyString); Assert.AreEqual(2, dto.SonMyInt); Assert.AreEqual("Grandson", dto.SonGrandsonMyString); Assert.AreEqual(3, dto.SonGrandsonMyInt); }
public void upFamilyTree() { if (Father == null && Mother == null) { Console.WriteLine("Family Name: " + lastName + "\n"); downFamilyTree("-"); } else { if (Father != null) { Father.upFamilyTree(); } else if (Mother != null) { upFamilyTree(); } } }
public void TestMethod4() { Father father = new Father(); father.Walking(1, 2); //父类出现的地方,子类就可以出现 Son son = new Son(); son.Walking(1, 2); son.Walking("走路"); Father son2 = new Son(); son2.Walking(1, 2); //运行结果 //a + b = 3 //a + b = 3 //I 'am 走路 //a + b = 3 }
public override void AfterPlayerArrived() { if (PlayerScan.instance.progressStatus == ProgressStatus.E_GiveBackMirrorToTree) { Father father = ObjectManager.GetObject <Father>(); father.gameObject.SetActive(true); ObjectManager.GetObject <CashCard>().gameObject.SetActive(true); livingRoom.sprite = nightLivingRoomSprite; List <KeyValuePair <GameObject, string> > list = new List <KeyValuePair <GameObject, string> >(); GameObject player = GameManager.instance.player; list.Add(new KeyValuePair <GameObject, string>(player, "chapter_0_0")); list.Add(new KeyValuePair <GameObject, string>(father.gameObject, "chapter_0_1")); list.Add(new KeyValuePair <GameObject, string>(father.gameObject, "chapter_0_2")); list.Add(new KeyValuePair <GameObject, string>(father.gameObject, "chapter_0_3")); list.Add(new KeyValuePair <GameObject, string>(father.gameObject, "chapter_0_4")); DialogueManager.instance.ShowDialogueBallon(list); ObjectManager.GetObject <Front>().CanPass(false); // 못나가게 막기 PlayerScan.instance.progressStatus = ProgressStatus.E_TalkWithCurrentDad; } }
/// <summary> /// Сформировать информацию о ребенке /// </summary> /// <returns></returns> public override string FormInfoAboutPerson() { var infoAboutPerson = base.FormInfoAboutPerson() + $"\nНазвание детского сада или школы: " + $"{KindergardenOrSchool}"; if (Mother != null) { infoAboutPerson += $"\nМать:" + $" {Mother.FormShortInfoAboutPerson()}"; } if (Father != null) { infoAboutPerson += $"\nОтец:" + $" {Father.FormShortInfoAboutPerson()}"; } return(infoAboutPerson); }
public override void Read(AssetReader reader) { base.Read(reader); LocalRotation.Read(reader); LocalPosition.Read(reader); LocalScale.Read(reader); Children = reader.ReadAssetArray <PPtr <Transform> >(); Father.Read(reader); #if UNIVERSAL if (HasRootOrder(reader.Version, reader.Flags)) { RootOrder = reader.ReadInt32(); } if (HasLocalEulerAnglesHint(reader.Version, reader.Flags)) { LocalEulerAnglesHint.Read(reader); } #endif }
protected override void Setup() { Context.Set <Father>().Add(Father.CreateOne(1)); //Father->Son->Grandson var fatherWithoutGrandson = Father.CreateOne(2); fatherWithoutGrandson.Son.Grandson = null; Context.Set <Father>().Add(fatherWithoutGrandson); //Father->Son Context.Set <FatherSons>().Add(FatherSons.CreateOne()); //FatherSons->5 Sons Context.SaveChanges(); Mapper.Register <Father, FlattenFatherSonGrandsonDto>().Flatten(); Mapper.Register <FatherSons, FlattenFatherSonsCountDto>().Flatten(); Mapper.Register <Grandson, FlattenSimpleClass>(); Mapper.Register <Father, FlattenFatherSonDtoForGrandsonDto>() .Flatten(); Mapper.Compile(CompilationTypes.Source); }
public void TestMethod1() { AbstractHandler father = new Father(); AbstractHandler husband = new Husband(); AbstractHandler son = new Son(); father.SetNext(husband); husband.SetNext(son); Random random = new Random(); for (int i = 0; i < 160; i++) { IWomen women = new Women((WomenLevelEnum)random.Next(0, 3), "我要出去玩"); father.HandleMessage(women); } // --Alone 没有地方请示,按不同意处理-- //Father 同意 Daughter 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //Husband 同意 Wife 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //--Alone 没有地方请示,按不同意处理-- //Husband 同意 Wife 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //--Alone 没有地方请示,按不同意处理-- //Father 同意 Daughter 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //--Alone 没有地方请示,按不同意处理-- //-- Alone 没有地方请示,按不同意处理-- //-- Alone 没有地方请示,按不同意处理-- //-- Alone 没有地方请示,按不同意处理-- //Husband 同意 Wife 我要出去玩 的请求 //Husband 同意 Wife 我要出去玩 的请求 //Husband 同意 Wife 我要出去玩 的请求 //Father 同意 Daughter 我要出去玩 的请求 //Husband 同意 Wife 我要出去玩 的请求 //-- Alone 没有地方请示,按不同意处理-- //-- Alone 没有地方请示,按不同意处理-- }
public override void Read(AssetReader reader) { base.Read(reader); LocalRotation.Read(reader); LocalPosition.Read(reader); LocalScale.Read(reader); Children = reader.ReadAssetArray <PPtr <Transform> >(); Father.Read(reader); #if UNIVERSAL TransformLayout layout = reader.Layout.Transform; if (layout.HasRootOrder) { RootOrder = reader.ReadInt32(); } if (layout.HasLocalEulerAnglesHint) { LocalEulerAnglesHint.Read(reader); } #endif }
//------------------------------------------------- #region public Overrided Methods Region public override void AnimationFactoryWorker(object sender, EventArgs e) { MapElement mapElement = null; for (int i = 0; i < TheMap.MapElements.Length; i++) { mapElement = TheMap.MapElements[i]; if (mapElement.ElementLocationF.X >= Father.Width) { mapElement.SetElementLocation(0 - mapElement.Width, UnlimitedRandomicWorks[1].GetNumber()); } else { mapElement.SetElementLocation( mapElement.ElementLocationF.X + CloudMovesRate, mapElement.ElementLocationF.Y); } } Father.Refresh(); }
public override void Write(AssetWriter writer) { base.Write(writer); LocalRotation.Write(writer); LocalPosition.Write(writer); LocalScale.Write(writer); Children.Write(writer); Father.Write(writer); #if UNIVERSAL TransformLayout layout = writer.Layout.Transform; if (layout.HasRootOrder) { writer.Write(RootOrder); } if (layout.HasLocalEulerAnglesHint) { LocalEulerAnglesHint.Write(writer); } #endif }
public static FamilyMember CreateFakeFamilyMember(FamilyMemberType type) { var faker = new Faker("en"); switch (type) { case FamilyMemberType.FATHER: var father = new Father { FirstName = faker.Name.FirstName(Bogus.DataSets.Name.Gender.Male), LastName = faker.Name.LastName() }; return(father); case FamilyMemberType.MOTHER: var mother = new Mother { FirstName = faker.Name.FirstName(Bogus.DataSets.Name.Gender.Female), LastName = faker.Name.LastName() }; return(mother); case FamilyMemberType.CHILD: var child = new Child { FirstName = faker.Name.FirstName(), LastName = faker.Name.LastName() }; return(child); case FamilyMemberType.RELATIVE: var relative = new Relative { FirstName = faker.Name.FirstName(), LastName = faker.Name.LastName() }; return(relative); } return(null); }
private string DataFormat(int Order) { string values = null; int max = (4 * (Order - 1)) / 3; if (Father.Equals(Util.NullPointer)) { for (int i = 0; i < max; i++) { values = values + $"{Data[i].ToFixedSizeString()}" + Util.Separator.ToString(); // FixedSize del T + 1 } } else { for (int i = 0; i < Order - 1; i++) { values = values + $"{Data[i].ToFixedSizeString()}" + Util.Separator.ToString(); // FixedSize del T + 1 } } return(values); }
private string ChildrensFormat(int Order) { string Children = ""; int max = (4 * (Order - 1)) / 3; if (Father.Equals(Util.NullPointer)) { for (int i = 0; i < max + 1; i++) { Children = Children + $"{this.Children[i].ToString("0000000000;-000000000")}" + Util.Separator.ToString(); // 10 caracteres + 1 } } else { for (int i = 0; i < Order; i++) { Children = Children + $"{this.Children[i].ToString("0000000000;-000000000")}" + Util.Separator.ToString(); // 10 caracteres + 1 } } return(Children); }
public void InsideMouseLeftOnceDown() { if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == true) { IMLOD_already = false; } if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == true && IMLOD_already) { event_InsideMouseLeftOnceDown(); IMLOD_already = false; } if (InputStatus.GetButton(InputProperty.LeftButton) == false && Father.Contain(Gui.Position)) { IMLOD_already = true; } }
public Character(CharacterName characterName, Age age, Parents parents, Mother mother, Father father, Appearance appearance, Race race, LifeEvents lifeEvents, Childhood childhood, Adolescence adolescence, Adulthood adulthood, OldAge elder, Profession profession, RelationshipStatus relationshipStatus, Stats stats, Role role, Demeanor demeanor, Gender gender, PlaceOfResidence placeOfResidence, NullChatMenuComponent nullChatMenuComponent) { this.characterName = characterName; this.age = age; this.parents = parents; this.mother = mother; this.father = father; this.appearance = appearance; this.race = race; this.lifeEvents = lifeEvents; this.childhood = childhood; this.adolescence = adolescence; this.adulthood = adulthood; this.elder = elder; this.profession = profession; this.relationshipStatus = relationshipStatus; this.stats = stats; this.role = role; this.demeanor = demeanor; this.gender = gender; this.placeOfResidence = placeOfResidence; this.nullChatMenuComponent = nullChatMenuComponent; }
public void PostInitialise() { if (Mother != null) { Mother.AddChild(this); } if (Father != null) { Father.AddChild(this); } if (Religion == null) { Religion = Capital?.Province?.Religion ?? (DynastyID == 0 ? null : World.CK2Dynasties[DynastyID].Religion); } if (Culture == null) { Culture = Capital?.Province?.Culture ?? (DynastyID == 0 ? null : World.CK2Dynasties[DynastyID].Culture); if (ID == 1522394) { Console.WriteLine( ); } } }
public override void UpdateHasOpenNode() { bool hasOpenNode = false; for (int i = 0; i < NumOfSons(); i++) { if (_sons[i].HasOpenNode()) { hasOpenNode = true; break; } } if (this._hasOpenNode != hasOpenNode) { this._hasOpenNode = hasOpenNode; if (Father != null) { Father.UpdateHasOpenNode(); } } }
public override void BeingRemoved() { // we need to fix the relationship with other people in the model var household = Family.Household; var personsInFamily = Family.Persons; Family.RemovePerson(this); Family = null; Father?.RemoveChild(this); Mother?.RemoveChild(this); Spouse?.RemoveSpouse(this); foreach (var sibling in Siblings) { sibling.RemoveSibling(this); } foreach (var child in Children) { child.RemoveParent(this); } foreach (var job in Jobs) { job.OwnerRemoved(); } }
public void ResolveShouldShowTheCorrectGrandchildName() { //var builder = new ContainerBuilder(); //builder.RegisterType<Grandfather>().As<IGrandfather>(); //builder.RegisterType<Father>().As<IFather>(); //builder.RegisterType<Son>().As<ISon>(); //builder.RegisterType<Logic>(); //var container = builder.Build(); //var logic = container.Resolve<Logic>(); var son = new Son(); var father = new Father(); var grandfather = new Grandfather(); father.Son = son; grandfather.Son = father; var logic = new Logic(grandfather, father, son); Assert.AreEqual("I am my father's son and my grandfather's grandson. - I am my father's son and my grandfather's grandson.", logic.Run("S")); }
public override int GetHashCode() { int hash = 17; hash = hash * 23 + Id.GetHashCode(); hash = hash * 23 + Name.GetHashCode(); hash = hash * 23 + Culture.GetHashCode(); hash = hash * 23 + Titles.GetHashCode(); hash = hash * 23 + OtherTitles.GetHashCode(); hash = hash * 23 + Aliases.GetHashCode(); hash = hash * 23 + Born.GetHashCode(); hash = hash * 23 + Died.GetHashCode(); hash = hash * 23 + Father.GetHashCode(); hash = hash * 23 + Mother.GetHashCode(); hash = hash * 23 + Spouse.GetHashCode(); hash = hash * 23 + Children.GetHashCode(); hash = hash * 23 + Allegiances.GetHashCode(); hash = hash * 23 + Books.GetHashCode(); hash = hash * 23 + PovBooks.GetHashCode(); hash = hash * 23 + PlayedBy.GetHashCode(); hash = hash * 23 + TvSeries.GetHashCode(); return(hash); }
static void Inheritence() { GrandFather surya = new GrandFather("Surya"); Father Chandra = new Father("Chandra", "Jung"); Uncle Hari = new Uncle("Hari"); Me Shyam = new Me("Shyam"); //Console.WriteLine("Gran Father Details :"); //Console.WriteLine(surya.FirstName); //Console.WriteLine(surya.LastName); //Console.WriteLine("Father's Detail :"); //Console.WriteLine(Chandra.FirstName + " " + Chandra.MiddleName + " " + Chandra.LastName); //Console.WriteLine("Uncle's Detail :"); //Console.WriteLine(Hari.FirstName + " " + Hari.LastName); //Console.WriteLine("My Details : "); //Console.WriteLine(Shyam.FirstName + " " + Shyam.MiddleName + " " + Shyam.LastName); Console.WriteLine(surya.ToString()); Console.WriteLine(Chandra.ToString()); }
private void CloneStudent_Click(object sender, EventArgs e) { try { if (tabControl1.SelectedIndex == 0) { Student st = (Student)students_list[studentsList.SelectedIndex].Clone(); IMan man = st; studentsList.Items.Add(man.GetParams()); students_list.Add(st); } if (tabControl1.SelectedIndex == 1) { Father fath = (Father)fathers_list[fathersList.SelectedIndex].Clone(); IMan man = fath; fathersList.Items.Add(man.GetParams()); fathers_list.Add(fath); } } catch { MessageBox.Show("Нужно выбрать элемент из списка"); } }
/// <summary> /// 当鼠标以左键按下状态从内部移出范围时 /// </summary> public void MouseDownDragOutside() { if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == true) //鼠标以按下的状态,存在于范围内 { MDDO_IsDown = true; } if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == false && MDDO_IsDown == true && MDDO_Status == true) //鼠标曾以按下的状态,存在于范围内 //此时不在范围内,并且鼠标现在还是按下状态 { event_MouseDownDragOutside(); MDDO_already = true; } if (MDDO_already && InputStatus.GetButton(InputProperty.LeftButton) == false && Father.Contain(Gui.Position) == false) { event_MouseDownDragOutside_MouseUp(); MDDO_already = false; } if (InputStatus.GetButton(InputProperty.LeftButton) == false) { MDDO_IsDown = false; } MDDO_Status = InputStatus.GetButton(InputProperty.LeftButton); }
/// <summary> /// 当鼠标左键以按下状态从外部进入范围内 /// </summary> public void MouseDownDragInside() { if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == false) { MDDI_IsDown = true; //说明是在外面按下的鼠标 } if (InputStatus.GetButton(InputProperty.LeftButton) == true && Father.Contain(Gui.Position) == true && MDDI_IsDown == true && MDDI_Status == true) { event_MouseDownDragInside(); } if (InputStatus.GetButton(InputProperty.LeftButton) == false) { MDDI_IsDown = false; } MDDI_Status = InputStatus.GetButton(InputProperty.LeftButton); }
public void FlattenFatherSonGrandsonDtoNoSon() { //SETUP Mapper.Register <Father, FlattenFatherSonGrandsonDto>() .Flatten(); Mapper.Compile(CompilationTypes.Source); //ATTEMPT var src = new Father { MyString = "Father", MyInt = 1 }; var dto = Mapper.Map <Father, FlattenFatherSonGrandsonDto>(src); //VERIFY Assert.AreEqual("Father", dto.MyString); //This is mapped by the normal ExpressMapper Assert.AreEqual(1, dto.MyInt); //This is mapped by the normal ExpressMapper Assert.AreEqual(null, dto.SonMyString); Assert.AreEqual(0, dto.SonMyInt); Assert.AreEqual(null, dto.SonGrandsonMyString); Assert.AreEqual(null, dto.SonGrandsonMyInt); }
public void Add(Father father) { Down.Add(father); father.Up = this; }