public void AddToCart() { ShoppingCart cart = ShoppingCart.GetCart(); foreach (DojoMembership membership in memberships) { membership.Save(); cart.Lines.Add(RHFactory.SalesOrderLine(cart.Order, membership.membershipTemplate.Item, membership)); } cart.Calc(); }
/// <summary> /// /// </summary> /// <param name="e"></param> /// <param name="vm"></param> /// <param name="session"></param> /// <param name="customEqTest"></param> /// <param name="extraTest">Для сущности с таким же значением также верно это.</param> public ExistanceTester(T e, IExistTestable vm, ISession session, Expression <Func <T, bool> > customEqTest = null, Func <T, bool> extraTest = null) { Contract.Requires(e != null); Contract.Requires(vm != null); Contract.Requires(session != null); this.editing = e; this.vm = vm; this.session = session; this.expr = customEqTest ?? RHFactory.Create <T>().EqualsByVal(e); this.extraTest = extraTest ?? (x => true); // eqByVal = expr.Compile(); e.PropertyChanged += e_PropertyChanged; }
/// <summary> /// Adds a registration and options to the shopping cart. In order /// for the shopping cart and Rappahanock to process correctly, the /// registration must have an ID and be saved in the database. /// </summary> public void AddToCart() { ShoppingCart cart = ShoppingCart.GetCart(); if (registration.ID != 0) { // Add Seminar Registration cart.Lines.Add(RHFactory.SalesOrderLine(cart.Order, registration.ParentSeminar.Item, registration)); // TODO: Speedup with one hit (^^^) here rather than two! // Add Options foreach (DojoSeminarRegistrationOption option in options) { cart.Lines.Add(RHFactory.SalesOrderLine(cart.Order, option.ParentOption.Item, option)); } // Recalc Cart cart.Calc(); } }
public static RHCustomer Customer(DojoMember member) { RHCustomer customer = RHFactory.Customer(member.UserAccount); return(customer); }
protected void ok_Click(object sender, EventArgs e) { if (dojoSeminarID == 0) { editDojoSeminar = new DojoSeminar(); } else { editDojoSeminar = new DojoSeminar(dojoSeminarID); } editDojoSeminar.Name = tbName.Text; editDojoSeminar.StartDate = calStartP.SelectedDate; editDojoSeminar.EndDate = calEndP.SelectedDate; editDojoSeminar.Description = tbDescription.Text; editDojoSeminar.PdfUrl = tbPdfUrl.Text; editDojoSeminar.ClassUnitFee = decimal.Parse(tbClassUnitFee.Text); editDojoSeminar.BaseRegistrationFee = decimal.Parse(tbBaseRegistrationFee.Text); editDojoSeminar.RegistrationEnabled = cbRegistrationEnabled.Checked; editDojoSeminar.RegistrationStart = calRegStartP.SelectedDate; editDojoSeminar.FullEarlyRegistrationFee = decimal.Parse(tbFullEarlyRegistrationFee.Text); editDojoSeminar.EarlyEndDate = calEarlyEndP.SelectedDate; editDojoSeminar.FullRegistrationFee = decimal.Parse(tbFullRegistrationFee.Text); editDojoSeminar.LateStartDate = calLateStartP.SelectedDate; editDojoSeminar.FullLateRegistrationFee = decimal.Parse(tbFullLateRegistrationFee.Text); editDojoSeminar.RegistrationEnd = calRegEndP.SelectedDate; editDojoSeminar.DetailsOverrideUrl = tbDetailsOverrideUrl.Text; editDojoSeminar.ClassUnitType = (DojoSeminarClassUnitType) Enum.Parse(typeof(DojoSeminarClassUnitType), ddClassUnitType.SelectedItem.Value); editDojoSeminar.Details = tbDetails.Text; editDojoSeminar.IsLocal = cbIsLocal.Checked; if (msOptions.IsChanged) { editDojoSeminar.Options = new DojoSeminarOptionCollection(); foreach (ListItem i in msOptions.Items) { if (i.Selected) { editDojoSeminar.Options.Add(DojoSeminarOption.NewPlaceHolder(int.Parse(i.Value))); } } } /// Selects the specified location, otherwise /// creates a new location. if (comboLocation.SelectedItem != null) { editDojoSeminar.Location = GreyFoxContact.NewPlaceHolder(DojoSeminarManager.LocationTable, int.Parse(comboLocation.SelectedValue)); } else { if (comboLocation.Text != string.Empty) { GreyFoxContact location = new GreyFoxContact(DojoSeminarManager.LocationTable); location.BusinessName = comboLocation.Text; location.Save(); editDojoSeminar.Location = location; } else { editDojoSeminar.Location = null; } } // Set the Rappahanock Item, otherwise create a new // item in Rappahanock that is tied to the seminar. // This is for SalesOrder and invoicing. if (comboRappahanockItem.SelectedItem != null) { editDojoSeminar.Item = RHItem.NewPlaceHolder( int.Parse(comboRappahanockItem.SelectedValue)); } else { if (comboRappahanockItem.Text != string.Empty) { RHItem newItem = RHFactory.ServiceItem( comboRappahanockItem.Text, tbDescription.Text, decimal.Parse(tbFullRegistrationFee.Text), null); newItem.Save(); editDojoSeminar.Item = newItem; } else { editDojoSeminar.Item = null; } } if (editOnAdd) { dojoSeminarID = editDojoSeminar.Save(); } else { editDojoSeminar.Save(); } if (resetOnAdd) { tbName.Text = string.Empty; calStartP.SelectedDate = DateTime.Now; calEndP.SelectedDate = DateTime.Now; tbDescription.Text = string.Empty; tbPdfUrl.Text = string.Empty; tbClassUnitFee.Text = string.Empty; tbBaseRegistrationFee.Text = string.Empty; cbRegistrationEnabled.Checked = false; calRegStartP.SelectedDate = DateTime.Now; tbFullEarlyRegistrationFee.Text = "0"; calEarlyEndP.SelectedDate = DateTime.Now; tbFullRegistrationFee.Text = "0"; calLateStartP.SelectedDate = DateTime.Now; tbFullLateRegistrationFee.Text = "0"; calRegEndP.SelectedDate = DateTime.Now; tbDetailsOverrideUrl.Text = string.Empty; ddClassUnitType.SelectedIndex = 0; tbDetails.Text = string.Empty; cbIsLocal.Checked = false; comboLocation.Text = string.Empty; } OnUpdated(EventArgs.Empty); }