public void AddChild(Child inputChild)
        {
            DalTools.CheckifExistsId(inputChild.ChildID); // ido
            Mother tempMom = DalTools.GetMother(inputChild.ChildMomID);

            if (tempMom == null)
            {
                throw new Exception("The child's mother does not exist in the system, please add the mother before");
            }

            XElement ChildID    = new XElement("ChildID", inputChild.ChildID);
            XElement ChildMomID = new XElement("ChildMomID", inputChild.ChildMomID);
            XElement Name       = new XElement("Name", inputChild.ChildName);

            XElement YearDate  = new XElement("YearDate", inputChild.ChildAge.Year);
            XElement MonthDate = new XElement("MonthDate", inputChild.ChildAge.Month);
            XElement DayDate   = new XElement("DayDate", inputChild.ChildAge.Day);
            XElement Age       = new XElement("Age", DayDate, MonthDate, YearDate);

            XElement ChildIsSpecialNeeds      = new XElement("IsSpecialNeeds", inputChild.ChildIsSpecialNeeds);
            XElement ChildTypesOfSpecialNeeds = new XElement("TypesOfSpecialNeeds", inputChild.ChildTypesOfSpecialNeeds);
            XElement IsHaveNanny = new XElement("IsHaveNanny", inputChild.IsHaveNanny);

            XElement Child = new XElement("Child", ChildID, ChildMomID, Name, Age, ChildIsSpecialNeeds, ChildTypesOfSpecialNeeds, IsHaveNanny);

            ChildrenXmlRoot.Add(Child);
            ChildrenXmlRoot.Save(ChildrenPath);
        }
Example #2
0
        /// <summary>
        /// add a child to database
        /// </summary>
        /// <param name="inputChild">child to add</param>
        public void AddChild(Child inputChild)
        {
            DalTools.CheckifExistsId(inputChild.ChildID); // ido
            Mother tempMom = DalTools.GetMother(inputChild.ChildMomID);

            if (tempMom == null)
            {
                throw new Exception("The child's mother does not exist in the system, please add the mother before");
            }
            DataSource.ChildsList.Add(inputChild);
        }
 public void AddNanny(Nanny inputNanny)
 {
     DalTools.CheckifExistsId(inputNanny.NannyId);
     DataSource.NanniesList.Add(inputNanny);
     SaveToXML <List <Nanny> >(DataSource.NanniesList, NanniesPath);
 }
 public void AddMom(Mother inputMother)
 {
     DalTools.CheckifExistsId(inputMother.MomID); // ido
     DataSource.MomsList.Add(inputMother);
     SaveToXML <List <Mother> >(DataSource.MomsList, MothersPath);
 }
Example #5
0
 public void AddMom(Mother inputMother)
 {
     DalTools.CheckifExistsId(inputMother.MomID); // ido
     DataSource.MomsList.Add(inputMother);
 }
Example #6
0
 public void AddNanny(Nanny inputNanny)
 {
     DalTools.CheckifExistsId(inputNanny.NannyId);
     DataSource.NanniesList.Add(inputNanny);
 }