Exemplo n.º 1
0
 //get childs of specific mother
 public List <Child> getChildList(Mother mother)
 {
     return(dal.getChildList(mother));
 }
Exemplo n.º 2
0
        public int addMother(Mother m)
        {
            IDal dal = DAL.FactorysingletonDal.getInstance;

            return(dal.addMother(m));
        }
Exemplo n.º 3
0
 public bool EsCompatible(Mother motherboard)
 {
     return(DDR4oDDR3 == motherboard.PedirDDR4oDDR3);
 }
Exemplo n.º 4
0
 public void addMother(Mother mom)
 {
     dal.addMother(mom);
 }
Exemplo n.º 5
0
        public Task BindModelAsync(ModelBindingContext bindingContext)
        {
            var modelName           = bindingContext.BinderModelName;
            var modelNameCheckValue = bindingContext.ValueProvider.GetValue("Has" + modelName);

            if (!bool.Parse(modelNameCheckValue.FirstValue))
            {
                return(Task.CompletedTask);
            }

            var firstName    = bindingContext.ValueProvider.GetValue(modelName + ".FirstName");
            var lastName     = bindingContext.ValueProvider.GetValue(modelName + ".LastName");
            var alive        = bindingContext.ValueProvider.GetValue(modelName + ".Alive");
            var age          = bindingContext.ValueProvider.GetValue(modelName + ".Age");
            var employer     = bindingContext.ValueProvider.GetValue(modelName + ".Employer");
            var annualIncome = bindingContext.ValueProvider.GetValue(modelName + ".AnnualIncome");

            bindingContext.ModelState.SetModelValue(modelName + ".FirstName", firstName);
            bindingContext.ModelState.SetModelValue(modelName + ".LastName", lastName);
            bindingContext.ModelState.SetModelValue(modelName + ".Alive", alive);
            bindingContext.ModelState.SetModelValue(modelName + ".Age", age);
            bindingContext.ModelState.SetModelValue(modelName + ".Employer", employer);
            bindingContext.ModelState.SetModelValue(modelName + ".AnnualIncome", annualIncome);

            switch (modelName)
            {
            case "Father":
                Father father = new Father()
                {
                    FirstName    = firstName.FirstValue,
                    LastName     = lastName.FirstValue,
                    Alive        = bool.Parse(alive.FirstValue),
                    Age          = int.Parse(age.FirstValue),
                    Employer     = employer.FirstValue,
                    AnnualIncome = decimal.Parse(annualIncome.FirstValue)
                };
                bindingContext.Result = ModelBindingResult.Success(father);
                break;

            case "Mother":
                Mother mother = new Mother()
                {
                    FirstName    = firstName.FirstValue,
                    LastName     = lastName.FirstValue,
                    Alive        = bool.Parse(alive.FirstValue),
                    Age          = int.Parse(age.FirstValue),
                    Employer     = employer.FirstValue,
                    AnnualIncome = decimal.Parse(annualIncome.FirstValue)
                };
                bindingContext.Result = ModelBindingResult.Success(mother);
                break;

            case "Guardian":
                Guardian guardian = new Guardian()
                {
                    FirstName    = firstName.FirstValue,
                    LastName     = lastName.FirstValue,
                    Alive        = bool.Parse(alive.FirstValue),
                    Age          = int.Parse(age.FirstValue),
                    Employer     = employer.FirstValue,
                    AnnualIncome = decimal.Parse(annualIncome.FirstValue)
                };
                bindingContext.Result = ModelBindingResult.Success(guardian);
                break;
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 6
0
 public void Update_Mother(Mother m)
 {
     Remove_Mother(m);
     Add_Mother(m);
 }
Exemplo n.º 7
0
        public void AddMother(Mother newmother)
        {
            Idal mydal = FactoryDal.getDal();  //send to layer layer DAL

            mydal.AddMother(newmother);
        }
Exemplo n.º 8
0
        public void UpdateMother(Mother newmother)
        {
            Idal mydal = FactoryDal.getDal();

            mydal.UpdateMother(newmother);
        }
Exemplo n.º 9
0
        public Mother GetMotherByID(string ID)//Get Mother By ID
        {
            Mother mother = GetMothers().Find(x => x.ID == ID);

            return(mother);
        }
Exemplo n.º 10
0
        public List <Child> GetChildsByMother(Mother mother)
        {
            Idal mydal = FactoryDal.getDal();

            return(mydal.GetChildsByMother(mother));
        }
Exemplo n.º 11
0
 /// <summary>
 /// checks if the nanny is in the search area of the mother
 /// </summary>
 /// <param name="mother"></param>
 /// <param name="nAddress"></param>
 /// <returns></returns>
 private static bool NannyInRange(Mother mother, string nAddress)
 {
     return(CalculateDistance(mother.SearchArea ?? mother.Address, nAddress) <= mother.MaxDistance);
 }