protected override void OnPreRender(EventArgs e) { if (dojoBulkAttendanceEntryID != 0) { editDojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); // // Set Field Entries // tbStartDate.Text = editDojoBulkAttendanceEntry.StartDate.ToString(); tbEndDate.Text = editDojoBulkAttendanceEntry.EndDate.ToString(); tbDuration.Text = editDojoBulkAttendanceEntry.Duration.TotalHours.ToString(); // // Set Children Selections // foreach (ListItem item in ddMember.Items) { item.Selected = editDojoBulkAttendanceEntry.Member.ID.ToString() == item.Value; } foreach (ListItem item in ddRank.Items) { item.Selected = editDojoBulkAttendanceEntry.Rank.ID.ToString() == item.Value; } Text = "Edit Bulk Attendance - " + editDojoBulkAttendanceEntry.StartDate.ToShortDateString() + "-" + editDojoBulkAttendanceEntry.EndDate.ToShortDateString(); } else { Text = "Add Bulk Attendance"; } }
protected void btOk_Click(object sender, EventArgs e) { DojoBulkAttendanceEntry dojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); dojoBulkAttendanceEntry.Delete(); dojoBulkAttendanceEntryID = 0; OnDeleted(EventArgs.Empty); }
protected void ok_Click(object sender, EventArgs e) { if (dojoBulkAttendanceEntryID == 0) { obj = new DojoBulkAttendanceEntry(); } else { obj = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); } obj.StartDate = DateTime.Parse(tbStartDate.Text); obj.EndDate = DateTime.Parse(tbEndDate.Text); obj.Duration = TimeSpan.Parse(tbDuration.Text); if (msMember.SelectedItem != null && msMember.SelectedItem.Value != "Null") { obj.Member = DojoMember.NewPlaceHolder( int.Parse(msMember.SelectedItem.Value)); } else { obj.Member = null; } if (msRank.SelectedItem != null && msRank.SelectedItem.Value != "Null") { obj.Rank = DojoRank.NewPlaceHolder( int.Parse(msRank.SelectedItem.Value)); } else { obj.Rank = null; } if (editOnAdd) { dojoBulkAttendanceEntryID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbStartDate.Text = DateTime.Now.ToString(); tbEndDate.Text = DateTime.Now.ToString(); tbDuration.Text = string.Empty; msMember.SelectedIndex = 0; msRank.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
protected void ok_Click(object sender, EventArgs e) { if (dojoBulkAttendanceEntryID == 0) { editDojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(); } else { editDojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); } editDojoBulkAttendanceEntry.StartDate = DateTime.Parse(tbStartDate.Text); editDojoBulkAttendanceEntry.EndDate = DateTime.Parse(tbEndDate.Text); editDojoBulkAttendanceEntry.Duration = TimeSpan.FromHours(double.Parse(tbDuration.Text)); if (ddMember.SelectedItem != null) { editDojoBulkAttendanceEntry.Member = DojoMember.NewPlaceHolder( int.Parse(ddMember.SelectedItem.Value)); } else { editDojoBulkAttendanceEntry.Member = null; } if (ddRank.SelectedItem != null) { editDojoBulkAttendanceEntry.Rank = DojoRank.NewPlaceHolder( int.Parse(ddRank.SelectedItem.Value)); } else { editDojoBulkAttendanceEntry.Rank = null; } if (editOnAdd) { dojoBulkAttendanceEntryID = editDojoBulkAttendanceEntry.Save(); } else { editDojoBulkAttendanceEntry.Save(); } if (resetOnAdd) { tbStartDate.Text = string.Empty; tbEndDate.Text = string.Empty; tbDuration.Text = string.Empty; ddMember.SelectedIndex = 0; ddRank.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
public void Remove(DojoBulkAttendanceEntry value) { OnCollectionChanged(EventArgs.Empty); int index = IndexOf(value); if (index == -1) { throw(new Exception("DojoBulkAttendanceEntry not found in collection.")); } RemoveAt(index); }
public int Add(DojoBulkAttendanceEntry value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; ensureArrays(); addIndexKey(value.ID); DojoBulkAttendanceEntryArray[count - 1] = value; return(count - 1); } }
protected override void OnPreRender(EventArgs e) { if (dojoBulkAttendanceEntryID != 0) { dojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); text = "Delete - " + dojoBulkAttendanceEntry.ToString(); } else { text = "Delete "; } EnsureWindowScripts(); }
public void Add(DojoBulkAttendanceEntry dojoBulkAttendanceEntry, TimeSpan slidingExpiration) { lock (this) { count++; ensureArrays(); dojoBulkAttendanceEntryArray[count - 1] = dojoBulkAttendanceEntry; 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 (loadFlag) { if (dojoBulkAttendanceEntryID > 0) { obj = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); text = "Edit - " + obj.ToString(); } else if (dojoBulkAttendanceEntryID <= 0) { obj = new DojoBulkAttendanceEntry(); text = "Add "; } // // Set Field Entries // tbStartDate.Text = obj.StartDate.ToString(); tbEndDate.Text = obj.EndDate.ToString(); tbDuration.Text = obj.Duration.ToString(); // // Set Children Selections // if (obj.Member != null) { foreach (ListItem item in msMember.Items) { item.Selected = obj.Member.ID.ToString() == item.Value; } } else { msMember.SelectedIndex = 0; } if (obj.Rank != null) { foreach (ListItem item in msRank.Items) { item.Selected = obj.Rank.ID.ToString() == item.Value; } } else { msRank.SelectedIndex = 0; } } }
public int IndexOf(DojoBulkAttendanceEntry value) { lock (this) { for (int x = 0; x < count; x++) { if (DojoBulkAttendanceEntryArray[x].Equals(value)) { return(x); } } } return(-1); }
public void Insert(int index, DojoBulkAttendanceEntry value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; ensureArrays(); addIndexKey(value.ID); for (int x = index + 1; x == count - 2; x++) { DojoBulkAttendanceEntryArray[x] = DojoBulkAttendanceEntryArray[x - 1]; } DojoBulkAttendanceEntryArray[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 > DojoBulkAttendanceEntryArray.GetUpperBound(0) + 1) { int[,] tempIndex = new int[count * 2, 2]; DojoBulkAttendanceEntry[] tempDojoBulkAttendanceEntryArray = new DojoBulkAttendanceEntry[count * 2]; for (int x = 0; x <= DojoBulkAttendanceEntryArray.GetUpperBound(0); x++) { tempIndex[x, 0] = index[x, 0]; // Copy ID tempIndex[x, 1] = index[x, 1]; // Copy Location tempDojoBulkAttendanceEntryArray[x] = DojoBulkAttendanceEntryArray[x]; // Copy Object } index = tempIndex; DojoBulkAttendanceEntryArray = tempDojoBulkAttendanceEntryArray; } }
/// <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 > dojoBulkAttendanceEntryArray.GetUpperBound(0) + 1) { DojoBulkAttendanceEntry[] tempDojoBulkAttendanceEntryArray = new DojoBulkAttendanceEntry[count * 2]; DateTime[] tempTimeStamps = new DateTime[count * 2]; DateTime[] tempAbsoluteExpirations = new DateTime[count * 2]; TimeSpan[] tempSlidingExpirations = new TimeSpan[count * 2]; Array.Copy(dojoBulkAttendanceEntryArray, tempDojoBulkAttendanceEntryArray, count - 1); Array.Copy(timeStamps, tempTimeStamps, count - 1); Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1); Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1); dojoBulkAttendanceEntryArray = tempDojoBulkAttendanceEntryArray; timeStamps = tempTimeStamps; absoluteExpirations = tempAbsoluteExpirations; slidingExpirations = tempSlidingExpirations; } }
public void CheckedAdd(DojoBulkAttendanceEntry dojoBulkAttendanceEntry, TimeSpan slidingExpiration) { lock (this) { int i = binarySearch(dojoBulkAttendanceEntry.iD); if (i != -1) { dojoBulkAttendanceEntryArray[i] = dojoBulkAttendanceEntry; absoluteExpirations[i] = DateTime.Now.Add(slidingExpiration); // Expires slidingExpirations[i] = slidingExpiration; // Never slides return; } count++; ensureArrays(); dojoBulkAttendanceEntryArray[count - 1] = dojoBulkAttendanceEntry; 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 (dojoBulkAttendanceEntryID != 0) { dojoBulkAttendanceEntry = new DojoBulkAttendanceEntry(dojoBulkAttendanceEntryID); #region Bind Default Folder // // Set Field Entries // ltStartDate.Text = dojoBulkAttendanceEntry.StartDate.ToString(); ltEndDate.Text = dojoBulkAttendanceEntry.EndDate.ToString(); ltDuration.Text = dojoBulkAttendanceEntry.Duration.ToString(); // // Set Children Selections // // Member if (dojoBulkAttendanceEntry.Member != null) { ltMember.Text = dojoBulkAttendanceEntry.Member.ToString(); } else { ltMember.Text = string.Empty; } // Rank if (dojoBulkAttendanceEntry.Rank != null) { ltRank.Text = dojoBulkAttendanceEntry.Rank.ToString(); } else { ltRank.Text = string.Empty; } #endregion #region Bind _system Folder // // Set Field Entries // // // Set Children Selections // #endregion text = "View - " + dojoBulkAttendanceEntry.ToString(); } }
public bool Contains(DojoBulkAttendanceEntry value) { return(IndexOf(value) != -1); }