Пример #1
0
        public void removeGroup(Group group)
        {
            try {
                CarpoolingDAL.Group g = db.Groups.Single(o => o.idGroup == group.Id);
                db.Groups.DeleteOnSubmit(g);
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
Пример #2
0
        public Group getGroupById(int idGroup)
        {
            CarpoolingDAL.Group g = new CarpoolingDAL.Group();
            try {
                var query = db.Groups.Where(o => o.idGroup == idGroup).First();
                g = query as CarpoolingDAL.Group;
            } catch (Exception) {
                g = null;
            }

            return RepositoryUtility.createGroupFromDALGroup(g);
        }
Пример #3
0
        public Group getGroupById(int idGroup)
        {
            CarpoolingDAL.Group g = new CarpoolingDAL.Group();
            try {
                var query = db.Groups.Where(o => o.idGroup == idGroup).First();
                g = query as CarpoolingDAL.Group;
            } catch (Exception) {
                g = null;
            }

            return(RepositoryUtility.createGroupFromDALGroup(g));
        }
Пример #4
0
 public void addGroupMember(GroupMember groupMember, Group group)
 {
     try {
         db.GroupMembers.InsertOnSubmit(RepositoryUtility.createDALGroupMemberFromGroupMember(groupMember, group));
         db.SubmitChanges();
     } catch (Exception) {
         //TODO saznaj koje su iznimke
         //iznimka se generira ako se narusi bilo koje pravilo vezano uz primary key ili foreign key. Znači, iznimka se
         //generira ako se pokuša dodati osoba koja ima JMBAG koji koristi neka druga osoba, zatim ako se pod osoba.sifUloga
         //stavi neki broj kojeg nema u tablici Uloga, itd..
         //return false;
     }
     //return true;
 }
Пример #5
0
        public void updateGroup(Group group)
        {
            try {
                CarpoolingDAL.Group oldOne = db.Groups.Single(o => o.idGroup == group.Id);
                oldOne.destinationRange = group.DestinationRange.RangeDim;
                oldOne.groupType        = group.Type.Id;
                oldOne.route            = group.Route.Id;
                oldOne.startRange       = group.StartRange.RangeDim;
                oldOne.startTime        = group.StartTime;
                oldOne.totalCost        = group.TotalCost;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
 partial void DeleteGroup(Group instance);
 partial void UpdateGroup(Group instance);
 partial void InsertGroup(Group instance);
		private void detach_Groups(Group entity)
		{
			this.SendPropertyChanging();
			entity.Route1 = null;
		}
		private void attach_Groups(Group entity)
		{
			this.SendPropertyChanging();
			entity.Route1 = this;
		}
Пример #11
0
        public List<GroupMember> getGroupMembers(Group group)
        {
            List<GroupMember> listMem = new List<GroupMember>();
            var members = db.GroupMembers.Where(s => s.idGroup == group.Id);

            foreach (CarpoolingDAL.GroupMember mem in members) {
                listMem.Add(RepositoryUtility.createGroupMemberFromDALGroupMember(mem as CarpoolingDAL.GroupMember));
            }
            return listMem;
        }
Пример #12
0
        public void updateGroup(Group group)
        {
            try {
                CarpoolingDAL.Group oldOne = db.Groups.Single(o => o.idGroup == group.Id);
                oldOne.destinationRange = group.DestinationRange.RangeDim;
                oldOne.groupType = group.Type.Id;
                oldOne.route = group.Route.Id;
                oldOne.startRange = group.StartRange.RangeDim;
                oldOne.startTime = group.StartTime;
                oldOne.totalCost = group.TotalCost;
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }
Пример #13
0
        public void removeGroup(Group group)
        {
            try {
                CarpoolingDAL.Group g = db.Groups.Single(o => o.idGroup == group.Id);
                db.Groups.DeleteOnSubmit(g);
                db.SubmitChanges();
            } catch (Exception) {
                //return false;
            }

            //return true;
        }