Ejemplo n.º 1
0
 private static List<RawCompetitor> GetRawCompetitorInt(BrokerType brokerType, LanguageType languageType, SportType sportType, GenderType genderType, string[] names)
 {
     if (genderType == GenderType.Unknown) {
         _logger.Error("{0}: {1}", names.StrJoin(", "), genderType);
     }
     var competitorsRaw = RawCompetitor.DataSource.FilterByLanguage(languageType).FilterBySportType(sportType).FilterByBroker(brokerType)
                                         .FilterByNameCompetitor(names)
                                         .FilterByGender(genderType,
                 RawCompetitor.Fields.CompetitoruniqueID,
                 RawCompetitor.Fields.Name,
                 RawCompetitor.Fields.Linkstatus);
     if (competitorsRaw.Count > 1) {
         var groupBy = competitorsRaw.Where(c => c.CompetitoruniqueID != default(int)).GroupBy(c => c.CompetitoruniqueID).ToArray();
         if (groupBy.Length > 1) {
             _logger.Error("{0} {1} {2} {3} {4} <=> {5}", brokerType, sportType, genderType,
                 competitorsRaw.Select(cr => cr.ID).StrJoin(", "), names.StrJoin(", "), groupBy.Select(g => g.Select(ge => ge.Name).StrJoin(", ")).StrJoin(" | "));
             return groupBy.First().ToList();
         }
         if (groupBy.Length == 1) {
             foreach (var rawCompetitor in competitorsRaw.Where(cr => cr.CompetitoruniqueID == default(int))) {
                 rawCompetitor.CompetitoruniqueID = groupBy[0].Key;
                 rawCompetitor.Save();
             }
         }
     }
     return CreateRawCompetitor(names, competitorsRaw, brokerType, languageType, sportType, genderType);
 }
Ejemplo n.º 2
0
        public Toothpaste(string name, string brand, decimal price, GenderType gender, IList<string> ingredients)
            : base(name, brand, price, gender)
        {
            this.IngredientsList = ingredients;

            this.Ingredients = string.Join(", ", this.IngredientsList);
        }
Ejemplo n.º 3
0
 public Driver(string name, GenderType gender)
 {
     this.id = DataGenerator.GenerateId();
     this.Name = name;
     this.Gender = gender;
     this.vehicles = new List<IMotorVehicle>();
 }
Ejemplo n.º 4
0
        public Toothpaste(string name, string brand, decimal price, GenderType gender, IList<string> ingredientsList)
            :base(name, brand, price, gender)
        {
            this.ingredientList = ingredientsList;

            ValidationListOfIngredients(ingredientsList);
        }
Ejemplo n.º 5
0
 public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage)
     : base(name, brand, price, gender)
 {
     this.Milliliters = milliliters;
     this.Usage = usage;
     this.Price *= this.Milliliters;
 }
Ejemplo n.º 6
0
        private static List<RawCompetitor> CreateRawCompetitor(string[] names, List<RawCompetitor> competitorsRaw, BrokerType brokerType, LanguageType languageType, SportType sportType, GenderType genderType)
        {
            var existNames = competitorsRaw.Select(cr => cr.Name).ToList();
            names = names
                .Where(name => !existNames.Contains(name))
                .ToArray();
            if (names.Any()) {
                var lastCompetitorUniqueID = competitorsRaw.Any()
                    ? competitorsRaw.First().CompetitoruniqueID
                    : default(int);
                var raw = competitorsRaw;
                names
                    .Where(name => !raw.Any(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)))
                    .Each(name => {
                        RawCompetitor competitorRaw = null;
                        try {
                            competitorRaw = BrokerEntityIfaceCreator.CreateEntity<RawCompetitor>(brokerType, languageType, sportType, genderType, LinkEntityStatus.Unlinked, new[] { name },
                                competitor => {
                                    if (lastCompetitorUniqueID != default(int)) {
                                        competitor.CompetitoruniqueID = lastCompetitorUniqueID;
                                        competitor.Linkstatus = LinkEntityStatus.LinkByStatistics | LinkEntityStatus.Linked;
                                    }
                                });
                            competitorRaw.Save();
                            raw.Add(competitorRaw);
                        } catch (Exception ex) {
                            _logger.Error("{0}\r\n{1}", competitorRaw?.ToString(), ex);
                            throw;
                        }
                    });
            }

            return competitorsRaw;
        }
Ejemplo n.º 7
0
 protected Product(string name, string brand, decimal price, GenderType gender)
 {
     Name = name;
     Brand = brand;
     Price = price;
     Gender = gender;
 }
Ejemplo n.º 8
0
 public User(string name, string password)
 {
     this.name = name;
     this.password = password;
     this.sex = GenderType.MALE;
     this.chars = new Dictionary<byte, List<uint>>();
 }
Ejemplo n.º 9
0
 public Honorific(string name, string abbreviation, GenderType genderType, HonorificType type)
 {
     Name = name;
       Abbreviation = abbreviation;
       GenderType = genderType;
       Type = type;
 }
Ejemplo n.º 10
0
 public Employee(string employeeID,
     string firstName,
     string middleName,
     string lastName,
     string jobTitle,
     GenderType gender,
     MaritalStatusType maritalStatus,
     DateTime birthDate,
     DateTime hireDate,
     string homePone,
     string workPhone,
     decimal salary,
     Department department)
     : base()
 {
     this.EmployeeID = employeeID;
     this.FirstName = firstName;
     this.LastName = lastName;
     this.Gender = gender;
     this.MaritalStatus = maritalStatus;
     this.JobTitle = jobTitle;
     this.BirthDate = birthDate;
     this.HireDate = hireDate;
     this.HomePhone = homePone;
     this.WorkPhone = workPhone;
     this.Salary = salary;
     this.Department = department;
 }
Ejemplo n.º 11
0
 public Driver(string name, GenderType gender)
     : base()
 {
     this.name = name;
     this.gender = gender;
     this.vehicles = new List<IMotorVehicle>();
 }
Ejemplo n.º 12
0
 public Product(string name, string brand, decimal price, GenderType gender)
 {
     this.Name = name;
     this.Brand = brand;
     this.Price = price;
     this.Gender = gender;
 }
Ejemplo n.º 13
0
 protected Product(string name, string brand, decimal price, GenderType genderType)
 {
     this.Name = name;
     this.Brand = brand;
     this.Gender = genderType;
     this.Price = price;
 }
Ejemplo n.º 14
0
 public Product(string name, string brand, decimal price, GenderType gender)
 {
     this.Name = name;
     this.Brand = brand;
     this.Price = price;
     this.Gender = gender;
     //this.Gender = (GenderType)Enum.Parse(typeof(GenderType), gender);
 }
        public void ParseGenderType_ReturnsCorrectString(GenderType genderType, string expected)
        {
            //act
            var result = EnumFactory.ParseGenderType(genderType);

            //assert
            result.Should().Be(expected);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="genderType"></param>
        /// <returns></returns>
        public string FirstName(GenderType genderType = GenderType.Any)
        {
            var firstNames = _data.FirstNames.ToList();
              if (genderType != GenderType.Any)
            return Pick(firstNames.Where(x => x.GenderType == genderType).ToList()).Name;

              return Pick(firstNames).Name;
        }
Ejemplo n.º 17
0
 public User(string name, string password, GenderType sex,string lastlogin)
 {
     this.name = name;
     this.password = password;
     this.sex = sex;
     this.lastLogin = lastLogin;
     this.chars = new Dictionary<byte, List<uint>>();
 }
        public void EnumHelper_Parse_ReturnsCorrectEnum(string value, GenderType genderType)
        {
            //act
            var result = EnumHelper<GenderType>.Parse(value);

            //assert
            result.Should().Be(genderType);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// instantiate a guest and set intial properties
 /// </summary>
 /// <param name="name">guest name</param>
 /// <param name="gender">guest gender</param>
 /// <param name="race">guest race</param>
 /// <param name="currentRoomNumber">room location as an index of the hall array</param>
 public Staff(
     string name,
     GenderType gender,
     RaceType race,
     int currentRoomNumber)
     : base(name, gender, race, currentRoomNumber)
 {
 }
Ejemplo n.º 20
0
 public ICreature CreateEnemy(string name, GenderType gender)
 {
     return new Enemy(
         name,
         Enemy.InitialEnemyAttack,
         Enemy.InitialEnemyHealth,
         gender);
 }
Ejemplo n.º 21
0
        public Shampoo(string name, string brand, decimal price, uint mililiters, GenderType gender, UsageType usageType)
            : base(name, brand, price, gender)
        {
            Validator.CheckIfNull(mililiters, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Mililiters"));
            Validator.CheckIfNull(usageType, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "UsageType"));

            this.Usage = usageType;
            this.Milliliters = mililiters;
        }
Ejemplo n.º 22
0
		public Panda(string name, string email, GenderType gender)
		{
			Name = name;
			if (ValidEmail(email))
			{
				Email = email;
			}
			Gender = gender;
		}
Ejemplo n.º 23
0
 public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage)
 {
     this.Name = name;
     this.Brand = brand;
     this.Price = price;
     this.Gender = gender;
     this.Milliliters = milliliters;
     this.Usage = usage;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// instantiate a player and set initial properties
 /// </summary>
 /// <param name="name">player name</param>
 /// <param name="gender">player gender</param>
 /// <param name="race">player race</param>
 /// <param name="currentRoomNumber">room location as an index of the hall array</param>
 public Player(
     string name,
     GenderType gender,
     RaceType race,
     int currentRoomNumber)
     : base(name, gender, race, currentRoomNumber)
 {
     _lives = 1;
 }
Ejemplo n.º 25
0
        public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage)
            : base(name, brand, price, gender)
        {
            this.Milliliters = milliliters;
            this.Usage = usage;

            // TODO: Refactor price calculation ???
            this.Price = price * this.Milliliters; 
        }
 public IToothpaste CreateToothpaste(
     string name, 
     string brand, 
     decimal price, 
     GenderType gender, 
     IList<string> ingredients)
 {
     return new Toothpaste(name, brand, price, gender, ingredients);
 }
Ejemplo n.º 27
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("UncommitedEvents", out value)) UncommitedEvents = (List<Object>) value;
     if (values.TryGetValue("Version", out value)) Version = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("FirstName", out value)) FirstName = (String) value;
     if (values.TryGetValue("LastName", out value)) LastName = (String) value;
     if (values.TryGetValue("Gender", out value)) Gender = (GenderType) value;
 }
Ejemplo n.º 28
0
        public Toothpaste(string name, string brand, decimal price, GenderType gender, IList<string> ingredients)
            : base(name, brand, price, gender)
        {
            if (ingredients.Any(i => i.Length < 4 || i.Length > 12))
            {
                throw new IndexOutOfRangeException(string.Format(GlobalErrorMessages.InvalidStringLength, "Each ingredient", 4, 12));
            }

            this.ingredients = ingredients;
        }
Ejemplo n.º 29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="nickName"></param>
 /// <param name="age"></param>
 /// <param name="category"></param>
 /// <param name="gender"></param>
 /// <param name="canFly"></param>
 public Insect(string ID, string nickName, int age, CategoryType category, GenderType gender, bool canFly)
 {
     // TODO: Complete member initialization
     this.ID = ID;
     this.NickName = nickName;
     this.Age = age;
     this.Category = category;
     this.Gender = gender;
     this.canFly = canFly;
 }
 public IShampoo CreateShampoo(
     string name, 
     string brand, 
     decimal price, 
     GenderType gender, 
     uint milliliters, 
     UsageType usage)
 {
     return new Shampoo(name, brand, price, gender, milliliters, usage);
 }
Ejemplo n.º 31
0
        private string CreateToothpaste(string toothpasteName, string toothpasteBrand, decimal toothpastePrice, GenderType toothpasteGender, IList <string> toothpasteIngredients)
        {
            if (this.products.ContainsKey(toothpasteName))
            {
                return(string.Format(ToothpasteAlreadyExist, toothpasteName));
            }

            var toothpaste = this.factory.CreateToothpaste(toothpasteName, toothpasteBrand, toothpastePrice, toothpasteGender, toothpasteIngredients);

            this.products.Add(toothpasteName, toothpaste);

            return(string.Format(ToothpasteCreated, toothpasteName));
        }
Ejemplo n.º 32
0
 public Driver(string name, GenderType gender)
 {
     this.id       = DataGenerator.GenerateId();
     this.Name     = name;
     this.vehicles = new List <IMotorVehicle>();
 }
Ejemplo n.º 33
0
        /// <summary> //////////////////////////////////////////////////////////////////////////
        /// Person constructor
        /// dataLine - line in data file from which data was read.
        /// initData - text data used to initialize Person object.
        // Person constructor with initialization data string - four comma delimited fields:
        // (1) gender, (2) startage, (3) country, (4) birthyear
        /// </summary> /////////////////////////////////////////////////////////////////////////

        public Person(int dataLine, string initData)
        {
            // Set InitializeOK flag to true;
            initializeOK = true;

            // Parse input record into fields by looking for comma delimiter
            string[] personFields = Regex.Split(initData, fieldDelimiter);

            // Return immediately if there are not enough fields to read in
            if (personFields.Length < numPersonFields)
            {
                initializeOK = false;
                Console.WriteLine("Error - Data line: {0} - Not able to find {1} data fields.",
                                  dataLine, numPersonFields);
                Console.WriteLine("Data: {0}", initData);
                Console.WriteLine("");
                return;
            }


            // (1) Try to read in gender ("female" or "male")
            if (!genderTypeList.ContainsKey(((personFields[gender_offset]).Trim()).ToUpper()))
            {
                initializeOK = false;
                Console.WriteLine("Error - Data line: {0} - Field {1} is not a valid gender.",
                                  dataLine, gender_offset + 1);
                Console.WriteLine("Data: {0}", initData);
                return;
            }
            gender = (GenderType)
                     genderTypeList[((personFields[gender_offset]).Trim()).ToUpper()];


            // (2) Read in startage (numeric) and set ageNow to startAge
            if (!Double.TryParse((personFields[startage_offset]), out this.startAge))
            {
                initializeOK = false;
                Console.WriteLine("Error - Data line: {0} - Field {1} (start age) is not numeric.",
                                  dataLine, startage_offset + 1);
                Console.WriteLine("Data: {0}", initData);
            }
            ageNow = startAge;

            // (3) Read in country ("ETH" to "TZA")
            if (!countrytypelist.ContainsKey(((personFields[country_offset]).Trim()).ToUpper()))
            {
                initializeOK = false;
                Console.WriteLine("Error - Data line: {0} - Field {1} is not a valid country",
                                  dataLine, country_offset + 1);
                Console.WriteLine("Data: {0}", initData);
                return;
            }
            country = (countrytype)
                      countrytypelist[((personFields[country_offset]).Trim()).ToUpper()];


            // (4) Read in birthyear (numeric)
            if (!Double.TryParse((personFields[birthyear_offset]), out this.birthYear))
            {
                initializeOK = false;
                Console.WriteLine("Error - Data line: {0} - Field {1} (prevalence age) is not numeric.",
                                  dataLine, birthyear_offset + 1);
                Console.WriteLine("Data: {0}", initData);
            }
        }
Ejemplo n.º 34
0
 public Person(string name, GenderType gender)
 {
     Name   = name;
     Gender = gender;
 }
 public Toothpaste(string name, string brand, decimal price, GenderType gender, IList <string> ing) :
     base(name, brand, price, gender)
 {
     this.ingredients = string.Join(", ", ing);
 }
Ejemplo n.º 36
0
 public IToothpaste CreateToothpaste(string name, string brand, decimal price, GenderType gender, IList <string> ingredients)
 {
     return(new Toothpaste(name, brand, price, gender, ingredients));
 }
Ejemplo n.º 37
0
 public Toothpaste CreateToothpaste(string name, string brand, decimal price, GenderType gender, IList <string> ingredients)
 {
     return(null);
 }
Ejemplo n.º 38
0
 public IShampoo CreateShampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage)
 {
     return(new Shampoo(name, brand, price, gender, milliliters, usage));
 }
Ejemplo n.º 39
0
 public List <Customer> GetCustomersGenderWise(GenderType genderType)
 {
     return(_inMemCustList.FindAll(m => m.Gender == genderType));
 }
Ejemplo n.º 40
0
 public MemberGroup(GenderType gender)
 {
     Gender = gender;
 }
Ejemplo n.º 41
0
        //Constructor
        //5.

        public Customer(string customerName, string purchase, GenderType type = GenderType.Undefined)
        {
            this.CustomerName = customerName;
            this.Purchase     = purchase;
            this.Type         = type;
        }
Ejemplo n.º 42
0
 public void SetGender(GenderType gender)
 {
     this.PutByte((byte)gender, 4);
 }
Ejemplo n.º 43
0
 protected virtual bool CheckSurrogateData(GenderType gender)
 {
     return(gender == GenderType.Both || (GenderType)Gender == gender);
 }
Ejemplo n.º 44
0
        private void yesBtn_Click(object sender, RoutedEventArgs e)
        {
            Regex regexJmbg  = new Regex(@"^[0-9]{13}$");
            Match match      = regexJmbg.Match(txtJmbg.Text);
            Regex regexPhone = new Regex(@"^[0-9]+$");
            Match match1     = regexPhone.Match(txtPhone.Text);
            Regex regexLbo   = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match2     = regexLbo.Match(txtLbo.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals(""))
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena i jmbg-a je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!txtLbo.Text.Equals("") && !match2.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Lbo mora da bude u formatu xx000!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    blood = BloodType.O;
                RhFactorType rh    = RhFactorType.Negativna;
                DateTime     date  = DateTime.Today;
                GenderType   gen   = GenderType.Z;

                if (cmbBloodType.Text.Equals("A"))
                {
                    blood = BloodType.A;
                }
                else if (cmbBloodType.Text.Equals("B"))
                {
                    blood = BloodType.B;
                }
                else if (cmbBloodType.Text.Equals("AB"))
                {
                    blood = BloodType.AB;
                }

                if (cmbRh.Text.Equals("+"))
                {
                    rh = RhFactorType.Pozitivna;
                }
                if (dpDateOfBirth.SelectedDate != null)
                {
                    date = (DateTime)dpDateOfBirth.SelectedDate;
                }
                if (cmbGender.Text.Equals("M"))
                {
                    gen = GenderType.M;
                }

                City city = (City)txtCity.SelectedItem;

                bool guest = false;
                if (txtUsername.Text.Equals("") || txtUsername.Text == null)
                {
                    guest = true;
                }


                Patient p = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, date, gen, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, guest);

                string   medicalHistory = "";
                string[] partsDate      = txtDate.Text.Split('\n');
                string[] partsDesc      = txtDesc.Text.Split('\n');
                string[] partsTherapy   = txtTherapy.Text.Split('\n');

                if (!txtDate.Text.Equals(dates) || !txtTherapy.Text.Equals(therapy) || !txtDesc.Text.Equals(desc))
                {
                    if (partsDate.Length != partsDesc.Length || partsDate.Length != partsTherapy.Length || partsDate.Length != partsTherapy.Length)
                    {
                        var okMbx = new OKMessageBox(this, 2);
                        okMbx.titleMsgBox.Text = "Greška";
                        okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                        okMbx.ShowDialog();
                        return;
                    }
                    if (!txtDate.Text.Equals("") || !txtDesc.Text.Equals("") || !txtTherapy.Text.Equals(""))
                    {
                        for (int i = 0; i < partsDate.Length; i++)
                        {
                            if (partsDate[i].Equals("") || partsDesc[i].Equals("") || partsTherapy[i].Equals(""))
                            {
                                var okMbx = new OKMessageBox(this, 2);
                                okMbx.titleMsgBox.Text = "Greška";
                                okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                                okMbx.ShowDialog();
                                return;
                            }
                            medicalHistory += partsDate[i] + ":" + partsDesc[i] + ":" + partsTherapy[i] + ";";
                        }
                    }
                }
                else
                {
                    medicalHistory = dates + desc + therapy;
                    medicalHistory = medicalHistory.Replace('\n', ':');
                    if (medicalHistory.Length > 0)
                    {
                        medicalHistory  = medicalHistory.Substring(0, medicalHistory.Length - 1);
                        medicalHistory += ";";
                    }
                }

                PatientCard pc = new PatientCard(p, blood, rh, txtAllergy.Text, medicalHistory, hi, txtLbo.Text);

                if (patientController.EditProfile(p) != null && patientCardController.EditPatientCard(pc) != null)
                {
                    List <Examination> examinations = examinationController.ViewExaminationsByPatient(p.Jmbg);
                    foreach (Examination exm in examinations)
                    {
                        exm.patientCard = pc;
                        examinationController.EditExamination(exm);
                    }
                    List <Therapy> therapies = therapyController.ViewAllTherapyByPatient(p.Jmbg);
                    foreach (Therapy t in therapies)
                    {
                        t.patientCard = pc;
                        therapyController.EditTherapy(t);
                    }
                    List <PlacemetnInARoom> placemetnInARooms = placementInSickRoomController.ViewPatientPlacements(p.Jmbg);
                    foreach (PlacemetnInARoom pr in placemetnInARooms)
                    {
                        pr.patientCard = pc;
                        placementInSickRoomController.EditPlacement(pr);
                    }

                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili informacije o pacijentu.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške prilikom izmjene informacija! Provjerite da li su korisničko ime/lozinka validni.";
                    okMbx.ShowDialog();
                }
            }
        }
Ejemplo n.º 45
0
 public Shampoo(string name, string brand, decimal price, GenderType genderType, uint milliLiters, UsageType usageType)
     : base(name, brand, genderType, price)
 {
     this.Milliliters = milliLiters;
     this.Usage       = usageType;
 }
Ejemplo n.º 46
0
        public static UserIdentity CreateUser(DataContext context, string userName = "******", string password = "******",
                                              string title     = "Mr", string firstName     = "James", string surname = "Mccall", string idNumber = "7005245602074", GenderType gender = GenderType.Male,
                                              string Telephone = "0723257865", string email = "*****@*****.**", string streetName = "3559 Tempor Street", string city = "Gianco", string postalCode = "1899")
        {
            try
            {
                //fetch according to unique index
                var current = context.UserIdentitySet
                              .Include(a => a.Roles)
                              .Where(a => a.UserName == userName).SingleOrDefault(); //check against unique index
                if (current == null)                                                 //if not found in db
                {
                    //create instance of entity and insert to table.
                    current       = new Entities.SecurityData.UserIdentity();
                    current.Roles = new List <Role>();
                    context.UserIdentitySet.Add(current);
                }

                //set all attributes - this will update if existing, or insert if new
                current.UserName      = userName;
                current.Title         = title;
                current.FirstName     = firstName;
                current.Surname       = surname;
                current.IdPassportNum = idNumber;
                current.Gender        = gender;
                current.PasswordHash  = Cipher.Encrypt(password);
                current.Telephone     = Telephone;
                current.EmailAddress  = email;
                current.AddressLine1  = streetName;
                current.City          = city;
                current.PostalCode    = postalCode;
                current.Active        = true;

                context.SaveChanges(); //commit changes
                return(current);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                throw e;
            }
        }
Ejemplo n.º 47
0
 public Professor(string name, string surname, GenderType gender, int birthYear) :
     base(name, surname, gender, birthYear)
 {
     ProfessorID = $"PRF{_id++:000}";
 }
Ejemplo n.º 48
0
        private void btnYes_Click(object sender, RoutedEventArgs e)
        {
            Regex regexJmbg  = new Regex(@"^[0-9]{13}$");
            Match match      = regexJmbg.Match(txtJmbg.Text);
            Regex regexPhone = new Regex(@"^[0-9]+$");
            Match match1     = regexPhone.Match(txtPhone.Text);
            Regex regexLbo   = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match2     = regexLbo.Match(lboTextInput.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals("") || cmbGender.SelectedItem == null || datePicker.SelectedDate == null)
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena, JMBG-a, pola i datuma rođenja je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!lboTextInput.Text.Equals("") && !match2.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Lbo mora da bude u formatu xx000!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else if ((bool)completeRadioBtn.IsChecked && (txtUsername.Text.Equals("") || txtPassword.Password.Equals("")))
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos korisničkog imena i lozinke je obavezan za kompletnu registraciju!";
                okMbx.ShowDialog();
            }
            else
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    bloodType    = BloodType.O;
                RhFactorType rhFactorType = RhFactorType.Negativna;
                GenderType   gender       = GenderType.Z;
                DateTime     sd           = DateTime.Today;
                if (cmbBlood.SelectedItem != null)
                {
                    if (cmbBlood.Text.Equals("A"))
                    {
                        bloodType = BloodType.A;
                    }
                    else if (cmbBlood.Text.Equals("B"))
                    {
                        bloodType = BloodType.B;
                    }
                    else if (cmbBlood.Text.Equals("AB"))
                    {
                        bloodType = BloodType.AB;
                    }
                }
                if (cmbRh.SelectedItem != null)
                {
                    if (cmbRh.Text.Equals("+"))
                    {
                        rhFactorType = RhFactorType.Pozitivna;
                    }
                }
                if (datePicker.SelectedDate != null)
                {
                    sd = (DateTime)datePicker.SelectedDate;
                }
                if (cmbGender.SelectedItem != null)
                {
                    if (cmbGender.Text.Equals("M"))
                    {
                        gender = GenderType.M;
                    }
                }

                bool isGuest = false;
                if ((bool)quickRadioBtn.IsChecked)
                {
                    isGuest = true;
                }

                if (txtCity.SelectedItem != null)
                {
                    city = (City)txtCity.SelectedItem;
                }
                else
                {
                    city = new City();
                }

                string   medicalHistory = "";
                string[] partsDate      = txtDate.Text.Split('\n');
                string[] partsDesc      = txtDesc.Text.Split('\n');
                string[] partsTherapy   = txtTherapy.Text.Split('\n');


                if (partsDate.Length != partsDesc.Length || partsDate.Length != partsTherapy.Length || partsDate.Length != partsTherapy.Length)
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                    okMbx.ShowDialog();
                    return;
                }

                if (!txtDate.Text.Equals("") || !txtDesc.Text.Equals("") || !txtTherapy.Text.Equals(""))
                {
                    for (int i = 0; i < partsDate.Length; i++)
                    {
                        if (partsDate[i].Equals("") || partsDesc[i].Equals("") || partsTherapy[i].Equals(""))
                        {
                            var okMbx = new OKMessageBox(this, 2);
                            okMbx.titleMsgBox.Text = "Greška";
                            okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                            okMbx.ShowDialog();
                            return;
                        }
                        medicalHistory += partsDate[i] + ":" + partsDesc[i] + ":" + partsTherapy[i] + ";";
                    }
                }

                patient     = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, sd, gender, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, isGuest);
                patientCard = new PatientCard(patient, bloodType, rhFactorType, txtAllergy.Text, medicalHistory, hi, lboTextInput.Text);

                if (userController.Register(patient) != null && patientCardController.CreatePatientCard(patientCard) != null)
                {
                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste registrovali novog pacijenta.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Pacijent je već registrovan ili ste unijeli nedovoljan broj karaktera za korisničko ime/lozinku!";
                    okMbx.ShowDialog();
                }
            }
        }
Ejemplo n.º 49
0
 public Reptile(AnimalType name, int age, GenderType gender)
 {
     this.Name   = name;
     this.Age    = age;
     this.Gender = gender;
 }
Ejemplo n.º 50
0
 public Cat(int age, string name, GenderType gender) : base(age, name, gender)
 {
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Loads all animations for equiped weapon type. Used only in editor to generate prefabs
        /// </summary>
        /// <param name="WeaponType"></param>
        public void LoadAnimations(GameObject player, ZMD skeleton, WeaponType weapon, GenderType gender)
        {
            List <AnimationClip> clips = new List <AnimationClip>();

            foreach (ActionType action in Enum.GetValues(typeof(ActionType)))
            {
                // Attempt to find animation asset, and if not found, load from ZMO
                string        zmoPath = Utils.FixPath(ResourceManager.Instance.GetZMOPath(weapon, action, gender));
                AnimationClip clip    = R2U.GetClip(zmoPath, skeleton, action.ToString());
                clip.legacy = true;
                clips.Add(clip);
            }

            Animation animation = player.GetComponent <Animation>();

            AnimationUtility.SetAnimationClips(animation, clips.ToArray());
        }
Ejemplo n.º 52
0
 public IGoal CreateGoal(double startingWeight, double goalWeight, double height, int age, GenderType gender,
                         GoalType type, ActivityLevel level)
 {
     return(new Goal(startingWeight, goalWeight, height, age, gender, type, level));
 }
Ejemplo n.º 53
0
 protected GenderBase(GenderType genderType, string name)
 {
     GenderType = genderType;
     Name       = name;
 }
Ejemplo n.º 54
0
 public Character(string name, GenderType gender)
     : base(name, Character.InitialCharacterAttack, Character.InitialCharacterHealth, gender)
 {
     this.GoldAmount = InitialCharacterGold;
     this.AddSpell(new Spell("Heal", 50, Spells.SpellType.HealSpell));
 }
Ejemplo n.º 55
0
        private string CreateShampoo(string shampooName, string shampooBrand, decimal shampooPrice, GenderType shampooGender, uint shampooMilliliters, UsageType shampooUsage)
        {
            if (this.products.ContainsKey(shampooName))
            {
                return(string.Format(ShampooAlreadyExist, shampooName));
            }

            var shampoo = this.factory.CreateShampoo(shampooName, shampooBrand, shampooPrice, shampooGender, shampooMilliliters, shampooUsage);

            this.products.Add(shampooName, shampoo);

            return(string.Format(ShampooCreated, shampooName));
        }
Ejemplo n.º 56
0
 public IHttpActionResult GetPeopleByGender(GenderType genderType)
 {
     return(GetRequestResult(() => _personService.GetPeopleByGender(genderType)));
 }
Ejemplo n.º 57
0
 public void SetGender(GenderType personalGender, GenderType emergencyGender)
 {
     Gender          = personalGender;
     EmergencyGender = emergencyGender;
 }
Ejemplo n.º 58
0
 public Patient(string jmbg, string name, string surname, DateTime dateOfBirth, GenderType gender, City city, string homeAddress, string phone, string email, string username,
                string password, DateTime dateOfRegistration, bool isGuest)
 {
     this.Jmbg        = jmbg;
     this.Name        = name;
     this.Surname     = surname;
     this.DateOfBirth = dateOfBirth;
     this.Gender      = gender;
     if (city != null)
     {
         this.City = new City(city);
     }
     else
     {
         this.City = new City();
     }
     this.HomeAddress        = homeAddress;
     this.Phone              = phone;
     this.Email              = email;
     this.Username           = username;
     this.Password           = password;
     this.DateOfRegistration = dateOfRegistration;
     this.IsGuest            = isGuest;
 }
 public Shampoo(string name, string brand,
                decimal price, GenderType gender,
                uint milliliters, UsageType usage) : base(name, brand, price, gender, milliliters)
 {
     this.Usage = usage;
 }
Ejemplo n.º 60
0
 public Shampoo CreateShampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage)
 {
     return(null);
 }