Exemple #1
0
        void IRepository <Women> .Delete(int id)
        {
            var model = Women.FirstOrDefault(x => x.Id == id);

            Women.Remove(model);
            SaveChanges();
        }
Exemple #2
0
        public IActionResult Edit(Women model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                if (model.Id == 0)
                {
                    _repository.Insert(model);
                }
                else
                {
                    _repository.Update(model);
                }

                return(RedirectToAction(nameof(List)));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Women women = db.WomenSet.Find(id);

            db.WomenSet.Remove(women);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "id,name,imageUrl,price")] Women women)
 {
     if (ModelState.IsValid)
     {
         db.Entry(women).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(women));
 }
Exemple #5
0
        static void Main(string[] args)
        {
            Class1.Men man = new Class1.Men();
            man.Eat();
            Women woman = new Women();

            Women.Girl girl = new Women.Girl();
            girl.Speak();
            NameSpacedDemo nameSpacedDemo = new NameSpacedDemo();
        }
 public IActionResult Result(Women womenScore)
 {
     womenScore.courseRating = 74.3;
     womenScore.slopeRating  = 135;
     womenScore.scoreAvg     = (womenScore.score1 + womenScore.score2 + womenScore.score3
                                + womenScore.score4 + womenScore.score5) / 5;
     womenScore.handicap = (womenScore.scoreAvg - womenScore.courseRating) * 113 / womenScore.slopeRating;
     womenScore.handicap = Math.Round(womenScore.handicap, 0);
     return(View(womenScore));
 }
Exemple #7
0
        static void Main0(string[] args)
        {
            Women ws = new Women(5);


            foreach (Woman w in ws)
            {
                Console.WriteLine(w.GetSurName());
            }

            ws.Sort();

            Console.WriteLine("-----------");

            foreach (Woman w in ws)
            {
                Console.WriteLine(w.GetSurName());
            }

            /* Object obj = new Object();
             * WeakReference wr = new WeakReference(obj);
             * obj = null;
             * GC.Collect();
             * obj = (Object)wr.Target;
             * if (obj != null)
             *   Console.WriteLine("Object isn't collected");
             * else
             *   Console.WriteLine("Object is already collected");
             */

            XmlSerializer serializer = new XmlSerializer(typeof(Woman));
            string        xml;

            using (StringWriter stringWriter = new StringWriter())
            {
                Woman w = new Woman()
                {
                    Name = "Alice", Age = 20
                };
                serializer.Serialize(stringWriter, w);
                xml = stringWriter.ToString();
            }

            Console.WriteLine(xml);

            using (StringReader stringReader = new StringReader(xml))
            {
                Woman w = (Woman)serializer.Deserialize(stringReader);
                Console.WriteLine("{0} is {1} years old", w.Name, w.Age);
            }



            Console.ReadKey();
        }
Exemple #8
0
        public ActionResult Create([Bind(Include = "id,name,imageUrl,price")] Women women)
        {
            if (ModelState.IsValid)
            {
                db.WomenSet.Add(women);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(women));
        }
Exemple #9
0
        public void Matching()
        {
            while (Relationships.Count < N)
            {
                //Console.WriteLine("---------\n");
                for (ushort m = 0; m < Men.Count; m++)
                {
                    Person man = Men[m];

                    if (man.IsSingle)
                    {
                        for (ushort p = 0; p < man.Preferences.Count; p++)
                        {
                            Person manPreference = Women.Find(w => w.Name == man.Preferences[p].Name);

                            if (!man.RefusedBy.Contains(manPreference))
                            {
                                //Console.WriteLine($"{man} z {manPreference}: ");

                                if (manPreference.IsSingle)
                                {
                                    man.CreateRelationShip(ref manPreference);
                                    Relationships.Add(man);

                                    //Console.WriteLine("Związali się");

                                    break;
                                }
                                else if (man.IsBetterThanRival(manPreference.RelationshipWith, manPreference))
                                {
                                    Person rival = Men.Find(r => r.Name == manPreference.RelationshipWith.Name);
                                    rival.Deserted(manPreference);
                                    Relationships.Remove(rival);

                                    man.CreateRelationShip(ref manPreference);
                                    Relationships.Add(man);

                                    //Console.WriteLine($"Związali się i zniszczyli życie {rival}");

                                    break;
                                }
                                else
                                {
                                    man.AddRefusedProposal(manPreference);
                                    //Console.WriteLine("Nie zostaną nigdy małżeństwem");
                                }
                            }
                        }
                    }
                }
            }
        }
    // Use this for initialization
    void Start()
    {
        MatchMaker men   = new Men(45, 20000, 99, 0);
        MatchMaker women = new Women(18, 0, 60, 0);

        WomenMatcherMakerMediator mediator = new WomenMatcherMakerMediator(men, women);

        mediator.OfferMenInformation();
        mediator.OfferWomenInformation();

        Debug.Log("男方目前的好感度是" + men.m_favor);
        Debug.Log("nv方目前的好感度是" + women.m_favor);
    }
Exemple #11
0
        // GET: Women/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Women women = db.WomenSet.Find(id);

            if (women == null)
            {
                return(HttpNotFound());
            }
            return(View(women));
        }
    // Start is called before the first frame update
    void Start()
    {
        MatchMaker man   = new Man(35, 100000, 99999, 0);
        MatchMaker woman = new Women(26, 5000, 1000, 0);
        //man.GetInformation(woman);
        //woman.GetInformation(man);
        //Debug.Log("1");
        Introducer introducer = new Introducer(man, woman);

        //introducer.GetManInformation();
        //introducer.GetWomanInformation();
        man.GetInormationFromIntroducer(introducer);
        woman.GetInormationFromIntroducer(introducer);
        Debug.Log($"男方对女方好感度:{man.m_favor}  女方对男方好感度:{woman.m_favor}");
    }
        public static bool MatchCouple(Men men, Women womem)
        {
            int similarity = 0;

            if (MatchEyes(men, womem))
            {
                similarity++;
            }
            if (MatchGrowth(men, womem))
            {
                similarity++;
            }
            if (MatchAge(men, womem))
            {
                similarity++;
            }
            return(similarity >= minimalSimilarity);
        }
        private static bool MatchAge(Men men, Women womem)
        {
            DateTime minAge;
            DateTime maxAge;

            if (men.DateBirth < womem.DateBirth)
            {
                minAge = men.DateBirth;
                maxAge = womem.DateBirth;
            }
            else
            {
                maxAge = men.DateBirth;
                minAge = womem.DateBirth;
            }
            const int maxDifrentYears = 5;

            return(minAge.AddYears(maxDifrentYears) > maxAge);
        }
Exemple #15
0
        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 没有地方请示,按不同意处理--
        }
Exemple #16
0
        public JsonResult BarChart()
        {
            Men        men          = new Men();
            Women      women        = new Women();
            List <int> totalHombres = new List <int>();
            List <int> totalMujeres = new List <int>();

            var assistances = assistanceRepository.GetAssistances().Where(a => a.assistanceDate.Year == DateTime.Now.Year).ToList();

            try
            {
                foreach (var item in assistances)
                {
                    #region GetCliente
                    Client c = clientRepository.GetClientByID(item.ClientID);
                    if (c == null)
                    {
                        continue;
                    }
                    #endregion

                    #region Calculo de Edad,  de Clasificacion en Edad y lo cuento
                    var today = DateTime.Today;
                    var age   = today.Year - c.BirthDate.Year;
                    if (c.BirthDate > today.AddYears(-age))
                    {
                        age--;
                    }

                    if (c.Sexo.Equals(Utils.Catalog.Genre.Hombre))
                    {
                        if (age < 36)
                        {
                            men.YoungAdult++;
                        }
                        else if (age < 51)
                        {
                            men.Adult++;
                        }
                        else if (age < 65)
                        {
                            men.MiddleAge++;
                        }
                        else
                        {
                            men.Senior++;
                        }
                    }
                    else
                    {
                        if (age < 36)
                        {
                            women.YoungAdult++;
                        }
                        else if (age < 51)
                        {
                            women.Adult++;
                        }
                        else if (age < 65)
                        {
                            women.MiddleAge++;
                        }
                        else
                        {
                            women.Senior++;
                        }
                    }
                    #endregion
                }

                #region Listas para el front
                totalHombres.Insert(0, men.YoungAdult);
                totalHombres.Insert(1, men.Adult);
                totalHombres.Insert(2, men.MiddleAge);
                totalHombres.Insert(3, men.Senior);
                totalMujeres.Insert(0, women.YoungAdult);
                totalMujeres.Insert(1, women.Adult);
                totalMujeres.Insert(2, women.MiddleAge);
                totalMujeres.Insert(3, women.Senior);
                #endregion
            }
            catch (Exception ex)
            {
                return(Json(new { Result = "NOOK", Error = ex.Message }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { Result = "OK", Men = totalHombres, Women = totalMujeres }, JsonRequestBehavior.AllowGet));
        }
Exemple #17
0
 List <Women> IRepository <Women> .GetAll()
 {
     return(Women.ToList());
 }
Exemple #18
0
 Women IRepository <Women> .Get(int id)
 {
     return(Women.FirstOrDefault(x => x.Id == id));
 }
Exemple #19
0
 int IRepository <Women> .Insert(Women model)
 {
     Women.Add(model);
     return(SaveChanges());
 }
Exemple #20
0
 void IRepository <Women> .Update(Women model)
 {
     Women.Update(model);
     SaveChanges();
 }
Exemple #21
0
 public CatalogPage ClickOnWomenCategory() =>
 Women.Click <CatalogPage>();
 private static bool MatchEyes(Men men, Women womem)
 {
     return(men.EyesColor == womem.EyesColor);
 }
 private static bool MatchGrowth(Men men, Women womem)
 {
     return(men.Growth - 10 > womem.Growth);
 }
        void ReleaseDesignerOutlets()
        {
            if (AccountData != null)
            {
                AccountData.Dispose();
                AccountData = null;
            }

            if (AccountDataSection != null)
            {
                AccountDataSection.Dispose();
                AccountDataSection = null;
            }

            if (BottomConstraint != null)
            {
                BottomConstraint.Dispose();
                BottomConstraint = null;
            }

            if (Cancel != null)
            {
                Cancel.Dispose();
                Cancel = null;
            }

            if (ChangePassword != null)
            {
                ChangePassword.Dispose();
                ChangePassword = null;
            }

            if (ChangePasswordSection != null)
            {
                ChangePasswordSection.Dispose();
                ChangePasswordSection = null;
            }

            if (CheckUsername != null)
            {
                CheckUsername.Dispose();
                CheckUsername = null;
            }

            if (ConfirmPassword != null)
            {
                ConfirmPassword.Dispose();
                ConfirmPassword = null;
            }

            if (ConfirmPasswordLabel != null)
            {
                ConfirmPasswordLabel.Dispose();
                ConfirmPasswordLabel = null;
            }

            if (DeactivateAccount != null)
            {
                DeactivateAccount.Dispose();
                DeactivateAccount = null;
            }

            if (DeleteAccount != null)
            {
                DeleteAccount.Dispose();
                DeleteAccount = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DescriptionText != null)
            {
                DescriptionText.Dispose();
                DescriptionText = null;
            }

            if (DistanceShareAll != null)
            {
                DistanceShareAll.Dispose();
                DistanceShareAll = null;
            }

            if (DistanceShareAllLabel != null)
            {
                DistanceShareAllLabel.Dispose();
                DistanceShareAllLabel = null;
            }

            if (DistanceShareFriend != null)
            {
                DistanceShareFriend.Dispose();
                DistanceShareFriend = null;
            }

            if (DistanceShareFriendLabel != null)
            {
                DistanceShareFriendLabel.Dispose();
                DistanceShareFriendLabel = null;
            }

            if (DistanceShareLabel != null)
            {
                DistanceShareLabel.Dispose();
                DistanceShareLabel = null;
            }

            if (DistanceShareLike != null)
            {
                DistanceShareLike.Dispose();
                DistanceShareLike = null;
            }

            if (DistanceShareLikeLabel != null)
            {
                DistanceShareLikeLabel.Dispose();
                DistanceShareLikeLabel = null;
            }

            if (DistanceShareMatch != null)
            {
                DistanceShareMatch.Dispose();
                DistanceShareMatch = null;
            }

            if (DistanceShareMatchLabel != null)
            {
                DistanceShareMatchLabel.Dispose();
                DistanceShareMatchLabel = null;
            }

            if (DistanceShareNone != null)
            {
                DistanceShareNone.Dispose();
                DistanceShareNone = null;
            }

            if (DistanceShareNoneLabel != null)
            {
                DistanceShareNoneLabel.Dispose();
                DistanceShareNoneLabel = null;
            }

            if (EditImagesUploaded != null)
            {
                EditImagesUploaded.Dispose();
                EditImagesUploaded = null;
            }

            if (Email != null)
            {
                Email.Dispose();
                Email = null;
            }

            if (EmailLabel != null)
            {
                EmailLabel.Dispose();
                EmailLabel = null;
            }

            if (ImageEditor != null)
            {
                ImageEditor.Dispose();
                ImageEditor = null;
            }

            if (ImageEditorCancel != null)
            {
                ImageEditorCancel.Dispose();
                ImageEditorCancel = null;
            }

            if (ImageEditorControls != null)
            {
                ImageEditorControls.Dispose();
                ImageEditorControls = null;
            }

            if (ImageEditorFrame != null)
            {
                ImageEditorFrame.Dispose();
                ImageEditorFrame = null;
            }

            if (ImageEditorFrameBorder != null)
            {
                ImageEditorFrameBorder.Dispose();
                ImageEditorFrameBorder = null;
            }

            if (ImageEditorLabel != null)
            {
                ImageEditorLabel.Dispose();
                ImageEditorLabel = null;
            }

            if (ImageEditorOK != null)
            {
                ImageEditorOK.Dispose();
                ImageEditorOK = null;
            }

            if (ImageEditorStatus != null)
            {
                ImageEditorStatus.Dispose();
                ImageEditorStatus = null;
            }

            if (Images != null)
            {
                Images.Dispose();
                Images = null;
            }

            if (ImagesProgress != null)
            {
                ImagesProgress.Dispose();
                ImagesProgress = null;
            }

            if (ImagesProgressText != null)
            {
                ImagesProgressText.Dispose();
                ImagesProgressText = null;
            }

            if (LoaderCircle != null)
            {
                LoaderCircle.Dispose();
                LoaderCircle = null;
            }

            if (LocationSettings != null)
            {
                LocationSettings.Dispose();
                LocationSettings = null;
            }

            if (LocationSettingsSection != null)
            {
                LocationSettingsSection.Dispose();
                LocationSettingsSection = null;
            }

            if (LocationShareAll != null)
            {
                LocationShareAll.Dispose();
                LocationShareAll = null;
            }

            if (LocationShareAllLabel != null)
            {
                LocationShareAllLabel.Dispose();
                LocationShareAllLabel = null;
            }

            if (LocationShareFriend != null)
            {
                LocationShareFriend.Dispose();
                LocationShareFriend = null;
            }

            if (LocationShareFriendLabel != null)
            {
                LocationShareFriendLabel.Dispose();
                LocationShareFriendLabel = null;
            }

            if (LocationShareLabel != null)
            {
                LocationShareLabel.Dispose();
                LocationShareLabel = null;
            }

            if (LocationShareLike != null)
            {
                LocationShareLike.Dispose();
                LocationShareLike = null;
            }

            if (LocationShareLikeLabel != null)
            {
                LocationShareLikeLabel.Dispose();
                LocationShareLikeLabel = null;
            }

            if (LocationShareMatch != null)
            {
                LocationShareMatch.Dispose();
                LocationShareMatch = null;
            }

            if (LocationShareMatchLabel != null)
            {
                LocationShareMatchLabel.Dispose();
                LocationShareMatchLabel = null;
            }

            if (LocationShareNone != null)
            {
                LocationShareNone.Dispose();
                LocationShareNone = null;
            }

            if (LocationShareNoneLabel != null)
            {
                LocationShareNoneLabel.Dispose();
                LocationShareNoneLabel = null;
            }

            if (Men != null)
            {
                Men.Dispose();
                Men = null;
            }

            if (MenLabel != null)
            {
                MenLabel.Dispose();
                MenLabel = null;
            }

            if (MoreOptions != null)
            {
                MoreOptions.Dispose();
                MoreOptions = null;
            }

            if (MoreOptionsSection != null)
            {
                MoreOptionsSection.Dispose();
                MoreOptionsSection = null;
            }

            if (Name != null)
            {
                Name.Dispose();
                Name = null;
            }

            if (NameLabel != null)
            {
                NameLabel.Dispose();
                NameLabel = null;
            }

            if (NewPassword != null)
            {
                NewPassword.Dispose();
                NewPassword = null;
            }

            if (NewPasswordLabel != null)
            {
                NewPasswordLabel.Dispose();
                NewPasswordLabel = null;
            }

            if (OldPassword != null)
            {
                OldPassword.Dispose();
                OldPassword = null;
            }

            if (OldPasswordLabel != null)
            {
                OldPasswordLabel.Dispose();
                OldPasswordLabel = null;
            }

            if (ProfileEdit_Scroll != null)
            {
                ProfileEdit_Scroll.Dispose();
                ProfileEdit_Scroll = null;
            }

            if (RippleImageEditor != null)
            {
                RippleImageEditor.Dispose();
                RippleImageEditor = null;
            }

            if (RoundBottom != null)
            {
                RoundBottom.Dispose();
                RoundBottom = null;
            }

            if (Save != null)
            {
                Save.Dispose();
                Save = null;
            }

            if (ScrollBottomConstraint != null)
            {
                ScrollBottomConstraint.Dispose();
                ScrollBottomConstraint = null;
            }

            if (ScrollBottomOuterConstraint != null)
            {
                ScrollBottomOuterConstraint.Dispose();
                ScrollBottomOuterConstraint = null;
            }

            if (SexLabel != null)
            {
                SexLabel.Dispose();
                SexLabel = null;
            }

            if (Snackbar != null)
            {
                Snackbar.Dispose();
                Snackbar = null;
            }

            if (SnackBottomConstraint != null)
            {
                SnackBottomConstraint.Dispose();
                SnackBottomConstraint = null;
            }

            if (SnackTopConstraint != null)
            {
                SnackTopConstraint.Dispose();
                SnackTopConstraint = null;
            }

            if (TopSeparator != null)
            {
                TopSeparator.Dispose();
                TopSeparator = null;
            }

            if (UseLocationLabel != null)
            {
                UseLocationLabel.Dispose();
                UseLocationLabel = null;
            }

            if (UseLocationSwitch != null)
            {
                UseLocationSwitch.Dispose();
                UseLocationSwitch = null;
            }

            if (Username != null)
            {
                Username.Dispose();
                Username = null;
            }

            if (UsernameLabel != null)
            {
                UsernameLabel.Dispose();
                UsernameLabel = null;
            }

            if (ViewportConstraint != null)
            {
                ViewportConstraint.Dispose();
                ViewportConstraint = null;
            }

            if (Women != null)
            {
                Women.Dispose();
                Women = null;
            }

            if (WomenLabel != null)
            {
                WomenLabel.Dispose();
                WomenLabel = null;
            }
        }
 public ActionResult Women(Women Women)
 {
     return(ComonPersonPost(Women));
 }