internal bool Update(Entities.TourServiceBase service, Entities.TourCostDetail cost) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@GroupServiceId", service.Id)); this.query.Parameters.Add(new SqlParameter("@CostGroupId", cost.CostGroup.Id)); this.query.Parameters.Add(new SqlParameter("@SignUpCount", cost.SignUpCount)); this.query.Parameters.Add(new SqlParameter("@ParticipantsCount", cost.ParticipantsCount)); this.query.Parameters.Add(new SqlParameter("@CostId", cost.Id)); int affected; res = this.query.ExecuteUpdateProc("TourGroupServiceCostUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal bool Update(Entities.TourServiceBase service, Entities.TourPayment payment) { bool res = false; try { this.query.Parameters.Clear(); this.query.Parameters.Add(new SqlParameter("@ServiceId", service.Id)); this.query.Parameters.Add(new SqlParameter("@PaymentTypeId", payment.Type.Id)); this.query.Parameters.Add(new SqlParameter("@AmountValue", payment.Amount.Value)); this.query.Parameters.Add(new SqlParameter("@AmountUnitId", payment.Amount.Currency.Id)); this.query.Parameters.Add(new SqlParameter("@PaymentId", payment.Id)); int affected; res = this.query.ExecuteUpdateProc("TourGroupServicePaymentUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
internal bool Update(/*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)); this.query.Parameters.Add(new SqlParameter("@GroupServiceId", service.Id)); int affected; res = this.query.ExecuteUpdateProc("TourGroupServiceUpdateById", out affected); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public GroupServiceDetails(Entities.TourServiceBase service) { InitializeComponent(); this.service = service; SetupControls(); BindControls(); }
internal static bool Save(Entities.TourServiceBase service) { bool res = true; try { using (TransactionScope ts = new TransactionScope()) { foreach (Entities.TourPayment payment in service.Payments) { if (payment.IsDirty) { if (payment.Id < 0) { if (!(res = repo.Insert(service, payment))) { break; } } else { if (!(res = repo.Update(service, payment))) { break; } } } } foreach (Entities.TourPayment payment in service.DeletedPayments) { if (!(res = repo.Delete(payment))) { break; } } if (res) { ts.Complete(); } } } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }
public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.TourServiceBase service) { this.editService = service; CreateService(tour, group); service.CopyTo(this.service); Init(); }
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)); }
public GroupServiceBill(Entities.TourServiceBase service) { InitializeComponent(); this.Dock = DockStyle.Fill; this.service = service; this.rlvBill = new TourReceiptListView(); this.rlvBill.SetDataSource(this.service.Bill); this.tlpMain.Controls.Add(this.rlvBill, 0, 1); this.tlpMain.SetColumnSpan(this.rlvBill, 2); }
public GroupServicePayment(Entities.TourServiceBase service) { InitializeComponent(); this.Dock = DockStyle.Fill; this.service = service; this.dgvPayments = new TourPaymentsGridView(this.service.Payments); this.etbPayments = new EditToolbar( DomainModel.Application.ResourceManager.GetText("tab_title_Payments")); this.etbPayments.ButtonAutohide = false; this.tlpMain.Controls.Add(this.etbPayments, 0, 0); this.tlpMain.Controls.Add(this.dgvPayments, 0, 1); this.etbPayments.AddButtonClick += new System.EventHandler(etbPayments_AddButtonClick); this.etbPayments.EditButtonClick += new System.EventHandler(etbPayments_EditButtonClick); this.etbPayments.DeleteButtonClick += new System.EventHandler(etbPayments_DeleteButtonClick); this.tlpMain.BackColor = Presentation.View.Theme.GroupPanelBackColor; }
public static bool Save(Entities.TourGroup group, Entities.TourServiceBase service) { bool res = false; try { if (service.IsDirty) { using (TransactionScope ts = new TransactionScope()) { if (service.Id < 0) { res = repo.Insert(group, service); } else { res = repo.Update(service); } if (res) { res = DomainModel.TourGroupServicePayments.Save(service); } if (res) { res = DomainModel.TourGroupServiceCosts.Save(service); } if (res) { ts.Complete(); } } if (group != null && !group.Services.Contains(service)) { group.Services.Add(service); } if (res) { service.IsDirty = false; } } else { res = true; } } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }