private void manageTripCreate_Click(object sender, EventArgs e) { DBHandler instance = DBHandler.getInstance(); trip = new Trip(); fieldsTotrip(); //validations goes here bool valid = true; string msg=""; //end validations if(valid){ instance.insertTrip(trip); Prompt.ShowWarningDialog("تم انشاء الرحله بنجاح", "تم"); menu.updateList(); menu.Show(); Close(); } else { Prompt.ShowWarningDialog(msg, "تحذير"); } }
private void manageTrip_Load(object sender, EventArgs e) { switch (state) { case State.create: Text = "انشاء رحلة"; showCreateButtons(); break; case State.edit: DBHandler instance = DBHandler.getInstance(); trip = instance.getTrip(tripID); Text = "ادارة رحلة"; tripToFields(); showBasicButtons(); break; } CenterToScreen(); }
public void setTrip(Trip trip, ViewTrip vt) { this.trip = trip; this.vt = vt; }
private void ViewTrip_Load(object sender, EventArgs e) { DBHandler instance = DBHandler.getInstance(); trip = instance.getTrip(tripID); tripToFields(); updateGroupList(); CenterToScreen(); clientsDefaults(); tabControl1.SelectedIndexChanged += tabControl1_SelectedIndexChanged; }
public bool updateTrip(Trip t) { DB.trips.Attach(t); DB.Entry(t).State = EntityState.Modified; return DB.SaveChanges() > 0; }
public bool removeTrip(Trip t) { t.isDeleted = true; DB.Entry(t).State = EntityState.Modified; return DB.SaveChanges() > 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; }
public bool insertTrip(Trip t) { DB.trips.Add(t); return DB.SaveChanges() > 0; }
public bool insertResrvation(Client c, Trip t, Reservation r) { insertClient(c); // Reservation r = new Reservation(); r.clientID = c.ID; r.tripID = t.ID; t.nextTicketID++; DB.trips.Attach(t); DB.Entry(t).State = EntityState.Modified; DB.reservations.Add(r); return DB.SaveChanges() > 0; }