private void btnComplete_Click(object sender, EventArgs e) { var pudoService = new RelOrderPickUpDropOffLocationService(); var pudo = new RelOrderPickUpDropOffLocation(); if (isNewRecord) { pudo.ReleaseOrderId = My.MyProject.Forms.FrmUpdateReqStatus.SelectedReleaseOrder.ReleaseOrderId; } else { pudo = RelOrderPickUpDropOffLocationService.GetById(relPuDol.RelOrderPickUpDropOffLocationId); } pudo.PickUpTerminalId = Conversions.ToInteger(cbPickUp.SelectedValue); pudo.DropOffYardLocationId = Conversions.ToInteger(cbDropOff.SelectedValue); pudo.QtyPickUpDropOff = (int)Math.Round(nudQtyCans.Value); if (pudoService.AddOrUpdate(pudo)) { Close(); } else { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("An error occurred", "Something happened and the information was not saved", this); } }
public bool AddOrUpdate(RelOrderPickUpDropOffLocation relOrderPickUpDropOffLocation) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { db.RelOrderPickUpDropOffLocation.AddOrUpdate(relOrderPickUpDropOffLocation); db.SaveChanges(); } catch (Exception ex) { string msg = ex.InnerException.Message; isSaved = false; } } return(isSaved); }
public bool Delete(int RelOrderPickUpDropOffLocationId) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { RelOrderPickUpDropOffLocation rel = db.RelOrderPickUpDropOffLocation.Find(RelOrderPickUpDropOffLocationId); db.RelOrderPickUpDropOffLocation.Remove(rel); db.SaveChanges(); } catch (Exception ex) { string msg = ex.InnerException.Message; isSaved = false; } } return(isSaved); }
public bool AddOrUpdate(RelOrderPickUpDropOffLocation relOrderPickUpDropOffLocation) { return(repository.AddOrUpdate(relOrderPickUpDropOffLocation)); }