/// <summary>
        /// this method is used to get all the personal details of employee
        /// </summary>
        /// <param name="employeeId">employee id </param>
        public async Task <EditEmployeePersonalInformationDto> GetEmployeePersonalDetails(Guid employeeId)
        {
            List <ChildrenData> childrenDataList = new List <ChildrenData>();
            List <DateTime>     childrenBirthday = new List <DateTime>();
            var employeeDetails = await _employeeRepository.GetEmployeeInformationAsync(employeeId);

            if (employeeDetails == null)
            {
                throw new Exception("Employee does not exist in the system");
            }
            var result = _mapper.Map <EditEmployeePersonalInformationDto>(employeeDetails);

            if (result.NumberOfChildren != 0)
            {
                var namesOfChildren     = JsonConvert.DeserializeObject <List <string> >(employeeDetails.NamesOfChildren);
                var childrenDateOfBirth = JsonConvert.DeserializeObject <List <string> >(employeeDetails.DateOfBirthOfChildren);
                foreach (var childDateOfBirth in childrenDateOfBirth)
                {
                    DateTime childDob = Convert.ToDateTime(childDateOfBirth);
                    childrenBirthday.Add(childDob);
                }

                for (int i = 0; i < result.NumberOfChildren; i++)
                {
                    ChildrenData childrenData = new ChildrenData();
                    childrenData.Name        = namesOfChildren[i];
                    childrenData.DateOfBirth = childrenBirthday[i];
                    childrenDataList.Add(childrenData);
                }
                result.childrenData = childrenDataList;
            }
            return(result);
        }
        public void LoadData()
        {
            if (this._listChildren == null)
            {
                this._listChildren = new ObservableCollection <ChildrenData>();
            }
            else
            {
                this._listChildren.Clear();
            }
            List <child> listOfChildren = (from o in DataProvider.Ins.DB.children join d in DataProvider.Ins.DB.parents on o.id_parent equals d.id join f in DataProvider.Ins.DB.classes on o.id_class equals f.id select o).ToList();

            foreach (child kid in listOfChildren)
            {
                ChildrenData x = new ChildrenData();
                x.id         = kid.id;
                x.Name       = kid.name;
                x.Sex        = (kid.sex == true) ? "Male" : "Female";
                x.ClassName  = [email protected];
                x.FatherName = kid.parent.FatherName;
                x.MotherName = kid.parent.Mothername;
                x.ImageURL   = kid.imageUrl;
                this._listChildren.Add(x);
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> Create(EditUserViewModel dUser)
        {
            if (ModelState.IsValid)
            {
                var result = await UserManager.CreateAsync(dUser.GetUser(), dUser.Password);

                if (result.Succeeded)
                {
                    var user = dUser.GetUser();
                    if (dUser.Role == "admin")
                    {
                        var roles = UserManager.GetRoles(user.Id);
                        foreach (var r in roles)
                        {
                            UserManager.RemoveFromRole(user.Id, r);
                        }
                        UserManager.AddToRole(user.Id, dUser.Role);
                    }

                    if (dUser.Role == "parent")
                    {
                        var roles = UserManager.GetRoles(user.Id);
                        foreach (var r in roles)
                        {
                            UserManager.RemoveFromRole(user.Id, r);
                        }
                        UserManager.AddToRole(user.Id, dUser.Role);
                    }

                    if (dUser.Role == "children")
                    {
                        var roles = UserManager.GetRoles(user.Id);
                        foreach (var r in roles)
                        {
                            UserManager.RemoveFromRole(user.Id, r);
                        }
                        UserManager.AddToRole(user.Id, dUser.Role);
                        ChildrenData data = new ChildrenData();
                        data.ChildrenId    = user.Id;
                        data.ParentId      = dUser.ParentId;
                        data.SchoolClassId = dUser.ClassId;
                        context.ChildrenData.Add(data);
                    }

                    if (dUser.Role == "teacher")
                    {
                        var roles = UserManager.GetRoles(user.Id);
                        foreach (var r in roles)
                        {
                            UserManager.RemoveFromRole(user.Id, r);
                        }
                        UserManager.AddToRole(user.Id, dUser.Role);
                    }

                    context.SaveChanges();
                    return(RedirectToAction("Details", new { id = dUser.GetUser().Id }));
                }
            }
            return(HttpNotFound());
        }
 public void LoadData(List <child> listOfChildren)
 {
     this._listChildren.Clear();
     foreach (child kid in listOfChildren)
     {
         ChildrenData x = new ChildrenData();
         x.id         = kid.id;
         x.Name       = kid.name;
         x.Sex        = (kid.sex == true) ? "Male" : "Female";
         x.ClassName  = "HHH";
         x.FatherName = kid.parent.FatherName;
         x.MotherName = kid.parent.Mothername;
         this._listChildren.Add(x);
     }
 }
        public async Task OnGetAsync(int?id, int?availableTimeDateID)
        {
            ChildrenD           = new ChildrenData();
            ChildrenD.Childrens = await _context.Children
                                  .Include(b => b.Doctor)
                                  .Include(b => b.Appointments)
                                  .ThenInclude(b => b.AvailableTimeDate)
                                  .AsNoTracking()
                                  .OrderBy(b => b.FirstName)
                                  .ToListAsync();

            if (id != null)
            {
                ChildrenID = id.Value;
                Children children = ChildrenD.Childrens
                                    .Where(i => i.ID == id.Value).Single();
                ChildrenD.AvailableTimeDates = children.Appointments.Select(s => s.AvailableTimeDate);
            }
        }
Esempio n. 6
0
        public ChildrenEntity MapFrom(ChildrenData input)
        {
            if (input == null)
            {
                throw new System.ArgumentNullException(nameof(input));
            }

            return(new ChildrenEntity
            {
                FirstName = input.FirstName,
                LastName = input.LastName,
                Relation = input.Relation,
                Day = input.Day,
                Month = input.Month,
                Year = input.Year,
                Number = input.Number,
                PostCode = input.PostCode,
                Street = input.Street,
                Town = input.Town,
                City = input.City,
            });
        }
Esempio n. 7
0
        public ChildrenData GetChildrenData(string name)
        {
            ChildrenData _children = new ChildrenData();

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            else if (name == "Correct")
            {
                _children.FirstName = "Hugo";
                _children.LastName  = "Lagos";
                _children.Day       = "1";
                _children.Month     = "January";
                _children.Year      = "2020";
                _children.Number    = "731a";
                _children.City      = "LONDON";
                _children.Town      = "";
                _children.PostCode  = "E10 5AB";
                _children.Street    = "High Road Leyton";
                _children.Relation  = "Son";
            }
            else
            {
                _children.FirstName = "";
                _children.LastName  = "";
                _children.Day       = "";
                _children.Month     = "";
                _children.Year      = "";
                _children.Number    = "";
                _children.City      = "";
                _children.Town      = "";
                _children.PostCode  = "";
                _children.Street    = "";
                _children.Relation  = "";
            }

            return(_children);
        }
Esempio n. 8
0
 public void ClickChooseChild()
 {
     PlayerPrefs.SetInt(ChildrenDataSaver.CHOOSE_CHILD, ChildrenData.IdChild);
     CurrentChildrenData = ChildrenData;
     onChooseChild?.Invoke();
 }
    public void GetChildren()
    {
        childrenDict.Clear();
        childKeys.Clear();
        numberOfChildContainers = 0;
        float xmin;
        float xmax;
        float ymin;
        float ymax;

        for (int i = 0; i < cont.childCount; i++)
        {
            if ((RootContainer && cont.GetChild(i).gameObject.GetComponent <FlexContainer>()) || ChildContainer)
            {
                ChildrenData cd = new ChildrenData();
                if (cont.GetChild(i).gameObject.GetComponent <FlexChildren>() == null)
                {
                    cont.GetChild(i).gameObject.AddComponent <FlexChildren>();
                }
                if (cont.GetChild(i).gameObject.GetComponent <FlexContainer>() != null)
                {
                    numberOfChildContainers++;
                    cd.nestedContainer = true;
                }
                cd.childRect = cont.GetChild(i).gameObject.GetComponent <RectTransform>();
                if (cont.GetChild(i).gameObject.GetComponent <FlexChildren>().constraintTypeIndex.x == 0)
                {
                    ymin = 0;
                }
                else
                {
                    ymin = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().containerConstraintsHeightx;
                }
                if (cont.GetChild(i).gameObject.GetComponent <FlexChildren>().constraintTypeIndex.y == 0)
                {
                    ymax = Mathf.Infinity;
                }
                else
                {
                    ymax = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().containerConstraintsHeighty;
                }
                if (cont.GetChild(i).gameObject.GetComponent <FlexChildren>().constraintTypeIndex.z == 0)
                {
                    xmin = 0;
                }
                else
                {
                    xmin = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().containerConstraintsWidthx;
                }
                if (cont.GetChild(i).gameObject.GetComponent <FlexChildren>().constraintTypeIndex.w == 0)
                {
                    xmax = Mathf.Infinity;
                }
                else
                {
                    xmax = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().containerConstraintsWidthy;
                }
                cd.childHeightMinMax = new Vector2(ymin, ymax);
                cd.childWidthMinMax  = new Vector2(xmin, xmax);
                cd.childFlexGrow     = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().childFlexGrow;
                cd.childFlexShrink   = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().childFlexShrink;
                // cd.childOrder = cont.GetChild(i).gameObject.GetComponent<FlexChildren>().childOrder;
                cd.flexBasisType = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().childFlexTypeIndex;
                if (cd.flexBasisType == 2)
                {
                    cd.childFlexBasis = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().flexBasisSize;
                }
                //Im automating childOrder, need to distinguish between auto and manual
                cd.childOrder = i;
                cont.GetChild(i).gameObject.GetComponent <FlexChildren>().childOrder = i;
                cd.autoHeight = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().autoHeight;
                cd.autoWidth  = cont.GetChild(i).gameObject.GetComponent <FlexChildren>().autoWidth;
                childrenDict.Add(cont.GetChild(i).gameObject.GetInstanceID(), cd);

                childKeys.Add(cont.GetChild(i).gameObject.GetInstanceID());
            }
        }
        childrenDict = childrenDict.OrderBy(x => x.Value.childOrder).ToDictionary(x => x.Key, x => x.Value);
    }