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