Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (timeslotSelected != null)
            {
                ITimeslotService tService = new TimeslotService();
                string           message  = String.Empty;

                if (!tService.DeleteTimeslot(timeslotSelected.TimeSlotCode, ref message))
                {
                    MessageBox.Show("Deletion of Timeslot Failed");
                }
                else
                {
                    Log("D", "Timeslots", timeslotSelected);
                    MessageBox.Show("Deleted succesfully!");
                }
            }
        }
Esempio n. 2
0
        public void LoadTimeslots()
        {
            ITimeslotService tService = new TimeslotService();
            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());
            }
        }
Esempio n. 3
0
        private void SaveUser()
        {
            try
            {
                Boolean ret     = false;
                string  message = String.Empty;

                List <String> list = new List <String>();
                if (chkSunday.Checked == true)
                {
                    list.Add("Sun");
                }
                if (chkMonday.Checked == true)
                {
                    list.Add("Mon");
                }
                if (chkTuesday.Checked == true)
                {
                    list.Add("Tue");
                }
                if (chkWednesday.Checked == true)
                {
                    list.Add("Wed");
                }
                if (chkThursday.Checked == true)
                {
                    list.Add("Thu");
                }
                if (chkFriday.Checked == true)
                {
                    list.Add("Fri");
                }
                if (chkSaturday.Checked == true)
                {
                    list.Add("Sat");
                }

                string szDays = string.Empty;
                szDays = string.Join(",", list.ToArray());

                DateTime?dtTimeStart = DateTime.Now;
                DateTime?dtTimeEnd   = DateTime.Now;

                dtTimeStart = tPStart.Value;
                dtTimeEnd   = tpEnd.Value;

                ITimeslotService tService = new TimeslotService();
                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);
                    Log("U", "Timeslots", timeslot);
                }
                else
                {
                    ret = tService.CreateTimeslot(ref timeslot, ref message);
                    Log("C", "Timeslots", timeslot);
                }

                MessageBox.Show("Saved Successfully!");

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
            }
        }