public void Remove(DojoClassDefinition value) { OnCollectionChanged(EventArgs.Empty); int index = IndexOf(value); if (index == -1) { throw(new Exception("DojoClassDefinition not found in collection.")); } RemoveAt(index); }
public int Add(DojoClassDefinition value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; ensureArrays(); addIndexKey(value.ID); DojoClassDefinitionArray[count - 1] = value; return(count - 1); } }
protected override void OnPreRender(EventArgs e) { if (dojoClassDefinitionID != 0) { dojoClassDefinition = new DojoClassDefinition(dojoClassDefinitionID); text = "Delete - " + dojoClassDefinition.ToString(); } else { text = "Delete "; } EnsureWindowScripts(); }
public void Add(DojoClassDefinition dojoClassDefinition, TimeSpan slidingExpiration) { lock (this) { count++; ensureArrays(); dojoClassDefinitionArray[count - 1] = dojoClassDefinition; timeStamps[count - 1] = DateTime.Now; absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Never Expires slidingExpirations[count - 1] = slidingExpiration; // Never slides quickSort(0, count - 1); } }
public int IndexOf(DojoClassDefinition value) { lock (this) { for (int x = 0; x < count; x++) { if (DojoClassDefinitionArray[x].Equals(value)) { return(x); } } } return(-1); }
public void Insert(int index, DojoClassDefinition value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; ensureArrays(); addIndexKey(value.ID); for (int x = index + 1; x == count - 2; x++) { DojoClassDefinitionArray[x] = DojoClassDefinitionArray[x - 1]; } DojoClassDefinitionArray[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 > DojoClassDefinitionArray.GetUpperBound(0) + 1) { int[,] tempIndex = new int[count * 2, 2]; DojoClassDefinition[] tempDojoClassDefinitionArray = new DojoClassDefinition[count * 2]; for (int x = 0; x <= DojoClassDefinitionArray.GetUpperBound(0); x++) { tempIndex[x, 0] = index[x, 0]; // Copy ID tempIndex[x, 1] = index[x, 1]; // Copy Location tempDojoClassDefinitionArray[x] = DojoClassDefinitionArray[x]; // Copy Object } index = tempIndex; DojoClassDefinitionArray = tempDojoClassDefinitionArray; } }
private void btSwitch_Click(object sender, EventArgs e) { DojoClass selectedClass = new DojoClass(selectedID); DojoClassDefinition parentDefinition = selectedClass.ParentDefinition; // BUGFIX... DO NOT REMOVE! // FOR SOME REASON THE INSTRUCTOR IS NOT CHANGED IF THIS HAS NOT BEEN LOADED. // WTF! parentDefinition.EnsurePreLoad(); selectedClass.Instructor = DojoMember.NewPlaceHolder(int.Parse(ddInstructors.SelectedItem.Value)); parentDefinition.Instructor = selectedClass.Instructor; selectedClass.Save(); parentDefinition.Save(); selectedID = 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 > dojoClassDefinitionArray.GetUpperBound(0) + 1) { DojoClassDefinition[] tempDojoClassDefinitionArray = new DojoClassDefinition[count * 2]; DateTime[] tempTimeStamps = new DateTime[count * 2]; DateTime[] tempAbsoluteExpirations = new DateTime[count * 2]; TimeSpan[] tempSlidingExpirations = new TimeSpan[count * 2]; Array.Copy(dojoClassDefinitionArray, tempDojoClassDefinitionArray, count - 1); Array.Copy(timeStamps, tempTimeStamps, count - 1); Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1); Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1); dojoClassDefinitionArray = tempDojoClassDefinitionArray; timeStamps = tempTimeStamps; absoluteExpirations = tempAbsoluteExpirations; slidingExpirations = tempSlidingExpirations; } }
public void CheckedAdd(DojoClassDefinition dojoClassDefinition, TimeSpan slidingExpiration) { lock (this) { int i = binarySearch(dojoClassDefinition.iD); if (i != -1) { dojoClassDefinitionArray[i] = dojoClassDefinition; absoluteExpirations[i] = DateTime.Now.Add(slidingExpiration); // Expires slidingExpirations[i] = slidingExpiration; // Never slides return; } count++; ensureArrays(); dojoClassDefinitionArray[count - 1] = dojoClassDefinition; timeStamps[count - 1] = DateTime.Now; absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Expires slidingExpirations[count - 1] = slidingExpiration; // Never slides quickSort(0, count - 1); } }
protected override void OnPreRender(EventArgs e) { if (loadFlag) { tabstrip.SelectedTab = tabstrip.Tabs[0]; if (dojoClassDefinitionID > 0) { obj = new DojoClassDefinition(dojoClassDefinitionID); headerText.Text = "Edit - " + obj.ToString(); } else if (dojoClassDefinitionID <= 0) { obj = new DojoClassDefinition(); headerText.Text = "Add "; } // Bind Default Data tbName.Text = obj.Name; tbDescription.Text = obj.Description; cbIsDisabled.Checked = obj.IsDisabled; tbOccupancyAvg.Text = obj.OccupancyAvg.ToString(); tbOccupancyAvgDate.Text = obj.OccupancyAvgDate.ToString(); // Bind Access Control Data if (obj.AccessControlGroup != null) { foreach (ComboBoxItem item in comboAccessControlGroup.Items) { item.Selected = obj.AccessControlGroup.ID.ToString() == item.Value; } } else { comboAccessControlGroup.SelectedIndex = 0; } // Bind Recurrency Data tbRecurrenceType.Text = obj.RecurrenceType.ToString(); tbRecurrenceCount.Text = obj.RecurrenceCount.ToString(); tbRecurrenceEnd.Text = obj.RecurrenceEnd.ToString(); tbRecurrenceSpan.Text = obj.RecurrenceSpan.ToString(); // Bind Next Class Data tbNextSigninStart.Text = obj.NextSigninStart.ToString(); tbNextSigninEnd.Text = obj.NextSigninEnd.ToString(); tbNextClassStart.Text = obj.NextClassStart.ToString(); tbNextClassEnd.Text = obj.NextClassEnd.ToString(); if (obj.Instructor != null) { comboInstructor.Text = obj.Instructor.PrivateContact.FullName; foreach (ComboBoxItem item in comboInstructor.Items) { if (item.Value == obj.Instructor.ID.ToString()) { comboInstructor.SelectedItem = item; break; } } } if (obj.Location != null) { comboLocation.Text = obj.Location.BusinessName; foreach (ComboBoxItem item in comboLocation.Items) { if (item.Value == obj.Location.ID.ToString()) { comboLocation.SelectedItem = item; break; } } } tabstrip.SelectedTab = tabstrip.Tabs[0]; } }
protected void ok_Click(object sender, EventArgs e) { if (dojoClassID == 0) { obj = new DojoClass(); } else { obj = new DojoClass(dojoClassID); } obj.Name = tbName.Text; if (comboInstructor.SelectedItem != null && comboInstructor.SelectedItem.Value != "Null") { obj.Instructor = DojoMember.NewPlaceHolder( int.Parse(comboInstructor.SelectedItem.Value)); } else { obj.Instructor = null; } if (comboParentSeminar.SelectedItem != null && comboParentSeminar.SelectedItem.Value != "Null") { obj.ParentSeminar = DojoSeminar.NewPlaceHolder( int.Parse(comboParentSeminar.SelectedItem.Value)); } else { obj.ParentSeminar = null; } if (comboParentDefinition.SelectedItem != null && comboParentDefinition.SelectedItem.Value != "Null") { obj.ParentDefinition = DojoClassDefinition.NewPlaceHolder( int.Parse(comboParentDefinition.SelectedItem.Value)); } else { obj.ParentDefinition = null; } if (comboLocation.SelectedItem != null && comboLocation.SelectedItem.Value != "Null") { obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations", int.Parse(comboLocation.SelectedItem.Value)); } else { obj.Location = null; } if (comboAccessControlGroup.SelectedItem != null && comboAccessControlGroup.SelectedItem.Value != "Null") { obj.AccessControlGroup = DojoAccessControlGroup.NewPlaceHolder( int.Parse(comboAccessControlGroup.SelectedItem.Value)); } else { obj.AccessControlGroup = null; } obj.OccupancyMax = int.Parse(tbOccupancyMax.Text); obj.OccupancyTarget = int.Parse(tbOccupancyTarget.Text); obj.OccupancyCurrent = int.Parse(tbOccupancyCurrent.Text); obj.OccupancyCheckDate = DateTime.Parse(tbOccupancyCheckDate.Text); obj.SigninStart = DateTime.Parse(tbSigninStart.Text); obj.SigninEnd = DateTime.Parse(tbSigninEnd.Text); obj.ClassStart = DateTime.Parse(tbClassStart.Text); obj.ClassEnd = DateTime.Parse(tbClassEnd.Text); if (editOnAdd) { dojoClassID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbName.Text = string.Empty; tbOccupancyMax.Text = string.Empty; tbOccupancyTarget.Text = string.Empty; tbOccupancyCurrent.Text = string.Empty; tbOccupancyCheckDate.Text = DateTime.Now.ToString(); tbSigninStart.Text = DateTime.Now.ToString(); tbSigninEnd.Text = DateTime.Now.ToString(); tbClassStart.Text = DateTime.Now.ToString(); tbClassEnd.Text = DateTime.Now.ToString(); comboInstructor.SelectedIndex = 0; comboParentSeminar.SelectedIndex = 0; comboParentDefinition.SelectedIndex = 0; comboLocation.SelectedIndex = 0; comboAccessControlGroup.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
protected void ok_Click(object sender, EventArgs e) { if (dojoSeminarReservationID == 0) { obj = new DojoSeminarReservation(); } else { obj = new DojoSeminarReservation(dojoSeminarReservationID); } obj.IsBlockReservation = cbIsBlockReservation.Checked; obj.CheckIn = DateTime.Parse(tbCheckIn.Text); obj.CheckOut = cbCheckOut.Checked; obj.IsClassReservation = cbIsClassReservation.Checked; obj.IsDefinitionReservation = cbIsDefinitionReservation.Checked; if (msRegistration.SelectedItem != null && msRegistration.SelectedItem.Value != "Null") { obj.Registration = DojoSeminarRegistration.NewPlaceHolder( int.Parse(msRegistration.SelectedItem.Value)); } else { obj.Registration = null; } if (msParentReservation.SelectedItem != null && msParentReservation.SelectedItem.Value != "Null") { obj.ParentReservation = DojoSeminarReservation.NewPlaceHolder( int.Parse(msParentReservation.SelectedItem.Value)); } else { obj.ParentReservation = null; } if (msClass1.SelectedItem != null && msClass1.SelectedItem.Value != "Null") { obj.Class1 = DojoClass.NewPlaceHolder( int.Parse(msClass1.SelectedItem.Value)); } else { obj.Class1 = null; } if (msClass2.SelectedItem != null && msClass2.SelectedItem.Value != "Null") { obj.Class2 = DojoClass.NewPlaceHolder( int.Parse(msClass2.SelectedItem.Value)); } else { obj.Class2 = null; } if (msClass3.SelectedItem != null && msClass3.SelectedItem.Value != "Null") { obj.Class3 = DojoClass.NewPlaceHolder( int.Parse(msClass3.SelectedItem.Value)); } else { obj.Class3 = null; } if (msClass4.SelectedItem != null && msClass4.SelectedItem.Value != "Null") { obj.Class4 = DojoClass.NewPlaceHolder( int.Parse(msClass4.SelectedItem.Value)); } else { obj.Class4 = null; } if (msClass5.SelectedItem != null && msClass5.SelectedItem.Value != "Null") { obj.Class5 = DojoClass.NewPlaceHolder( int.Parse(msClass5.SelectedItem.Value)); } else { obj.Class5 = null; } if (msClass6.SelectedItem != null && msClass6.SelectedItem.Value != "Null") { obj.Class6 = DojoClass.NewPlaceHolder( int.Parse(msClass6.SelectedItem.Value)); } else { obj.Class6 = null; } if (msClass7.SelectedItem != null && msClass7.SelectedItem.Value != "Null") { obj.Class7 = DojoClass.NewPlaceHolder( int.Parse(msClass7.SelectedItem.Value)); } else { obj.Class7 = null; } if (msClass8.SelectedItem != null && msClass8.SelectedItem.Value != "Null") { obj.Class8 = DojoClass.NewPlaceHolder( int.Parse(msClass8.SelectedItem.Value)); } else { obj.Class8 = null; } if (msClass9.SelectedItem != null && msClass9.SelectedItem.Value != "Null") { obj.Class9 = DojoClass.NewPlaceHolder( int.Parse(msClass9.SelectedItem.Value)); } else { obj.Class9 = null; } if (msClass10.SelectedItem != null && msClass10.SelectedItem.Value != "Null") { obj.Class10 = DojoClass.NewPlaceHolder( int.Parse(msClass10.SelectedItem.Value)); } else { obj.Class10 = null; } if (msDefinition1.SelectedItem != null && msDefinition1.SelectedItem.Value != "Null") { obj.Definition1 = DojoClassDefinition.NewPlaceHolder( int.Parse(msDefinition1.SelectedItem.Value)); } else { obj.Definition1 = null; } if (msDefinition2.SelectedItem != null && msDefinition2.SelectedItem.Value != "Null") { obj.Definition2 = DojoClassDefinition.NewPlaceHolder( int.Parse(msDefinition2.SelectedItem.Value)); } else { obj.Definition2 = null; } if (msDefinition3.SelectedItem != null && msDefinition3.SelectedItem.Value != "Null") { obj.Definition3 = DojoClassDefinition.NewPlaceHolder( int.Parse(msDefinition3.SelectedItem.Value)); } else { obj.Definition3 = null; } if (editOnAdd) { dojoSeminarReservationID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { cbIsBlockReservation.Checked = false; tbCheckIn.Text = DateTime.Now.ToString(); cbCheckOut.Checked = false; cbIsClassReservation.Checked = false; cbIsDefinitionReservation.Checked = false; msRegistration.SelectedIndex = 0; msParentReservation.SelectedIndex = 0; msClass1.SelectedIndex = 0; msClass2.SelectedIndex = 0; msClass3.SelectedIndex = 0; msClass4.SelectedIndex = 0; msClass5.SelectedIndex = 0; msClass6.SelectedIndex = 0; msClass7.SelectedIndex = 0; msClass8.SelectedIndex = 0; msClass9.SelectedIndex = 0; msClass10.SelectedIndex = 0; msDefinition1.SelectedIndex = 0; msDefinition2.SelectedIndex = 0; msDefinition3.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
protected void ok_Click(object sender, EventArgs e) { if (dojoClassDefinitionID == 0) { obj = new DojoClassDefinition(); } else { obj = new DojoClassDefinition(dojoClassDefinitionID); } obj.Name = tbName.Text; obj.Description = tbDescription.Text; obj.IsDisabled = cbIsDisabled.Checked; obj.OccupancyAvg = int.Parse(tbOccupancyAvg.Text); obj.OccupancyAvgDate = DateTime.Parse(tbOccupancyAvgDate.Text); obj.RecurrenceType = byte.Parse(tbRecurrenceType.Text); obj.RecurrenceCount = int.Parse(tbRecurrenceCount.Text); obj.RecurrenceEnd = DateTime.Parse(tbRecurrenceEnd.Text); obj.RecurrenceSpan = TimeSpan.Parse(tbRecurrenceSpan.Text); obj.NextSigninStart = DateTime.Parse(tbNextSigninStart.Text); obj.NextSigninEnd = DateTime.Parse(tbNextSigninEnd.Text); obj.NextClassStart = DateTime.Parse(tbNextClassStart.Text); obj.NextClassEnd = DateTime.Parse(tbNextClassEnd.Text); if (msAccessControlGroup.SelectedItem != null && msAccessControlGroup.SelectedItem.Value != "Null") { obj.AccessControlGroup = DojoAccessControlGroup.NewPlaceHolder( int.Parse(msAccessControlGroup.SelectedItem.Value)); } else { obj.AccessControlGroup = null; } if (msInstructor.SelectedItem != null && msInstructor.SelectedItem.Value != "Null") { obj.Instructor = DojoMember.NewPlaceHolder( int.Parse(msInstructor.SelectedItem.Value)); } else { obj.Instructor = null; } if (msLocation.SelectedItem != null && msLocation.SelectedItem.Value != "Null") { obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations", int.Parse(msLocation.SelectedItem.Value)); } else { obj.Location = null; } if (editOnAdd) { dojoClassDefinitionID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbName.Text = string.Empty; tbDescription.Text = string.Empty; cbIsDisabled.Checked = false; tbOccupancyAvg.Text = string.Empty; tbOccupancyAvgDate.Text = DateTime.Now.ToString(); tbRecurrenceType.Text = string.Empty; tbRecurrenceCount.Text = string.Empty; tbRecurrenceEnd.Text = DateTime.Now.ToString(); tbRecurrenceSpan.Text = string.Empty; tbNextSigninStart.Text = DateTime.Now.ToString(); tbNextSigninEnd.Text = DateTime.Now.ToString(); tbNextClassStart.Text = DateTime.Now.ToString(); tbNextClassEnd.Text = DateTime.Now.ToString(); msAccessControlGroup.SelectedIndex = 0; msInstructor.SelectedIndex = 0; msLocation.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
public bool Contains(DojoClassDefinition value) { return(IndexOf(value) != -1); }
protected override void OnPreRender(EventArgs e) { if (loadFlag) { if (dojoClassDefinitionID > 0) { obj = new DojoClassDefinition(dojoClassDefinitionID); text = "Edit - " + obj.ToString(); } else if (dojoClassDefinitionID <= 0) { obj = new DojoClassDefinition(); text = "Add "; } // // Set Field Entries // tbName.Text = obj.Name; tbDescription.Text = obj.Description; cbIsDisabled.Checked = obj.IsDisabled; tbOccupancyAvg.Text = obj.OccupancyAvg.ToString(); tbOccupancyAvgDate.Text = obj.OccupancyAvgDate.ToString(); tbRecurrenceType.Text = obj.RecurrenceType.ToString(); tbRecurrenceCount.Text = obj.RecurrenceCount.ToString(); tbRecurrenceEnd.Text = obj.RecurrenceEnd.ToString(); tbRecurrenceSpan.Text = obj.RecurrenceSpan.ToString(); tbNextSigninStart.Text = obj.NextSigninStart.ToString(); tbNextSigninEnd.Text = obj.NextSigninEnd.ToString(); tbNextClassStart.Text = obj.NextClassStart.ToString(); tbNextClassEnd.Text = obj.NextClassEnd.ToString(); // // Set Children Selections // if (obj.AccessControlGroup != null) { foreach (ListItem item in msAccessControlGroup.Items) { item.Selected = obj.AccessControlGroup.ID.ToString() == item.Value; } } else { msAccessControlGroup.SelectedIndex = 0; } if (obj.Instructor != null) { foreach (ListItem item in msInstructor.Items) { item.Selected = obj.Instructor.ID.ToString() == item.Value; } } else { msInstructor.SelectedIndex = 0; } if (obj.Location != null) { foreach (ListItem item in msLocation.Items) { item.Selected = obj.Location.ID.ToString() == item.Value; } } else { msLocation.SelectedIndex = 0; } } }
protected override void OnPreRender(EventArgs e) { if (dojoClassDefinitionID != 0) { dojoClassDefinition = new DojoClassDefinition(dojoClassDefinitionID); #region Bind Default Folder // // Set Field Entries // ltName.Text = dojoClassDefinition.Name.ToString(); ltDescription.Text = dojoClassDefinition.Description.ToString(); ltIsDisabled.Text = dojoClassDefinition.IsDisabled.ToString(); ltOccupancyAvg.Text = dojoClassDefinition.OccupancyAvg.ToString(); ltOccupancyAvgDate.Text = dojoClassDefinition.OccupancyAvgDate.ToString(); // // Set Children Selections // #endregion #region Bind _system Folder // // Set Field Entries // // // Set Children Selections // #endregion #region Bind Access Control Folder // // Set Field Entries // // // Set Children Selections // // AccessControlGroup if (dojoClassDefinition.AccessControlGroup != null) { ltAccessControlGroup.Text = dojoClassDefinition.AccessControlGroup.ToString(); } else { ltAccessControlGroup.Text = string.Empty; } #endregion #region Bind Recurrency Folder // // Set Field Entries // ltRecurrenceType.Text = dojoClassDefinition.RecurrenceType.ToString(); ltRecurrenceCount.Text = dojoClassDefinition.RecurrenceCount.ToString(); ltRecurrenceEnd.Text = dojoClassDefinition.RecurrenceEnd.ToString(); ltRecurrenceSpan.Text = dojoClassDefinition.RecurrenceSpan.ToString(); // // Set Children Selections // #endregion #region Bind Next Class Folder // // Set Field Entries // ltNextSigninStart.Text = dojoClassDefinition.NextSigninStart.ToString(); ltNextSigninEnd.Text = dojoClassDefinition.NextSigninEnd.ToString(); ltNextClassStart.Text = dojoClassDefinition.NextClassStart.ToString(); ltNextClassEnd.Text = dojoClassDefinition.NextClassEnd.ToString(); // // Set Children Selections // // Instructor if (dojoClassDefinition.Instructor != null) { ltInstructor.Text = dojoClassDefinition.Instructor.ToString(); } else { ltInstructor.Text = string.Empty; } // Location if (dojoClassDefinition.Location != null) { ltLocation.Text = dojoClassDefinition.Location.ToString(); } else { ltLocation.Text = string.Empty; } #endregion text = "View - " + dojoClassDefinition.ToString(); } }