public void RemoveGroup()
        {
            GroupDao groupDao = new GroupDao();

            groupDao.MakeConnection(Properties.Resources.strConnection);
            List <GroupDto> groups = (List <GroupDto>)mainWindow.GroupData;

            groupDao.DeleteById(groups[mainWindow.SelectIndexGroup].Id);
        }
        public void LoadGroup()
        {
            GroupDao groupDao = new GroupDao();

            groupDao.MakeConnection(Properties.Resources.strConnection);
            mainWindow.GroupData = groupDao.ReadData(((App)Application.Current).UserName, mainWindow.SearchGroup);
            List <dynamic> groupShowList = new List <dynamic>();
            int            count         = 1;

            foreach (GroupDto groupDto in groupDao.ReadData(((App)Application.Current).UserName, mainWindow.SearchGroup))
            {
                groupShowList.Add(new { NO = count, Name = groupDto.Name, Description = groupDto.Description });
                count++;
            }
            mainWindow.DataGroup = groupShowList;
        }
        public bool AddGroup()
        {
            if (detailWindow.DetailName.Length == 0)
            {
                detailWindow.Status = "Group name is empty";
                return(false);
            }
            GroupDao groupDao = new GroupDao();

            groupDao.MakeConnection(Properties.Resources.strConnection);
            GroupDto groupDto = new GroupDto();

            groupDto.Name        = detailWindow.DetailName;
            groupDto.Description = detailWindow.Desciption;
            groupDto.UserID      = ((App)Application.Current).UserName;
            return(groupDao.Create(groupDto));
        }
        public bool UpdateGroup()
        {
            if (detailWindow.DetailName.Length == 0)
            {
                detailWindow.Status = "Group name is empty";
                return(false);
            }
            GroupDao groupDao = new GroupDao();

            groupDao.MakeConnection(Properties.Resources.strConnection);
            GroupDto groupDto = new GroupDto();

            groupDto.Name        = detailWindow.DetailName;
            groupDto.Description = detailWindow.Desciption;
            groupDto.Id          = detailWindow.Id;
            return(groupDao.Update(groupDto));
        }
        public void LoadGroup()
        {
            GroupDao groupDao = new GroupDao();

            groupDao.MakeConnection(Properties.Resources.strConnection);
            addEventWindow.GroupData = groupDao.LoadListGroupName(((App)Application.Current).UserName);
            List <CheckBox> groupShowList = new List <CheckBox>();
            int             count         = 1;

            foreach (GroupDto groupDto in groupDao.LoadListGroupName(((App)Application.Current).UserName))
            {
                CheckBox checkBox = new CheckBox();
                checkBox.Content = count + " " + groupDto.Name;
                groupShowList.Add(checkBox);
                count++;
            }
            addEventWindow.Group = groupShowList;
        }