protected void btOk_Click(object sender, EventArgs e)
        {
            DojoSeminarOption dojoSeminarOption = new DojoSeminarOption(dojoSeminarOptionID);

            dojoSeminarOption.Delete();

            dojoSeminarOptionID = 0;

            OnDeleted(EventArgs.Empty);
        }
        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);
        }
        public void Remove(DojoSeminarOption value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("DojoSeminarOption not found in collection."));
            }
            RemoveAt(index);
        }
 public int Add(DojoSeminarOption value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         DojoSeminarOptionArray[count - 1] = value;
         return(count - 1);
     }
 }
Exemple #5
0
 public void Add(DojoSeminarOption dojoSeminarOption, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         count++;
         ensureArrays();
         dojoSeminarOptionArray[count - 1] = dojoSeminarOption;
         timeStamps[count - 1]             = DateTime.Now;
         absoluteExpirations[count - 1]    = DateTime.Now.Add(slidingExpiration); // Never Expires
         slidingExpirations[count - 1]     = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoSeminarOptionID != 0)
     {
         dojoSeminarOption = new DojoSeminarOption(dojoSeminarOptionID);
         text = "Delete - " + dojoSeminarOption.ToString();
     }
     else
     {
         text = "Delete ";
     }
     EnsureWindowScripts();
 }
 public int IndexOf(DojoSeminarOption value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DojoSeminarOptionArray[x].Equals(value))
             {
                 return(x);
             }
         }
     }
     return(-1);
 }
 public void Insert(int index, DojoSeminarOption value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         for (int x = index + 1; x == count - 2; x++)
         {
             DojoSeminarOptionArray[x] = DojoSeminarOptionArray[x - 1];
         }
         DojoSeminarOptionArray[index] = value;
     }
 }
 /// <summary>
 /// Ensures that the index and object array are sized correctly
 /// for additions. This method should be protected by locks
 /// issued by calling methods.
 /// </summary>
 private void ensureArrays()
 {
     if (count > DojoSeminarOptionArray.GetUpperBound(0) + 1)
     {
         int[,] tempIndex = new int[count * 2, 2];
         DojoSeminarOption[] tempDojoSeminarOptionArray = new DojoSeminarOption[count * 2];
         for (int x = 0; x <= DojoSeminarOptionArray.GetUpperBound(0); x++)
         {
             tempIndex[x, 0] = index[x, 0];                             // Copy ID
             tempIndex[x, 1] = index[x, 1];                             // Copy Location
             tempDojoSeminarOptionArray[x] = DojoSeminarOptionArray[x]; // Copy Object
         }
         index = tempIndex;
         DojoSeminarOptionArray = tempDojoSeminarOptionArray;
     }
 }
Exemple #10
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoSeminarOptionID == 0)
            {
                obj = new DojoSeminarOption();
            }
            else
            {
                obj = new DojoSeminarOption(dojoSeminarOptionID);
            }

            obj.Name        = tbName.Text;
            obj.Description = tbDescription.Text;
            obj.Fee         = decimal.Parse(tbFee.Text);
            obj.MaxQuantity = int.Parse(tbMaxQuantity.Text);

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

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

            if (resetOnAdd)
            {
                tbName.Text          = string.Empty;
                tbDescription.Text   = string.Empty;
                tbFee.Text           = string.Empty;
                tbMaxQuantity.Text   = string.Empty;
                msItem.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Exemple #11
0
 /// <summary>
 /// Ensures that the index and object array are sized correctly
 /// for additions. This method should be protected by locks
 /// issued by calling methods.
 /// </summary>
 private void ensureArrays()
 {
     if (count > dojoSeminarOptionArray.GetUpperBound(0) + 1)
     {
         DojoSeminarOption[] tempDojoSeminarOptionArray = new DojoSeminarOption[count * 2];
         DateTime[]          tempTimeStamps             = new DateTime[count * 2];
         DateTime[]          tempAbsoluteExpirations    = new DateTime[count * 2];
         TimeSpan[]          tempSlidingExpirations     = new TimeSpan[count * 2];
         Array.Copy(dojoSeminarOptionArray, tempDojoSeminarOptionArray, count - 1);
         Array.Copy(timeStamps, tempTimeStamps, count - 1);
         Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1);
         Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1);
         dojoSeminarOptionArray = tempDojoSeminarOptionArray;
         timeStamps             = tempTimeStamps;
         absoluteExpirations    = tempAbsoluteExpirations;
         slidingExpirations     = tempSlidingExpirations;
     }
 }
Exemple #12
0
 public void CheckedAdd(DojoSeminarOption dojoSeminarOption, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         int i = binarySearch(dojoSeminarOption.iD);
         if (i != -1)
         {
             dojoSeminarOptionArray[i] = dojoSeminarOption;
             absoluteExpirations[i]    = DateTime.Now.Add(slidingExpiration); // Expires
             slidingExpirations[i]     = slidingExpiration;                   // Never slides
             return;
         }
         count++;
         ensureArrays();
         dojoSeminarOptionArray[count - 1] = dojoSeminarOption;
         timeStamps[count - 1]             = DateTime.Now;
         absoluteExpirations[count - 1]    = DateTime.Now.Add(slidingExpiration); // Expires
         slidingExpirations[count - 1]     = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Exemple #13
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (dojoSeminarOptionID > 0)
                {
                    obj  = new DojoSeminarOption(dojoSeminarOptionID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (dojoSeminarOptionID <= 0)
                {
                    obj  = new DojoSeminarOption();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                tbName.Text        = obj.Name;
                tbDescription.Text = obj.Description;
                tbFee.Text         = obj.Fee.ToString();
                tbMaxQuantity.Text = obj.MaxQuantity.ToString();

                //
                // Set Children Selections
                //
                if (obj.Item != null)
                {
                    foreach (ListItem item in msItem.Items)
                    {
                        item.Selected = obj.Item.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msItem.SelectedIndex = 0;
                }
            }
        }
Exemple #14
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);
        }
        protected override void OnPreRender(EventArgs e)
        {
            if (dojoSeminarOptionID != 0)
            {
                dojoSeminarOption = new DojoSeminarOption(dojoSeminarOptionID);

                #region Bind Default Folder

                //
                // Set Field Entries
                //

                ltName.Text        = dojoSeminarOption.Name.ToString();
                ltDescription.Text = dojoSeminarOption.Description.ToString();
                ltFee.Text         = dojoSeminarOption.Fee.ToString();
                ltMaxQuantity.Text = dojoSeminarOption.MaxQuantity.ToString();

                //
                // Set Children Selections
                //


                #endregion

                #region Bind _system Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //


                #endregion

                #region Bind Rappahanock Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // Item

                if (dojoSeminarOption.Item != null)
                {
                    ltItem.Text = dojoSeminarOption.Item.ToString();
                }
                else
                {
                    ltItem.Text = string.Empty;
                }


                #endregion

                text = "View  - " + dojoSeminarOption.ToString();
            }
        }
Exemple #16
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);
        }
 public bool Contains(DojoSeminarOption value)
 {
     return(IndexOf(value) != -1);
 }