Example #1
0
        /// <summary>
        /// Saves the DojoOrganization object state to the database.
        /// </summary>
        public int Save()
        {
            if (classLocations != null)
            {
                foreach (GreyFoxContact item in classLocations)
                {
                    item.Save();
                }
            }
            if (administrativeContact != null)
            {
                administrativeContact.Save();
            }

            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoOrganizationManager._insert(this);
            }
            else
            {
                DojoOrganizationManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Example #2
0
        /// <summary>
        /// Saves the DojoSeminar object state to the database.
        /// </summary>
        public int Save()
        {
            if (location != null)
            {
                location.Save();
            }
            if (options != null)
            {
                foreach (DojoSeminarOption item in options)
                {
                    item.Save();
                }
            }

            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoSeminarManager._insert(this);
            }
            else
            {
                DojoSeminarManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Example #3
0
        /// <summary>
        /// Saves the DojoClassDefinition object state to the database.
        /// </summary>
        public int Save()
        {
            if (instructor != null)
            {
                instructor.Save();
            }
            if (location != null)
            {
                location.Save();
            }

            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoClassDefinitionManager._insert(this);
            }
            else
            {
                DojoClassDefinitionManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
        /// <summary>
        /// Saves the DojoSeminarRegistration object state to the database.
        /// </summary>
        public int Save()
        {
            if (parentSeminar != null)
            {
                parentSeminar.Save();
            }
            if (contact != null)
            {
                contact.Save();
            }

            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoSeminarRegistrationManager._insert(this);
            }
            else
            {
                DojoSeminarRegistrationManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Example #5
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (greyFoxContactID == 0)
            {
                editGreyFoxContact = new GreyFoxContact(GreyFoxContactTable);
            }
            else
            {
                editGreyFoxContact = new GreyFoxContact(GreyFoxContactTable, GreyFoxContactID);
            }

            editGreyFoxContact.Prefix             = tbPrefix.Text;
            editGreyFoxContact.FirstName          = tbFirstName.Text;
            editGreyFoxContact.MiddleName         = tbMiddleName.Text;
            editGreyFoxContact.LastName           = tbLastName.Text;
            editGreyFoxContact.Suffix             = tbSuffix.Text;
            editGreyFoxContact.SuffixCommaEnabled = bool.Parse(tbSuffixCommaEnabled.Text);
            editGreyFoxContact.BusinessName       = tbBusinessName.Text;
            editGreyFoxContact.Title         = tbTitle.Text;
            editGreyFoxContact.Address1      = tbAddress1.Text;
            editGreyFoxContact.Address2      = tbAddress2.Text;
            editGreyFoxContact.City          = tbCity.Text;
            editGreyFoxContact.StateProvince = tbStateProvince.Text;
            editGreyFoxContact.PostalCode    = tbPostalCode.Text;
            editGreyFoxContact.Country       = tbCountry.Text;
            editGreyFoxContact.HomePhone     = tbHomePhone.Text;
            editGreyFoxContact.WorkPhone     = tbWorkPhone.Text;
            editGreyFoxContact.MobilePhone   = tbMobilePhone.Text;
            editGreyFoxContact.Pager         = tbPager.Text;
            editGreyFoxContact.Fax           = tbFax.Text;
            editGreyFoxContact.Email1        = tbEmail1.Text;
            editGreyFoxContact.Email2        = tbEmail2.Text;
            editGreyFoxContact.Url           = tbUrl.Text;
            editGreyFoxContact.MemoText      = tbMemoText.Text;
            editGreyFoxContact.BirthDate     = DateTime.Parse(tbBirthDate.Text);
            editGreyFoxContact.ContactMethod =
                (GreyFoxContactMethod)byte.Parse(tbContactMethod.Text);

            greyFoxContactID = editGreyFoxContact.Save();

            OnUpdated(EventArgs.Empty);
        }
Example #6
0
        /// <summary>
        /// Saves the GreyFoxUser object state to the database.
        /// </summary>
        public int Save()
        {
            lock (this)
            {
                if (contact != null)
                {
                    contact.Save();
                }
                if (roles != null)
                {
                    foreach (GreyFoxRole item in roles)
                    {
                        item.Save();
                    }
                }

                if (isSynced)
                {
                    return(iD);
                }

                if (iD == -1)
                {
                    throw (new Exception("Invalid record; cannot be saved."));
                }
                if (iD == 0)
                {
                    iD = GreyFoxUserManager._insert(this);
                }
                else
                {
                    GreyFoxUserManager._update(this);
                }
                isSynced = iD != -1;
            }
            return(iD);
        }
Example #7
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (greyFoxContactID == 0)
            {
                obj = new GreyFoxContact(greyFoxContactTable);
            }
            else
            {
                obj = new GreyFoxContact(greyFoxContactTable, greyFoxContactID);
            }

            obj.DisplayName        = tbDisplayName.Text;
            obj.Prefix             = tbPrefix.Text;
            obj.FirstName          = tbFirstName.Text;
            obj.MiddleName         = tbMiddleName.Text;
            obj.LastName           = tbLastName.Text;
            obj.SuffixCommaEnabled = cbSuffixCommaEnabled.Checked;
            obj.Suffix             = tbSuffix.Text;
            obj.Title           = tbTitle.Text;
            obj.ValidationFlags = byte.Parse(tbValidationFlags.Text);
            obj.ValidationMemo  = tbValidationMemo.Text;
            obj.Address1        = tbAddress1.Text;
            obj.Address2        = tbAddress2.Text;
            obj.City            = tbCity.Text;
            obj.StateProvince   = tbStateProvince.Text;
            obj.Country         = tbCountry.Text;
            obj.PostalCode      = tbPostalCode.Text;
            obj.HomePhone       = tbHomePhone.Text;
            obj.WorkPhone       = tbWorkPhone.Text;
            obj.Fax             = tbFax.Text;
            obj.Pager           = tbPager.Text;
            obj.MobilePhone     = tbMobilePhone.Text;
            obj.Email1          = tbEmail1.Text;
            obj.Email2          = tbEmail2.Text;
            obj.Url             = tbUrl.Text;
            obj.BusinessName    = tbBusinessName.Text;
            obj.MemoText        = tbMemoText.Text;
            obj.BirthDate       = DateTime.Parse(tbBirthDate.Text);

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

            if (resetOnAdd)
            {
                tbDisplayName.Text           = string.Empty;
                tbPrefix.Text                = string.Empty;
                tbFirstName.Text             = string.Empty;
                tbMiddleName.Text            = string.Empty;
                tbLastName.Text              = string.Empty;
                cbSuffixCommaEnabled.Checked = false;
                tbSuffix.Text                = string.Empty;
                tbTitle.Text           = string.Empty;
                tbValidationFlags.Text = string.Empty;
                tbValidationMemo.Text  = string.Empty;
                tbAddress1.Text        = string.Empty;
                tbAddress2.Text        = string.Empty;
                tbCity.Text            = string.Empty;
                tbStateProvince.Text   = string.Empty;
                tbCountry.Text         = string.Empty;
                tbPostalCode.Text      = string.Empty;
                tbHomePhone.Text       = string.Empty;
                tbWorkPhone.Text       = string.Empty;
                tbFax.Text             = string.Empty;
                tbPager.Text           = string.Empty;
                tbMobilePhone.Text     = string.Empty;
                tbEmail1.Text          = string.Empty;
                tbEmail2.Text          = string.Empty;
                tbUrl.Text             = string.Empty;
                tbBusinessName.Text    = string.Empty;
                tbMemoText.Text        = string.Empty;
                tbBirthDate.Text       = DateTime.Now.ToString();
            }

            OnUpdated(EventArgs.Empty);
        }
Example #8
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);
        }
Example #9
0
 public void CreateContactC()
 {
     contactC.Save();
 }
Example #10
0
 public void CreateContactB()
 {
     contactB.Save();
 }
Example #11
0
 public void CreateContactA()
 {
     contactA.Save();
 }