Esempio n. 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(tbxEye.Text))
         {
             errorProviderEye.SetError(tbxEye, "Add Eye Color!");
             return;
         }
         else
         {
             EyeColor eye = new EyeColor
             {
                 ColorName = tbxEye.Text
             };
             db.EyeColors.Add(eye);
             db.SaveChanges();
             updateInfo();
             clearTxt();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please try again after 2 minutes!");
         File.AppendAllText(path, "\n" + ex + ":" + DateTime.Now);
         return;
     }
 }
Esempio n. 2
0
        public void seed()
        {
            HairColor hairColor = new HairColor();
            EyeColor  eyeColor  = new EyeColor();
            Job       job       = new Job();

            Adult[] persons = { new Adult
                                {
                                    firstName = "Alex", lastName = "Clinton", ID = 1, hairColor =
                                        hairColor.blackColor, eyeColor = eyeColor.blueColor, age = 17, weight = 80,
                                    height = 170, job = job.astronautJob
                                }, new Adult
                                {
                                    firstName = "John", lastName = "Smith", ID = 2, hairColor =
                                        hairColor.blueColor, eyeColor = eyeColor.brownColor, age = 20, weight = 73,
                                    height = 180, job = job.captainJob
                                }, new Adult
                                {
                                    firstName = "Sara", lastName = "Jordan", ID = 3, hairColor =
                                        hairColor.brownColor, eyeColor = eyeColor.greyColor, age = 30, weight = 60,
                                    height = 173, job = job.chefJob
                                } };

            personsList = persons.ToList();
        }
Esempio n. 3
0
 public CharacterAppearance()
 {
     HairColor  = new HairColor("none");
     HairStyle  = new HairStyle("none");
     FacialHair = new FacialHair("none");
     EyeColor   = new EyeColor("none");
 }
 private void addNewColor_Click(object sender, EventArgs e)
 {
     errorProvider1.Clear();
     try
     {
         if (String.IsNullOrEmpty(txtNewColor.Text))
         {
             errorProvider1.SetError(txtNewColor, "Please, fill input!");
             return;
         }
         EyeColor newEyeColor = new EyeColor
         {
             EyeColor1 = txtNewColor.Text,
         };
         checkEyeColor = db.EyeColors.Where(w => w.EyeColor1 == newEyeColor.EyeColor1).FirstOrDefault();
         if (checkEyeColor == null)
         {
             db.EyeColors.Add(newEyeColor);
             db.SaveChanges();
             MessageBox.Show("You added new color");
             updateColor();
         }
         MessageBox.Show("This Color exists");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please, check again after some minutes!! ");
         File.AppendAllText(pathTxt, "\n" + ex + ":" + DateTime.Now);
     }
 }
Esempio n. 5
0
 public Profile(Gender Gender, EyeColor EyeColor, HairColor HairColor, HeightCategory HeightCategory)
 {
     _gender         = Gender;
     _eyeColor       = EyeColor;
     _hairColor      = HairColor;
     _heightCategory = HeightCategory;
 }
        public IHttpActionResult PutEyeColor(int id, EyeColor eyeColor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eyeColor.Id)
            {
                return(BadRequest());
            }

            db.Entry(eyeColor).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EyeColorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((EyeColor != null ? EyeColor.GetHashCode() : 0) * 397) ^ (FurColor != null ? FurColor.GetHashCode() : 0));
     }
 }
Esempio n. 8
0
 public Profile(Gender gender, EyeColor eyeColor, HairColor hairColor, HeightCategory heightCategory)
 {
     _gender         = gender;
     _eyeColor       = eyeColor;
     _hairColor      = hairColor;
     _heightCategory = heightCategory;
 }
Esempio n. 9
0
 public UserDTO ToUserDTO()
 {
     return(new UserDTO
     {
         Name = Name,
         Email = Email,
         IsActive = Convert.ToBoolean(IsActive),
         Age = Age,
         Tags = Tags,
         Balance = Balance,
         About = About,
         Address = Address,
         Company = Company,
         Guid = Guid,
         Id = Guid,
         Latitude = Latitude,
         Longitude = Longitude,
         Phone = Phone,
         Registered = Registered,
         FavoriteFruit = FavoriteFruit.ToFruitType(),
         EyeColor = EyeColor.ToEyeColorType(),
         Gender = Gender.ToGenderType(),
         Friends = Friends
                   .Select(id => new UserDTO {
             Id = id
         })
                   .ToList()
     });
 }
Esempio n. 10
0
        private EyeColor NewEyes(EyeColor MomsEyes, EyeColor DadsEyes)
        {
            int      t;
            EyeColor e = EyeColor.Brown;

            if (MomsEyes == EyeColor.Blue && DadsEyes == EyeColor.Blue)
            {
                e = EyeColor.Blue;
            }
            else if (MomsEyes == EyeColor.Hazel || DadsEyes == EyeColor.Hazel)
            {
                t = r.Next(0, 2);
                if (t == 0)
                {
                    e = MomsEyes;
                }
                else
                {
                    e = DadsEyes;
                }
            }
            else
            {
                e = EyeColor.Brown;
            }
            return(e);
        }
Esempio n. 11
0
 public bool MemberwiseEquals(ICharacterAppearance maybeOther)
 {
     if (maybeOther is not HumanoidCharacterAppearance other)
     {
         return(false);
     }
     if (HairStyleId != other.HairStyleId)
     {
         return(false);
     }
     if (!HairColor.Equals(other.HairColor))
     {
         return(false);
     }
     if (FacialHairStyleId != other.FacialHairStyleId)
     {
         return(false);
     }
     if (!FacialHairColor.Equals(other.FacialHairColor))
     {
         return(false);
     }
     if (!EyeColor.Equals(other.EyeColor))
     {
         return(false);
     }
     if (!SkinColor.Equals(other.SkinColor))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 12
0
 public Princess(int number, string name, byte age, HairColor hairColor, EyeColor eyeColor)
 {
     this.Number    = number;
     this.Name      = name;
     this.Age       = age;
     this.HairColor = hairColor;
     this.EyeColor  = eyeColor;
 }
Esempio n. 13
0
 internal PhysicalAttributes(Guid personId, EyeColor eyeColor = EyeColor.NotSpecified, HairColor naturalHairColor = HairColor.NotSpecified, SkinColor skinColor = SkinColor.NotSpecified, int?heightCm = null, int?weightKg = null)
 {
     PersonId         = personId;
     EyeColor         = eyeColor;
     NaturalHairColor = naturalHairColor;
     SkinColor        = skinColor;
     HeightCm         = heightCm;
     WeightKg         = weightKg;
 }
Esempio n. 14
0
 public DNA(Gender gender, HairColor hairColor, EyeColor eyeColor, SkinColor skinColor, Height height, BloodType bloodType)
 {
     Gender    = gender;
     HairColor = hairColor;
     EyeColor  = eyeColor;
     SkinColor = skinColor;
     Height    = height;
     BloodType = bloodType;
 }
        public bool Equals(DestinyCharacterCustomization input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Personality == input.Personality ||
                     (Personality.Equals(input.Personality))
                     ) &&
                 (
                     Face == input.Face ||
                     (Face.Equals(input.Face))
                 ) &&
                 (
                     SkinColor == input.SkinColor ||
                     (SkinColor.Equals(input.SkinColor))
                 ) &&
                 (
                     LipColor == input.LipColor ||
                     (LipColor.Equals(input.LipColor))
                 ) &&
                 (
                     EyeColor == input.EyeColor ||
                     (EyeColor.Equals(input.EyeColor))
                 ) &&
                 (
                     HairColors == input.HairColors ||
                     (HairColors != null && HairColors.SequenceEqual(input.HairColors))
                 ) &&
                 (
                     FeatureColors == input.FeatureColors ||
                     (FeatureColors != null && FeatureColors.SequenceEqual(input.FeatureColors))
                 ) &&
                 (
                     DecalColor == input.DecalColor ||
                     (DecalColor.Equals(input.DecalColor))
                 ) &&
                 (
                     WearHelmet == input.WearHelmet ||
                     (WearHelmet != null && WearHelmet.Equals(input.WearHelmet))
                 ) &&
                 (
                     HairIndex == input.HairIndex ||
                     (HairIndex.Equals(input.HairIndex))
                 ) &&
                 (
                     FeatureIndex == input.FeatureIndex ||
                     (FeatureIndex.Equals(input.FeatureIndex))
                 ) &&
                 (
                     DecalIndex == input.DecalIndex ||
                     (DecalIndex.Equals(input.DecalIndex))
                 ));
        }
Esempio n. 16
0
 public Person(string firstName, string lastName, DateTime birthDate, EyeColor eyeCol, HairColor hairCol, int height)
 {
     FirstName = firstName;
     LastName  = lastName;
     BirthDate = birthDate;
     EyeCol    = eyeCol;
     HairCol   = hairCol;
     Height    = height;
 }
Esempio n. 17
0
 private void SetDefaults()
 {
     firstName = "John";
     lastName  = "Doe";
     birthDate = new DateTime(1900, 1, 1);
     eyeCol    = EyeColor.blue;
     hairCol   = HairColor.brown;
     height    = 180;
 }
Esempio n. 18
0
    private void GenPartner(RootPerson root)
    {
        gender   = Generators.PartnerGender(root);
        ageGroup = Generators.PartnerAgeGroup(root);
        age      = Generators.Age(ageGroup);

        skinColor = Generators.PartnerSkinColor(root);
        hairColor = Generators.RootHairColor(skinColor);
        eyeColor  = Generators.RootEyeColor(skinColor);
    }
Esempio n. 19
0
        // Based on: http://www.highprogrammer.com/alan/numbers/dl_us_nj.html
        // Number format: Lllll fffmm MMyye
        static void Main(string[] args)
        {
            string   licenseNumber = "Allll fffmm MMyye";
            EyeColor color         = EyeColor.Brown;

            string firstName, middleName, lastName;


            Console.WriteLine("Enter full name (middle name optional):");
            Console.WriteLine("\tLAST, FIRST (MIDDLE)\n\tFIRST (MIDDLE) LAST");
            string fullName = Console.ReadLine();

            string[] splitName;
            if (fullName.Contains(','))
            {
                splitName = fullName.Split(new char[] { ',', ' ' });
            }
            else
            {
                splitName = fullName.Split(new char[] { ' ' });
            }


            licenseNumber = licenseNumber.Replace("A", "S");
            licenseNumber = licenseNumber.Replace("llll", "0000");
            licenseNumber = licenseNumber.Replace("fff", "111");
            licenseNumber = licenseNumber.Replace("mm", ConvertMiddleInitial("Joseph"));
            Console.WriteLine(String.Format("\n\"{0}\"\n", licenseNumber));

            //// TODO: Check if valid name, split into first, middle initial, last name
            //splitName = (fullName.Contains(',') ? fullName.Split(new char[] { ',', ' ' }) : fullName.Split(new char[] { ' ' }));

            Console.WriteLine("Enter birth month/year (MM/YYYY)");
            string birthday = Console.ReadLine();

            licenseNumber = licenseNumber.Replace("MM", "06");
            licenseNumber = licenseNumber.Replace("yy", "84");

            Console.WriteLine(String.Format("\n\"{0}\"\n", licenseNumber));

            Console.WriteLine("Choose an eye color:");
            foreach (var eyeColor in Enum.GetNames(typeof(EyeColor)))
            {
                Console.WriteLine(String.Format(" {0}) {1}", (int)Enum.Parse(typeof(EyeColor), eyeColor), eyeColor.ToString()));
            }
            string sEyeColor = Console.ReadLine();

            // TODO: Detect number or string input and assign accordingly

            licenseNumber = licenseNumber.Replace("e", ((int)color).ToString());

            Console.WriteLine(String.Format("\n\"{0}\"\n", licenseNumber));

            Console.Read();
        }
        public IHttpActionResult GetEyeColor(int id)
        {
            EyeColor eyeColor = db.EyeColors.Find(id);

            if (eyeColor == null)
            {
                return(NotFound());
            }

            return(Ok(eyeColor));
        }
Esempio n. 21
0
 public Person(string name , double height = 0.0 , double weight = 0.0)
 {
     //Use this to get at the member variable, if it is shadowed by a local variable
     this.name = name;
     this.height = height;
     this.weight = weight;
     age = 17;
     gender = Gender.Female;
     eyeColor = EyeColor.Brown;
     children = null;
 }
Esempio n. 22
0
 public Person(string name, double height = 0.0, double weight = 0.0)
 {
     //Use this to get at the member variable, if it is shadowed by a local variable
     this.name   = name;
     this.height = height;
     this.weight = weight;
     age         = 17;
     gender      = Gender.Female;
     eyeColor    = EyeColor.Brown;
     children    = null;
 }
        public IHttpActionResult PostEyeColor(EyeColor eyeColor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EyeColors.Add(eyeColor);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = eyeColor.Id }, eyeColor));
        }
Esempio n. 24
0
        private void dgvEyeColor_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            int id = (int)dgvEyeColor.Rows[e.RowIndex].Cells[0].Value;

            selectedEye    = db.EyeColors.Where(w => w.ID == id).FirstOrDefault();
            tbxEye.Text    = selectedEye.ColorName;
            btnAdd.Enabled = false;
        }
 private static void ScoreFields(EyeColor first, EyeColor second, ref int score, ref int maxScore)
 {
     if (first == EyeColor.Other)
     {
         return;
     }
     maxScore += 1;
     if (first == second)
     {
         score += 1;
     }
 }
Esempio n. 26
0
        private string NewThoughts()
        {
            Gender    genpref;
            HairColor hairpref    = HairColor.Blonde;
            int       hairprefbon = -7;
            EyeColor  eyepref     = EyeColor.Blue;
            int       eyeprefbon  = -7;
            Size      sizepref    = PopSim2.Size.Small;
            int       sizeprefbon = -7;
            string    thought     = "";

            if (GetGender == Gender.Male)
            {
                genpref = Gender.Female;
            }
            else
            {
                genpref = Gender.Male;
            }
            for (int i = 0; i < (int)HairColor.Red; i++)
            {
                if (myPrefs.Hair((HairColor)i) > hairprefbon)
                {
                    hairpref    = (HairColor)i;
                    hairprefbon = myPrefs.Hair((HairColor)i);
                }
            }
            for (int i = 0; i < (int)EyeColor.Hazel; i++)
            {
                if (myPrefs.Eyes((EyeColor)i) > eyeprefbon)
                {
                    eyepref    = (EyeColor)i;
                    eyeprefbon = myPrefs.Eyes((EyeColor)i);
                }
            }
            for (int i = 0; i < (int)PopSim2.Size.Large; i++)
            {
                if (myPrefs.Size((PopSim2.Size)i) > sizeprefbon)
                {
                    sizeprefbon = myPrefs.Size((PopSim2.Size)i);
                    sizepref    = (PopSim2.Size)i;
                }
            }
            thought += "My Name is " + this.Name.ToString();
            thought += "\nI am a " + this.GetGender.ToString("F");
            thought += "\nI have " + this.Hair.ToString("F") + " hair, " +
                       this.Eyes.ToString("F") + " eyes, and I am " + this.Size.ToString("F");
            thought += "\nI like " + genpref.ToString("F") + "s with " + hairpref.ToString("F") +
                       " hair, " + eyepref.ToString("F") + " eyes and are " + sizepref.ToString("F");
            return(thought);
        }
        public async Task Consume(ConsumeContext <PersonValidationRequested> context)
        {
            var errors = new List <string>();
            var acceptableEyeColors = new EyeColor[] { EyeColor.Blue, EyeColor.Brown };

            if (acceptableEyeColors.Contains(context.Message.Person.EyeColor) == false)
            {
                errors.Add($"Eye color '{context.Message.Person.EyeColor}' is not an acceptable color.");
            }

            context.Respond(new PersonValidated {
                ValidatorName = typeof(PersonValidationRequestedConsumer).Namespace, Errors = errors.ToArray()
            });
        }
        public IHttpActionResult DeleteEyeColor(int id)
        {
            EyeColor eyeColor = db.EyeColors.Find(id);

            if (eyeColor == null)
            {
                return(NotFound());
            }

            db.EyeColors.Remove(eyeColor);
            db.SaveChanges();

            return(Ok(eyeColor));
        }
 private void AddEyeColor_Click(object sender, EventArgs e)
 {
     try
     {
         selectedColor          = null;
         btnDeleteColor.Enabled = false;
         addNewColor.Enabled    = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please, check again after some minutes!! ");
         File.AppendAllText(pathTxt, "\n" + ex + ":" + DateTime.Now);
     }
 }
Esempio n. 30
0
 public Person()
 {
     myName = new Name(6);
     myEyes = NewEyes();
     myHair = NewHair();
     itsGender = NewGender();
     mySize = NewSize();
     myPrefs = new Preferences();
     myThoughtBubble = NewThoughts();
     myAge = 18.0;
     MomsName = new Name(3);
     DadsName = new Name(3);
     myChildrensNames = new List<Name>();
 }
Esempio n. 31
0
 public Person()
 {
     myName           = new Name(6);
     myEyes           = NewEyes();
     myHair           = NewHair();
     itsGender        = NewGender();
     mySize           = NewSize();
     myPrefs          = new Preferences();
     myThoughtBubble  = NewThoughts();
     myAge            = 18.0;
     MomsName         = new Name(3);
     DadsName         = new Name(3);
     myChildrensNames = new List <Name>();
 }
 private void dgvColorList_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     try
     {
         int id = (int)dgvColorList.Rows[e.RowIndex].Cells[0].Value;
         selectedColor          = db.EyeColors.Where(w => w.ID == id).FirstOrDefault();
         btnDeleteColor.Enabled = true;
         addNewColor.Enabled    = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please, check again after some minutes!! ");
         File.AppendAllText(pathTxt, "\n" + ex + ":" + DateTime.Now);
     }
 }
Esempio n. 33
0
 public Person(Person mom, Person dad)
 {
     myName = new Name(mom.Name, dad.Name);
     myEyes = NewEyes(mom.Eyes, dad.Eyes);
     myHair = NewHair(mom.Hair, dad.Hair);
     itsGender = NewGender();
     mySize = NewSize(mom.Size, dad.Size);
     if (itsGender == Gender.Male)
     {
         myPrefs = new Preferences(mom);
     }
     else
     {
         myPrefs = new Preferences(dad);
     }
     myAge = 0.0;
     MomsName = mom.Name;
     DadsName = dad.Name;
     myChildrensNames = new List<PopSim2.Name>();
     mom.NewChild(this);
     dad.NewChild(this);
     myThoughtBubble = NewThoughts(mom, dad);
 }
Esempio n. 34
0
 public int Eyes(EyeColor e)
 {
     return myEyePrefs[(int)e];
 }
Esempio n. 35
0
 public Student(string name, uint studentID, EyeColor eyes)
 {
     Name = name;
     StudentID = studentID;
     Eyes = eyes;
 }
Esempio n. 36
0
 private EyeColor NewEyes(EyeColor MomsEyes, EyeColor DadsEyes)
 {
     int t;
     EyeColor e=EyeColor.Brown;
     if (MomsEyes == EyeColor.Blue && DadsEyes == EyeColor.Blue)
     {
         e = EyeColor.Blue;
     }
     else if (MomsEyes == EyeColor.Hazel || DadsEyes == EyeColor.Hazel)
     {
         t = r.Next(0, 2);
         if (t == 0)
         {
             e = MomsEyes;
         }
         else
         {
             e = DadsEyes;
         }
     }
     else
     {
         e = EyeColor.Brown;
     }
     return e;
 }