コード例 #1
0
        private void btnAddSchedule_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime startdate = (DateTime)(radDateStart.DateTimePickerElement.Value);
                DateTime starttime = (DateTime)(radTimeStart.Value);
                DateTime appointment = new DateTime(startdate.Year, startdate.Month, startdate.Day, starttime.Hour, starttime.Minute, starttime.Second);

                bool result = new AppointmentData().Add(new Appointment()
                {
                    AppointmentDate = appointment,
                    PatientName = txtName.Text,
                    PatientId = txtPatientId.Text,
                    Mobile = txtMobile.Text,
                    Email = txtEmail.Text,
                    UpdatedOn = DateTime.Now
                });

                if (result)
                    MessageBox.Show("Added Successfully");

                RefreshTexts();
            }
            catch (Exception x)
            {
                FileLogger.LogError(x);
            }
        }
コード例 #2
0
 public ActionResult Read([DataSourceRequest] DataSourceRequest request, string startdate, string enddate)
 {
     List<Appointment> list = new List<Appointment>();
     try
     {
         list = new AppointmentData().GetAppointments(DateTime.ParseExact(startdate, @"M/d/yyyy", CultureInfo.InvariantCulture),
             DateTime.ParseExact(enddate, @"M/d/yyyy", CultureInfo.InvariantCulture));
     }
     catch (Exception ex)
     { }
     return Json(list.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
 }
コード例 #3
0
        private void btnUpdateSchedule_Click(object sender, EventArgs e)
        {
            try
            {
                string id = txtAppointmentId.Text.Trim();
                if (id == "")
                {
                    MessageBox.Show("Select(double click) an appointment to update");
                    return;
                }
                DateTime startdate = (DateTime)(radDateStart.DateTimePickerElement.Value);
                DateTime starttime = (DateTime)(radTimeStart.Value);
                DateTime appointment = new DateTime(startdate.Year, startdate.Month, startdate.Day, starttime.Hour, starttime.Minute, starttime.Second);

                bool result = new AppointmentData().Update(new Appointment()
                {
                    AppointmentId = Convert.ToInt32(id),
                    AppointmentDate = appointment,
                    PatientName = txtName.Text,
                    PatientId = txtPatientId.Text,
                    Mobile = txtMobile.Text,
                    Email = txtEmail.Text,
                    UpdatedOn = DateTime.Now
                });

                if (result)
                    MessageBox.Show("Updated Successfully");

                FillGrid();
                RefreshTexts();
            }
            catch (Exception x)
            {
                FileLogger.LogError(x);
            }
        }
コード例 #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string id = txtAppointmentId.Text.Trim();
                if (id == "")
                {
                    MessageBox.Show("Select(double click) a contact to delete");
                    return;
                }

                bool result = new AppointmentData().Delete(
                                                Convert.ToInt32(id));
                if (result)
                    MessageBox.Show("Deleted Successfully");

                FillGrid();
                RefreshTexts();
            }
            catch (Exception x)
            {
                FileLogger.LogError(x);
            }
        }
コード例 #5
0
        private void FillGrid()
        {
            DateTime from = GetDateFromControl(FromDate);
            DateTime to = GetDateFromControl(ToDate);

            //DataTable dt = new AppointmentData().GetAppointments(from, to);
            List<Appointment> appointments = new AppointmentData().GetAppointments(from, to);

            AppointmentsGrid.DataSource = appointments;
            AppointmentsGrid.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
            AppointmentsGrid.ClearSelection();

            AppointmentsGrid.Columns["AppointmentId"].IsVisible = false;
            AppointmentsGrid.Columns["UpdatedOn"].IsVisible = false;
            //SearchGrid.Columns[1].Width = 120;

            AppointmentsGrid.Columns[0].AllowFiltering = false;
            AppointmentsGrid.Columns[1].AllowFiltering = false;
            AppointmentsGrid.Columns[2].AllowFiltering = false;
            AppointmentsGrid.Columns[3].AllowFiltering = false;
            AppointmentsGrid.Columns[4].AllowFiltering = false;
            AppointmentsGrid.Columns[5].AllowFiltering = false;
        }