public Control TourFindControl(object item) { Entities.Tour tour = (Entities.Tour)item; return(FindInClients(tour)); }
internal bool GetByTour(Entities.Tour tour) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id)); res = this.query.ExecuteReader("TourPaymentsGetByTourId", MapPaymentToObject, tour); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
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 Update(Entities.Tour tour) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@TourTime", Utils.GetDbTime(tour.Time.Value))); this.query.Parameters.Add(new SqlParameter("@Comments", tour.Comments)); this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id)); int affected; res = this.query.ExecuteUpdateProc("ToursUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public static void Load(Entities.Tour tour) { try { // Load group info groups.GetByTour(tour); // load group members foreach (Entities.TourGroup group in tour.Groups) { group.BaseTour = tour; DomainModel.TourGroupMembers.Load(group); DomainModel.TourGroupEmployees.Load(group); DomainModel.TourGroupServices.Load(group); } } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } }
internal static bool Save(Entities.Tour tour) { bool res = true; /* * foreach (Entities.TourPayment pay in tour.Payments) * { * if (pay.IsDirty) * { * if (pay.Id < 0) * { * if (!(res = repo.Insert(tour, pay))) break; * } * else * { * if (!(res = repo.Update(tour, pay))) break; * } * } * } * * foreach (Entities.TourPayment pay in tour.DeletedPayments) * { * if (!(res = repo.Delete(tour, pay))) break; * } */ return(res); }
internal static void Edit(Entities.Tour tour) { using (FrmTourEditor frmTourEditor = new FrmTourEditor(tour)) { frmTourEditor.ShowDialog(); } }
internal bool Delete(Entities.Tour tour, Entities.TourPayment pay) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@PaymentId", pay.Id)); int affected; res = this.query.ExecuteUpdateProc("TourPaymentDeleteById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public static bool Save(Entities.Tour tour) { bool res = true; foreach (Entities.TourGroup group in tour.Groups) { if (group.IsDirty) { if (group.Id < 0) { if (!(res = groups.Insert(tour, group))) { break; } } else { if (!(res = groups.Update(tour, group))) { break; } } } } return(res); }
private void BindControls(Entities.Tour tour) { //this.ctrlDetail.Tour = tour; this.ctrlServices.Tour = tour; //this.ctrlContacts.Tour = tour; //this.ctrlEmployees.Tour = tour; }
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(); } }
public FrmTourEditor(Entities.Tour editTour) : this() { this.editTour = editTour; if (editTour != null) { this.editTour.CopyTo(this.tour); } }
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(); }
internal static bool DeleteTour(Entities.Tour tour) { if (Controllers.MessageBox.ConfirmDelete()) { return(DomainModel.Tours.Delete(tour)); } return(false); }
public TourControl(Entities.Tour tour) : base() { InitializeComponent(); SetupControls(); BindControls(tour); }
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 void BindControls(Entities.Tour tour) { Detach(); this.tour = tour; Attach(); this.ctrlManager = new FormControlManager(this.pnlGroups, tour.Groups); this.ctrlManager.CreateControl = CreateTourGroup; this.ctrlManager.FindControl = TourGroupFindControl; this.ctrlManager.ListContainsControl = ListContainsTourGroup; UpdateData(true); }
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); }
protected void MapCostToObject(SqlDataReader reader, object userData) { Entities.TourCostDetail cost = new Entities.TourCostDetail(); cost.Id = Utils.GetSafeInt32(reader, "CostId"); cost.SignUpCount = Utils.GetSafeInt32(reader, "SignUpCount"); cost.ParticipantsCount = Utils.GetSafeInt32(reader, "ParticipantCount"); cost.CostGroup = DomainModel.TourCostGroups.GetById( Utils.GetSafeInt32(reader, "CostGroupId")); cost.IsDirty = false; Entities.Tour tour = (Entities.Tour)userData; //tour.CostDetails.Add(cost); }
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); }
protected void MapPaymentToObject(SqlDataReader reader, object userData) { Entities.TourPayment payment = new Entities.TourPayment(); payment.Id = Utils.GetSafeInt32(reader, "PaymentId"); payment.Type = DomainModel.PaymentTypes.GetById( Utils.GetSafeInt32(reader, "PaymentTypeId")); payment.Amount.Value = Utils.GetSafeDecimal(reader, "AmountValue"); payment.Amount.Currency = DomainModel.Currencies.GetById( Utils.GetSafeInt32(reader, "AmountUnitId")); payment.IsDirty = false; Entities.Tour tour = (Entities.Tour)userData; //tour.Payments.Add(payment); }
private TourControl FindInClients(Entities.Tour tour) { foreach (UserControl ctrl in this.flpTours.Controls) { TourControl grpCtrl = ctrl as TourControl; if (grpCtrl != null) { if (grpCtrl.Tour == tour) { return(grpCtrl); } } } return(null); }
protected void MapTourToObject(SqlDataReader reader, object userData) { Entities.TourCollection tours = (Entities.TourCollection)userData; Entities.Tour tour = new Entities.Tour(); tour.Id = Utils.GetSafeInt32(reader, "TourId"); tour.Time.Value = Utils.GetSafeDateTime(reader, "TourTime", DateTime.Now); tour.Comments = Utils.GetSafeString(reader, "Comments"); if (tour.Time != null) { tour.Time.IsDirty = false; } tour.IsDirty = false; tours.Add(tour); }
internal static void Load(Entities.Tour tour) { try { repo.GetByTour(tour); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } }
private async Task <IActionResult> AddSpecificTour <T>(T tour) { if (tour == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(UnprocessableEntity(new CustomizedValidationResult(ModelState))); } Entities.Tour tourEntity = null; try { tourEntity = Mapper.Map <Entities.Tour>(tour); } catch (Exception ex) { var e = ex.ToString(); } if (tourEntity.ManagerId == null || tourEntity.ManagerId == Guid.Empty) { if (!Guid.TryParse(_userInfoService.UserId, out Guid userId)) { return(BadRequest()); } tourEntity.ManagerId = userId; } await _tourManagementRepository.AddTour(tourEntity); if (await _tourManagementRepository.SaveAsync()) { return(CreatedAtRoute("GetTour", new { tourId = tourEntity.TourId }, Mapper.Map <Dtos.Tour>(tourEntity))); } else { throw new Exception("The creation of the tour failed"); } }
internal bool Update(Entities.Tour tour, Entities.TourCostDetail cost) { bool res = false; try { if (cost.Id < 0) { DomainModel.Application.Status.Update( StatusTypes.Warning, "stat_wrn_db_id_not_exists"); return(true); } this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@SignUpCount", cost.SignUpCount)); this.query.Parameters.Add(new SqlParameter("@ParticipantCount", cost.ParticipantsCount)); this.query.Parameters.Add(new SqlParameter("@CostGroupId", cost.CostGroup.Id)); this.query.Parameters.Add(new SqlParameter("@CostId", cost.Id)); this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id)); int affected; res = this.query.ExecuteUpdateProc("TourCostUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal bool Update(Entities.Tour tour, Entities.TourPayment pay) { bool res = false; try { if (pay.Id < 0) { DomainModel.Application.Status.Update( StatusTypes.Warning, "stat_wrn_db_id_not_exists"); return(true); } this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@PaymentTypeId", pay.Type.Id)); this.query.Parameters.Add(new SqlParameter("@AmountValue", pay.Amount.Value)); this.query.Parameters.Add(new SqlParameter("@AmountUnitId", pay.Amount.Currency.Id)); this.query.Parameters.Add(new SqlParameter("@PaymentId", pay.Id)); this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id)); int affected; res = this.query.ExecuteUpdateProc("TourPaymentUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public static bool Save(Entities.Tour tour) { bool res = true; /* * foreach (Entities.TourCostDetail cost in tour.CostDetails) * { * if (cost.IsDirty) * { * if (cost.Id < 0) * { * if (!(res = repo.Insert(tour, cost))) break; * } * else * { * if (!(res = repo.Update(tour, cost))) break; * } * } * }*/ return(res); }