protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoSeminarRegistrationOptionID == 0)
            {
                obj = new DojoSeminarRegistrationOption();
            }
            else
            {
                obj = new DojoSeminarRegistrationOption(dojoSeminarRegistrationOptionID);
            }

            obj.Quantity    = int.Parse(tbQuantity.Text);
            obj.TotalFee    = decimal.Parse(tbTotalFee.Text);
            obj.CostPerItem = decimal.Parse(tbCostPerItem.Text);

            if (msParentOption.SelectedItem != null && msParentOption.SelectedItem.Value != "Null")
            {
                obj.ParentOption = DojoSeminarOption.NewPlaceHolder(
                    int.Parse(msParentOption.SelectedItem.Value));
            }
            else
            {
                obj.ParentOption = null;
            }

            if (msParentRegistration.SelectedItem != null && msParentRegistration.SelectedItem.Value != "Null")
            {
                obj.ParentRegistration = DojoSeminarRegistration.NewPlaceHolder(
                    int.Parse(msParentRegistration.SelectedItem.Value));
            }
            else
            {
                obj.ParentRegistration = null;
            }

            if (editOnAdd)
            {
                dojoSeminarRegistrationOptionID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbQuantity.Text                    = string.Empty;
                tbTotalFee.Text                    = string.Empty;
                tbCostPerItem.Text                 = string.Empty;
                msParentOption.SelectedIndex       = 0;
                msParentRegistration.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Exemple #2
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoSeminarID == 0)
            {
                obj = new DojoSeminar();
            }
            else
            {
                obj = new DojoSeminar(dojoSeminarID);
            }

            obj.Name                     = tbName.Text;
            obj.StartDate                = DateTime.Parse(tbStartDate.Text);
            obj.EndDate                  = DateTime.Parse(tbEndDate.Text);
            obj.Description              = tbDescription.Text;
            obj.IsLocal                  = cbIsLocal.Checked;
            obj.ClassUnitType            = byte.Parse(tbClassUnitType.Text);
            obj.ClassUnitFee             = decimal.Parse(tbClassUnitFee.Text);
            obj.BaseRegistrationFee      = decimal.Parse(tbBaseRegistrationFee.Text);
            obj.RegistrationEnabled      = cbRegistrationEnabled.Checked;
            obj.RegistrationStart        = DateTime.Parse(tbRegistrationStart.Text);
            obj.FullEarlyRegistrationFee = decimal.Parse(tbFullEarlyRegistrationFee.Text);
            obj.EarlyEndDate             = DateTime.Parse(tbEarlyEndDate.Text);
            obj.FullRegistrationFee      = decimal.Parse(tbFullRegistrationFee.Text);
            obj.LateStartDate            = DateTime.Parse(tbLateStartDate.Text);
            obj.FullLateRegistrationFee  = decimal.Parse(tbFullLateRegistrationFee.Text);
            obj.RegistrationEnd          = DateTime.Parse(tbRegistrationEnd.Text);
            obj.Details                  = ftbDetails.Text;
            obj.DetailsOverrideUrl       = tbDetailsOverrideUrl.Text;
            obj.PdfUrl                   = tbPdfUrl.Text;

            if (msLocation.SelectedItem != null && msLocation.SelectedItem.Value != "Null")
            {
                obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations",
                                                             int.Parse(msLocation.SelectedItem.Value));
            }
            else
            {
                obj.Location = null;
            }

            if (msOptions.IsChanged)
            {
                obj.Options = new DojoSeminarOptionCollection();
                foreach (ListItem i in msOptions.Items)
                {
                    if (i.Selected)
                    {
                        obj.Options.Add(DojoSeminarOption.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (msItem.SelectedItem != null && msItem.SelectedItem.Value != "Null")
            {
                obj.Item = RHItem.NewPlaceHolder(
                    int.Parse(msItem.SelectedItem.Value));
            }
            else
            {
                obj.Item = null;
            }

            if (editOnAdd)
            {
                dojoSeminarID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbName.Text                     = string.Empty;
                tbStartDate.Text                = DateTime.Now.ToString();
                tbEndDate.Text                  = DateTime.Now.ToString();
                tbDescription.Text              = string.Empty;
                cbIsLocal.Checked               = false;
                tbClassUnitType.Text            = string.Empty;
                tbClassUnitFee.Text             = string.Empty;
                tbBaseRegistrationFee.Text      = string.Empty;
                cbRegistrationEnabled.Checked   = false;
                tbRegistrationStart.Text        = DateTime.Now.ToString();
                tbFullEarlyRegistrationFee.Text = string.Empty;
                tbEarlyEndDate.Text             = DateTime.Now.ToString();
                tbFullRegistrationFee.Text      = string.Empty;
                tbLateStartDate.Text            = DateTime.Now.ToString();
                tbFullLateRegistrationFee.Text  = string.Empty;
                tbRegistrationEnd.Text          = DateTime.Now.ToString();
                ftbDetails.Text                 = string.Empty;
                tbDetailsOverrideUrl.Text       = string.Empty;
                tbPdfUrl.Text                   = string.Empty;
                msLocation.SelectedIndex        = 0;
                msItem.SelectedIndex            = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Exemple #3
0
        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);
        }