public static void AddPointOfContact(User user, int EventID, int serviceID, string name, string position, string phone, string email) { bool allow = false; if (user.isSystemAdmin || user.isEventOrganizer) { allow = true; } if (!allow) { if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Manage_Items)) throw new FaultException<SException>(new SException(), new FaultReason("Invalid User, User Does Not Have Rights To Edit this Service!")); } try { DAL dalDataContext = new DAL(); Table<PointOfContact> pointOfContact = dalDataContext.pointOfContacts; PointOfContact creatingPointOfContact = new PointOfContact(serviceID, name, position, phone, email); pointOfContact.InsertOnSubmit(creatingPointOfContact); pointOfContact.Context.SubmitChanges(); } catch { throw new FaultException<SException>(new SException(), new FaultReason("An Error occured While Adding New Point of Contact, Please Try Again!")); } }
private void UpdatePointOfContact(PointOfContact poc) { try { ServiceContactHelper client = new ServiceContactHelper(); if (event_ != null) { client.EditPointOfContact(user, event_.EventID, poc.PointOfContactID, txtContactName.Text, txtContactPosition.Text, txtContactTel.Text, txtContactEmail.Text); } else { client.EditPointOfContact(user, -1, poc.PointOfContactID, txtContactName.Text, txtContactPosition.Text, txtContactTel.Text, txtContactEmail.Text); } client.Close(); MessageBox.Show("Operation Success"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DeletePointOfContact(PointOfContact poc) { try { ServiceContactHelper client = new ServiceContactHelper(); client.DeletePointOfContact(user, poc.PointOfContactID); client.Close(); MessageBox.Show("Operation Success"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }