private void getAppointments() { radScheduler1.Appointments.Clear(); try { DataTable getPromoDates = getPromoTab.Tables["PROMOTION_ADVICE_HEADERS"].Copy(); DataTable getPromoColours = getPromoTab.Tables["PROMOTION_TYPES"].Copy(); for (int i = 0; i < getPromoDates.Rows.Count; i++) { Appointment myAppoint = new Appointment((DateTime)getPromoDates.Rows[i]["START_DATE"], (DateTime)getPromoDates.Rows[i]["END_DATE"]);
//the summary of the appointment is the promo tables primary key myAppoint.Summary = getPromoDates.Rows[i]["PA_ID"].ToString(); try { //lookup the promo type and set the background of the appointment (custom backgrounds are defined elsewhere) int getColour = int.Parse(getPromoDates.Rows[i]["PROMO_TYPE"].ToString()); var getBackCol = from o in getPromoColours.AsEnumerable() where int.Parse(o.Field<decimal>("PT_ID").ToString()) == getColour select new { colourNum = o.Field<decimal>("COLOR_ID") }; myAppoint.BackgroundId = int.Parse(getBackCol.ElementAt(0).colourNum.ToString()); } catch (FormatException ex) { myAppoint.BackgroundId = 99; } string isprocessed = "Finalised"; if (getPromoDates.Rows[i]["Processed"].ToString() == "N") { isprocessed = "Open"; } myAppoint.Visible = true; //set the location attribute of the appointment to some meaningful string describing aspects of the promotion myAppoint.Location = getPromoDates.Rows[i]["DESCRIPTION"].ToString() + " - " + ((DateTime)getPromoDates.Rows[i]["START_DATE"]).ToShortDateString() + " - " + ((DateTime)getPromoDates.Rows[i]["END_DATE"]).ToShortDateString(); myAppoint.Location = myAppoint.Location + " " + isprocessed; myAppoint.Description = myAppoint.Location; radScheduler1.Appointments.Add(myAppoint); } radScheduler1.AutoSize = true; radScheduler1.BackColor = Color.LemonChiffon; radScheduler1.Update(); radToolStripLabelElement2.Text = radScheduler1.ActiveView.StartDate.ToLongDateString() + " - " + radScheduler1.ActiveView.EndDate.ToLongDateString(); } catch (Exception ex) { }
radScheduler1.ActiveViewType = SchedulerViewType.Month;
// radScheduler1.ActiveViewType = SchedulerViewType.Week;
SchedulerMonthView myMonthView = new SchedulerMonthView(DateTime.Now, true);
myMonthView.EnableWeeksHeader =
false;
myMonthView.WeekCount = 1;
myMonthView.HeaderFormat =
"dd-MM-yyyy";
myMonthView.ShowHeader =
true;
myMonthView.ShowWeeksHeader =
false;
radScheduler1.ShowAppointmentStatus =
true;
//myAppoint.Location
//SchedulerWeekView myMonthView = new SchedulerWeekView();
radScheduler1.ActiveView = myMonthView;
radToolStripLabelElement1.Text =
" ".PadRight(400, ' ');
radToolStripLabelElement2.Text = radScheduler1.ActiveView.StartDate.ToLongDateString() +
" - " + radScheduler1.ActiveView.EndDate.ToLongDateString();
radScheduler1.Width =
this.Width - 10;
radScheduler1.Height =
this.Height - radToolStrip1.Height - 15 - radDateTimePicker1.Height;
radSplitContainer1.Width =
this.Width - 10;
radSplitContainer1.Height =
this.Height - radToolStrip1.Height - 15 - radDateTimePicker1.Height;
radGridView1.Width =
this.Width - 20;
}
public partial class frmSearchResults : Form { private List<Entity> Results; public frmSearchResults(List<Entity> SearchResults) { InitializeComponent(); Results = SearchResults; gridSearchResults.DataSource = Results; gridSearchResults.BestFitColumns(); }}