Exemplo n.º 1
0
        public IEnumerable<DiciplineWrapper> GetDiciplinesByUserId(Guid user)
        {
            DiciplineTableAdapter ta=new DiciplineTableAdapter();
            DBDataSet.DiciplineDataTable tbl = ta.GetDataByUserId(user);

            return tbl.Select(row => new DiciplineWrapper(){Name = row.Name,DiciplineId = row.DiciplineId});
        }
Exemplo n.º 2
0
        public IEnumerable<DiciplineWrapper> GetDiciplines()
        {
            DiciplineTableAdapter adapter = new DiciplineTableAdapter();
            DBDataSet.DiciplineDataTable tbl = adapter.GetData();

            return tbl.Select(d => new DiciplineWrapper(){DiciplineId = d.DiciplineId,Name = d.Name});
        }
Exemplo n.º 3
0
        public void UpdateUser(UserWrapper user)
        {
            UserTableAdapter adapter=new UserTableAdapter();
            adapter.Update(user.UserID, user.FirstName, user.LastName, user.BirthDate, user.Role,
                           user.UserName, user.Password);

            DiciplineTableAdapter da = new DiciplineTableAdapter();

            foreach (var diciplineWrapper in user.Dicipline)
            {
                da.InsertInterest(user.UserID, diciplineWrapper.DiciplineId);
            }

            SubscriptionTableAdapter sa = new SubscriptionTableAdapter();

            foreach (var subWrapper in user.Subscriptions)
            {
                sa.Insert(subWrapper.UnitCode, subWrapper.UserId);
            }
        }
Exemplo n.º 4
0
        public void AddUser(UserWrapper user)
        {
            UserTableAdapter adapter=new UserTableAdapter();
            adapter.Insert(user.FirstName, user.LastName, user.BirthDate, user.Role, user.UserName, user.Password,
                           user.Salt);

            DBDataSet.UserDataTable res = adapter.GetData(user.UserName);

            DiciplineTableAdapter da=new DiciplineTableAdapter();
            foreach (var diciplineWrapper in user.Dicipline)
            {
                da.InsertInterest(res.FirstOrDefault().UserID, diciplineWrapper.DiciplineId);
            }

            SubscriptionTableAdapter sa=new SubscriptionTableAdapter();
            foreach (var subWrapper in user.Subscriptions)
            {
                sa.Insert(subWrapper.UnitCode, subWrapper.UserId);
            }
        }
Exemplo n.º 5
0
 public DiciplineWrapper GetDicipline(string unitCode)
 {
     DiciplineTableAdapter adapter = new DiciplineTableAdapter();
     DBDataSet.DiciplineDataTable tbl = adapter.GetDataById(unitCode);
     return tbl.Select(d => new DiciplineWrapper() { DiciplineId = d.DiciplineId, Name = d.Name }).FirstOrDefault();
 }