Exemplo n.º 1
0
 private void create_Click(object sender, EventArgs e)
 {
     DBHandler instance = DBHandler.getInstance();
     Group selectedGroup = new Group();
     selectedGroup.tripID = trip.ID;
     selectedGroup.name = groupName.Text;
     selectedGroup.isBus = isBus.Checked;
     selectedGroup.hasSizeLimit = hasSizeLimit.Checked;
     if (hasSizeLimit.Checked)
         selectedGroup.capacity = int.Parse(groupSize.Text);
     if (instance.insertTripGroup(trip, selectedGroup))
     {
         vt.open = false;
         vt.updateGroupList();
         Close();
     }
     else
     {
         Prompt.ShowWarningDialog("error", "error");
     }
 }
Exemplo n.º 2
0
        private void groupList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = ((ComboBox)sender).SelectedIndex;
            if(index == -1){
                return;
            }

            //updateGroupList();
            DBHandler instance = DBHandler.getInstance();
            selectedGroup = instance.getGroup((int)groupsIDs[index]);
            groupToFields();
            ShowSizeLimit();
            groupsSelectElements();
        }
Exemplo n.º 3
0
 private void createGroup_Click(object sender, EventArgs e)
 {
     DBHandler instance = DBHandler.getInstance();
     selectedGroup = new Group();
     selectedGroup.tripID = tripID;
     fieldsToGroup();
     if (instance.insertTripGroup(trip, selectedGroup))
     {
         updateGroupList();
         groupsDefaults();
     }
     else
     {
         Prompt.ShowWarningDialog("error", "error");
     }
 }
Exemplo n.º 4
0
 public bool updateGroup(Group g)
 {
     DB.groups.Attach(g);
     DB.Entry(g).State = EntityState.Modified;
     return DB.SaveChanges() > 0;
 }
Exemplo n.º 5
0
 public bool removeGroup(Group g)
 {
     DB.groups.Remove(g);
     return DB.SaveChanges() > 0;
 }
Exemplo n.º 6
0
 public bool insertTripGroup(Trip t, Group g)
 {
     DB.groups.Add(g);
     TripGroup tg = new TripGroup();
     tg.groupID = g.ID;
     tg.tripID = t.ID;
     DB.tripGroups.Add(tg);
     return DB.SaveChanges() > 0;
 }