public bool Update(Entities.Tour tour, Entities.TourGroup group) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@SignupTypeId", group.SignUpType.Id)); this.query.Parameters.Add(new SqlParameter("@StateTypeId", group.Status.Id)); this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id)); this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id)); int affected; res = this.query.ExecuteUpdateProc("TourGroupstUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal bool GetByGroup(Entities.TourGroup group) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id)); res = this.query.ExecuteReader("TourGroupMemberGetByGroupId", MapMemberToObject, group); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal static bool Load(Entities.TourGroup group) { bool res = false; try { res = repo.Load(group); foreach (ITourService service in group.Services) { service.BaseGroup = group; if (!(res = DomainModel.TourGroupServicePayments.Load(service))) { break; } if (!(res = DomainModel.TourGroupServiceCosts.Load(service))) { break; } } } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public Control TourGroupFindControl(object item) { Entities.TourGroup group = (Entities.TourGroup)item; return(FindInClients(group)); }
private void BindControls(Entities.TourGroup group) { this.ctrlDetail.Group = group; this.ctrlServices.Group = group; this.ctrlContacts.Group = group; this.ctrlEmployees.Group = group; }
internal bool Insert(Entities.TourGroup group, Entities.TourServiceBase service) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id)); this.query.Parameters.Add(new SqlParameter("@ServiceId", service.Detail.Id)); int id; res = this.query.ExecuteInsertProc("TourGroupServiceAdd", out id); service.Id = id; } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public static bool Add(Entities.TourGroup group, Entities.Employee emp) { bool res; try { if ((res = empRepo.Insert(group, emp))) { group.Employees.Add(emp); } } catch (Exception ex) { res = false; try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal bool Insert(Entities.TourGroup group, Entities.Employee employee) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id)); this.query.Parameters.Add(new SqlParameter("@EmployeeId", employee.User.Id)); int ret; res = this.query.ExecuteInsertProc("TourGroupEmployeesAdd", out ret); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal static void AddMember(Entities.TourGroup tourGroup) { using (FrmTourMemberEditor frm = new FrmTourMemberEditor(tourGroup)) { frm.ShowDialog(); } }
internal bool Delete(Entities.TourGroup group, Entities.TourMember member) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@PersonId", member.Id)); this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id)); int affected; res = this.query.ExecuteUpdateProc("TourGroupMemberDeleteById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
private void Detach(Entities.TourGroup group) { if (group != null && group.Members != null) { group.Members.ListChanged -= new ListChangedEventHandler(Members_ListChanged); } }
internal static void AddNew(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType) { using (FrmGroupServiceEditor frm = new FrmGroupServiceEditor(tour, group, serviceType)) { frm.ShowDialog(); } }
internal static void Edit(Entities.Tour tour, Entities.TourGroup group, Entities.Abstract.ITourService service) { using (FrmGroupServiceEditor frm = new FrmGroupServiceEditor( tour, group, (Entities.TourServiceBase)service)) { frm.ShowDialog(); } }
void Groups_AddButtonClick(object sender, EventArgs e) { Entities.TourGroup group = Presentation.Controllers.Tours.AddGroup(this.Tour); if (group != null) { group.Services.ListChanged += new ListChangedEventHandler(Services_ListChanged); } }
internal static bool DeleteGroup(Entities.TourGroup group) { if (Controllers.MessageBox.ConfirmDelete()) { return(DomainModel.TourGroups.Delete(group)); } return(false); }
public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.TourServiceBase service) { this.editService = service; CreateService(tour, group); service.CopyTo(this.service); Init(); }
public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType) { this.group = group; CreateService(tour, group); this.service.Detail.ServiceType = serviceType; Init(); }
public static bool Delete(Entities.TourGroup group, Entities.TourMember member) { bool res = true; try { using (TransactionScope ts = new TransactionScope()) { if (DomainModel.Phonebook.Contains(member)) { // Remove only relation if (res) { res = groupMembers.Delete(group, member); } } else { foreach (Entities.Contact contact in member.Contacts) { if (!(res = contacts.Delete(contact))) { break; } } if (res) { res = groupMembers.Delete(group, member); } if (res) { res = members.Delete(member); } } if (res) { ts.Complete(); } } } catch (Exception ex) { res = false; try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal static void Delete(Entities.TourGroup tourGroup, Entities.Abstract.ITourService service) { if (Controllers.MessageBox.ConfirmDelete()) { if (DomainModel.TourGroupServices.Delete(service)) { tourGroup.Services.Remove(service); } } }
public static bool Delete(Entities.TourGroup group) { bool res = true; try { using (TransactionScope ts = new TransactionScope()) { foreach (Entities.TourMember member in group.Members) { if (!(res = DomainModel.TourGroupMembers.Delete(group, member))) { return(res); } } foreach (Entities.Employee emp in group.Employees) { if (!(res = DomainModel.TourGroupEmployees.Delete(group, emp))) { return(res); } } foreach (ITourService srv in group.Services) { if (!(res = DomainModel.TourGroupServices.Delete(srv))) { return(res); } } if (res) { res = groups.Delete(group); } ts.Complete(); } } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
protected void MapTourEmployeesToObject(SqlDataReader reader, object userData) { Entities.User user = DomainModel.Membership.Users.GetById( Utils.GetSafeInt32(reader, "EmployeeId")); Entities.Employee emp = new Entities.Employee(user); emp.IsDirty = false; Entities.TourGroup group = (Entities.TourGroup)userData; group.Employees.Add(emp); }
protected void MapServiceToObject(SqlDataReader reader, object userData) { Entities.TourServiceBase service = new Entities.TourServiceBase(); service.Id = Utils.GetSafeInt32(reader, "GroupServiceId"); service.Detail = DomainModel.Services.GetById(Utils.GetSafeInt32(reader, "ServiceId")); service.IsDirty = false; Entities.TourGroup group = (Entities.TourGroup)userData; group.Services.Add(service); }
private void CreateService(Entities.Tour tour, Entities.TourGroup group) { this.service = new Entities.TourServiceBase( DomainModel.TourCostGroups.GetAll()); this.service.PaymentStrategy = new DomainModel.PaymentStrategies.NormalStrategy( new Entities.PaymentStrategyInfo( tour, group, this.service)); }
private Image GetSignupTypeImage(Entities.TourGroup group) { switch (group.SignUpType.Id) { case 4: // Tourism office return(this.sginupTypeImages["tourism_office"]); case 5: // E-Mail return(this.sginupTypeImages["email"]); } return(null); }
private Image GetGroupStateImage(Entities.TourGroup group) { switch (group.Status.Id) { case 14: // reserved return(this.groupStateImages["reserved"]); case 15: // confirmed return(this.groupStateImages["confirmed"]); } return(null); }
protected void MapGroupToObject(SqlDataReader reader, object userData) { Entities.TourGroup group = new Entities.TourGroup(); group.Id = Utils.GetSafeInt32(reader, "GroupId"); group.SignUpType = DomainModel.SignUpTypes.GetById( Utils.GetSafeInt32(reader, "SignupTypeId")); group.Status = DomainModel.TourStates.GetById( Utils.GetSafeInt32(reader, "StateTypeId")); group.IsDirty = false; Entities.Tour tour = (Entities.Tour)userData; tour.Groups.Add(group); }
internal static Entities.TourGroup AddGroup(Entities.Tour tour) { Entities.TourGroup group = new Entities.TourGroup(); group.Status = DomainModel.TourStates.GetByIndex(0); group.SignUpType = DomainModel.SignUpTypes.GetByIndex(0); tour.Groups.Add(group); if (!DomainModel.TourGroups.Save(tour)) { tour.Groups.Remove(group); return(null); } return(group); }
private TourGroup FindInClients(Entities.TourGroup group) { foreach (UserControl ctrl in this.pnlGroups.Controls) { TourGroup grpCtrl = ctrl as TourGroup; if (grpCtrl != null) { if (grpCtrl.Group == group) { return(grpCtrl); } } } return(null); }
protected void MapMemberToObject(SqlDataReader reader, object userData) { Entities.TourMember member = new Entities.TourMember(); member.Id = Utils.GetSafeInt32(reader, "MemberId"); member.Title = DomainModel.PersonTitleTypes.GetById( Utils.GetSafeInt32(reader, "TitleId")); member.FirstName = Utils.GetSafeString(reader, "FirstName"); member.LastName = Utils.GetSafeString(reader, "LastName"); member.MemberShip = DomainModel.TourMembershipTypes.GetById( Utils.GetSafeInt32(reader, "MembershipType")); member.IsDirty = false; Entities.TourGroup group = (Entities.TourGroup)userData; group.Members.Add(member); }
internal static void Load(Entities.TourGroup group) { try { empRepo.GetByGroup(group); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } }