private void btnDelete_Click(object sender, EventArgs e) { if (timeslotSelected != null) { TimeslotServiceClient tService = new TimeslotServiceClient(); string message = String.Empty; if (!tService.DeleteTimeslot(timeslotSelected.TimeSlotCode, ref message)) { message = "Deletion of Timeslot Failed"; } else { MessageBox.Show("Deleted succesfully!"); } } }
public void LoadTimeslots() { TimeslotServiceClient tService = new TimeslotServiceClient(); string message = String.Empty; try { var timeslot = tService.GetAllTimeslots(); timeslotList = new List<Timeslot>(timeslot); gvTimeSlot.DataSource = timeslotList; gvTimeSlot.Refresh(); if (gvTimeSlot.RowCount != 0) gvTimeSlot.Rows[0].IsSelected = true; } catch (Exception ex) { message = "Error Loading List of Timeslots"; MessageBox.Show(ex.ToString()); } }
public void LoadTimeslots() { TimeslotServiceClient tService = new TimeslotServiceClient(); string message = String.Empty; try { var timeslot = tService.GetAllTimeslots(); timeslotList = new List <Timeslot>(timeslot); gvTimeSlot.DataSource = timeslotList; gvTimeSlot.Refresh(); if (gvTimeSlot.RowCount != 0) { gvTimeSlot.Rows[0].IsSelected = true; } } catch (Exception ex) { message = "Error Loading List of Timeslots"; MessageBox.Show(ex.ToString()); } }
private void SaveUser() { try { Boolean ret = false; string message = String.Empty; List <String> list = new List <String>(); if (chkSunday.Checked == true) { list.Add("Su"); } if (chkMonday.Checked == true) { list.Add("M"); } if (chkTuesday.Checked == true) { list.Add("Tu"); } if (chkWednesday.Checked == true) { list.Add("W"); } if (chkThursday.Checked == true) { list.Add("Th"); } if (chkFriday.Checked == true) { list.Add("F"); } if (chkSaturday.Checked == true) { list.Add("S"); } string szDays = string.Empty; szDays = string.Join(",", list.ToArray()); DateTime?dtTimeStart = DateTime.Now; DateTime?dtTimeEnd = DateTime.Now; dtTimeStart = tPStart.Value; dtTimeEnd = tpEnd.Value; TimeslotServiceClient tService = new TimeslotServiceClient(); Timeslot timeslot = new Timeslot() { TimeSlotCode = txtTimeslotCode.Text, TimeStart = dtTimeStart.Value.ToString("hh:mm tt"), TimeEnd = dtTimeEnd.Value.ToString("hh:mm tt"), Days = szDays }; if (Op.Equals("edit")) { timeslot.TimeSlotCode = SelectedTimeslot.TimeSlotCode; ret = tService.UpdateTimeslot(ref timeslot, ref message); } else { ret = tService.CreateTimeslot(ref timeslot, ref message); } MessageBox.Show("Saved Successfully!"); Close(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } }
private void SaveUser() { try { Boolean ret = false; string message = String.Empty; List<String> list = new List<String>(); if (chkSunday.Checked == true) list.Add("Su"); if (chkMonday.Checked == true) list.Add("M"); if (chkTuesday.Checked == true) list.Add("Tu"); if (chkWednesday.Checked == true) list.Add("W"); if (chkThursday.Checked == true) list.Add("Th"); if (chkFriday.Checked == true) list.Add("F"); if (chkSaturday.Checked == true) list.Add("S"); string szDays = string.Empty; szDays = string.Join(",", list.ToArray()); DateTime? dtTimeStart = DateTime.Now; DateTime? dtTimeEnd = DateTime.Now; dtTimeStart = tPStart.Value; dtTimeEnd = tpEnd.Value; TimeslotServiceClient tService = new TimeslotServiceClient(); Timeslot timeslot = new Timeslot() { TimeSlotCode = txtTimeslotCode.Text, TimeStart = dtTimeStart.Value.ToString("hh:mm tt"), TimeEnd = dtTimeEnd.Value.ToString("hh:mm tt"), Days = szDays }; if (Op.Equals("edit")) { timeslot.TimeSlotCode = SelectedTimeslot.TimeSlotCode; ret = tService.UpdateTimeslot(ref timeslot, ref message); } else ret = tService.CreateTimeslot(ref timeslot, ref message); MessageBox.Show("Saved Successfully!"); Close(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } }