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); }