or
<ItemTemplate> <fieldset style="float: left; width: 270px; height: 110px;"> <div> <asp:ImageButton ID="imgCategory" runat="server" OnClick="imgCategory_Click" OnDataBinding="imgCategory_DataBind"CommandArgument='<%# Eval("CategoryId") %>'/> </div> </fieldset></ItemTemplate><telerik:RadScheduler ID="RadScheduler1" runat="server" TimelineView-NumberOfSlots="5" Width="900px" Skin="Web20" EnableEmbeddedSkins="true" EnableEmbeddedBaseStylesheet="false" DataStartField="Start" DataEndField="End" DataSubjectField="Subject" DataKeyField="ID" DataReminderField="Reminder" EnableDescriptionField="true" EnableReminderField="true" GroupingDirection="Vertical" StartInsertingInAdvancedForm="True" AdvancedForm-Modal="False" OnAppointmentDelete="RadScheduler1_AppointmentDelete" OnAppointmentInsert="RadScheduler1_AppointmentInsert" OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnFormCreating="RadScheduler1_FormCreating" OnFormCreated="RadScheduler1_FormCreated" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" OnDataBound="RadScheduler1_OnDataBound" OnNavigationComplete="RadScheduler1_NavigationComplete" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated"> <WeekView DayStartTime="06:00:00" DayEndTime="23:59:00" WorkDayStartTime="08:00:00" WorkDayEndTime="18:00:00" /> <DayView DayStartTime="06:00:00" DayEndTime="23:59:00" WorkDayStartTime="08:00:00" WorkDayEndTime="18:00:00" /> <MonthView VisibleAppointmentsPerDay="20" AdaptiveRowHeight="true" /> <TimelineView SlotDuration="12:00:00" NumberOfSlots="10" TimeLabelSpan="2" ColumnHeaderDateFormat="dddd, MMMM d" /> <Reminders Enabled="true" /> <ResourceStyles> <telerik:ResourceStyleMapping Type="Category" Text="Out of Office" ApplyCssClass="rsCategoryViolet" /> <telerik:ResourceStyleMapping Type="Category" Text="After Hours" ApplyCssClass="rsCategoryRed" /> <telerik:ResourceStyleMapping Type="Category" Text="Projects" ApplyCssClass="rsCategoryDarkGreen" /> <telerik:ResourceStyleMapping Type="Category" Text="MACs" ApplyCssClass="rsCategoryGreen" /> <telerik:ResourceStyleMapping Type="Category" Text="VNMS" ApplyCssClass="rsCategoryDarkBlue" /> <telerik:ResourceStyleMapping Type="Category" Text="IPT/Engineering" ApplyCssClass="rsCategoryDarkRed" /> <telerik:ResourceStyleMapping Type="Category" Text="Other" ApplyCssClass="rsCategoryOrange" /> <telerik:ResourceStyleMapping Type="Category" Text="Remote Day" ApplyCssClass="rsCategoryYellow" /> <telerik:ResourceStyleMapping Type="Category" Text="Region Coverage" ApplyCssClass="rsCategoryPink" /> </ResourceStyles> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler>protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) { int userCount = 0; foreach (Resource user in e.Appointment.Resources.GetResourcesByType("User Name")) { userCount++; } string categoryName = ""; if (e.Appointment.Resources.GetResourceByType("Category") != null) { categoryName = e.Appointment.Resources.GetResourceByType("Category").Text; } e.Cancel = userCount == 0 || categoryName == ""; if (e.Cancel) { ScriptManager.RegisterClientScriptBlock(lblJscript, this.GetType(), "alert", "alert('Please select a user and category to continue');", true); pnlJScript.Update(); e.Cancel = true; } else { if (userCount == 1) { using (ProNetData d = new ProNetData()) { Resource user = e.Appointment.Resources.GetResourceByType("User Name"); Resource client = e.Appointment.Resources.GetResourceByType("Client Name"); Resource category = e.Appointment.Resources.GetResourceByType("Category"); string RecurrenceRule = e.Appointment.RecurrenceRule; int userID = SafeValue.SafeInt0(user.Key.ToString()); TED.BLL.Appointment a = new TED.BLL.Appointment(); AppointmentUsers u = d.AppointmentUsers.Where(i => i.UserID == userID).FirstOrDefault(); a.Subject = e.Appointment.Subject; a.Description = e.Appointment.Description != string.Empty ? e.Appointment.Description : null; a.Start = e.Appointment.Start.ToUniversalTime(); a.End = e.Appointment.End.ToUniversalTime(); a.CreationTime = DateTime.Now; a.LastModificationTime = DateTime.Now; if (user != null) { a.UserID = SafeValue.SafeInt0(user.Key.ToString()); } if (client != null) { a.ClientID = SafeValue.SafeInt0(client.Key.ToString()); } if (category != null) { a.CategoryID = SafeValue.SafeInt0(category.Key.ToString()); } a.Mailbox = u.Email; a.OutlookCreated = false; if (RecurrenceRule != "") { //int index = RecurrenceRule.LastIndexOf(":"); int index = RecurrenceRule.LastIndexOf("FREQ") - 1; string s = RecurrenceRule.Substring(index + 1).Replace("\r\n","") +";WKST=SU"; a.RecurrenceRule = s; if (RecurrenceRule.Contains("DAILY")) { a.RecurrenceType = 0; } else if (RecurrenceRule.Contains("WEEKLY")) { a.RecurrenceType = 1; } else if (RecurrenceRule.Contains("MONTHLY")) { a.RecurrenceType = 2; } else if (RecurrenceRule.Contains("YEARLY")) { a.RecurrenceType = 6; } a.IsRecurring = true; } else { a.IsRecurring = false; a.RecurrenceType = null; } if (e.Appointment.RecurrenceParentID != null) { a.RecurrenceParentID = int.Parse(e.Appointment.RecurrenceParentID.ToString()); } a.SyncToExchange = true; d.AddToAppointments(a); d.SaveChanges(); if (a.ID > 0) { try { string desc = ""; string clientName = ""; if (a.Description != null) { desc = a.Description; } if (client != null) { clientName = client.Text; } //if (pm != null) { pmID = int.Parse(pm.Key.ToString()); } SendMail(a.UserID, "<b>Subject:</b> " + a.Subject + "<br><b>Start:</b> " + a.Start + "<br><b>End:</b> " + a.End + "<br><b>Description:</b> " + desc + "<br><b>Client:</b> " + clientName, (int)InsertUpdateDelete.Insert); } catch { } } } } else { foreach (Resource user in e.Appointment.Resources.GetResourcesByType("User Name")) { using (ProNetData d = new ProNetData()) { //Resource pm = e.Appointment.Resources.GetResourceByType("Email PM"); Resource client = e.Appointment.Resources.GetResourceByType("Client Name"); Resource category = e.Appointment.Resources.GetResourceByType("Category"); string RecurrenceRule = e.Appointment.RecurrenceRule; int userID = SafeValue.SafeInt0(user.Key.ToString()); TED.BLL.Appointment a = new TED.BLL.Appointment(); AppointmentUsers u = d.AppointmentUsers.Where(i => i.UserID == userID).FirstOrDefault(); a.Subject = e.Appointment.Subject; a.Description = e.Appointment.Description != string.Empty ? e.Appointment.Description : null; a.Start = e.Appointment.Start.ToUniversalTime(); a.End = e.Appointment.End.ToUniversalTime(); a.CreationTime = DateTime.Now; a.LastModificationTime = DateTime.Now; if (user != null) { a.UserID = SafeValue.SafeInt0(user.Key.ToString()); } if (client != null) { a.ClientID = SafeValue.SafeInt0(client.Key.ToString()); } if (category != null) { a.CategoryID = SafeValue.SafeInt0(category.Key.ToString()); } a.Mailbox = u.Email; a.OutlookCreated = false; if (RecurrenceRule != "") { //int index = RecurrenceRule.LastIndexOf(":"); int index = RecurrenceRule.LastIndexOf("FREQ") - 1; string s = RecurrenceRule.Substring(index + 1).Replace("\r\n", "") + ";WKST=SU"; a.RecurrenceRule = s; if (RecurrenceRule.Contains("DAILY")) { a.RecurrenceType = 0; } else if (RecurrenceRule.Contains("WEEKLY")) { a.RecurrenceType = 1; } else if (RecurrenceRule.Contains("MONTHLY")) { a.RecurrenceType = 2; } else if (RecurrenceRule.Contains("YEARLY")) { a.RecurrenceType = 6; } a.IsRecurring = true; } else { a.IsRecurring = false; a.RecurrenceType = null; } if (e.Appointment.RecurrenceParentID != null) { a.RecurrenceParentID = int.Parse(e.Appointment.RecurrenceParentID.ToString()); } a.SyncToExchange = true; d.AddToAppointments(a); d.SaveChanges(); if (a.ID > 0) { try { string desc = ""; string clientName = ""; if (a.Description != null) { desc = a.Description; } if (client != null) { clientName = client.Text; } SendMail(a.UserID, "<b>Subject:</b> " + a.Subject + "<br><b>Start:</b> " + a.Start + "<br><b>End:</b> " + a.End + "<br><b>Description:</b> " + desc + "<br><b>Client:</b> " + clientName, (int)InsertUpdateDelete.Insert); } catch { } } } } } } BindSchedule(); }| <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" EnableEmbeddedSkins="false" Skin="Main" AllowFilteringByColumn="true"> |
| <MasterTableView DataKeyNames="ContractID"> |
| <Columns> |
| <telerik:GridButtonColumn ItemStyle-CssClass="editcolumn" CommandName="Edit" Text="Details/Edit" UniqueName="EditColumn" /> |
| <telerik:GridBoundColumn UniqueName="ContractID" FilterControlWidth="40px" HeaderText="Reference" DataField="ContractID" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridBoundColumn UniqueName="Address" FilterControlWidth="120px" HeaderText="Address" DataField="Address" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridDateTimeColumn DataType="System.DateTime" UniqueName="StartDate" FilterControlWidth="100px" HeaderText="Starts" DataField="StartDate" DataFormatString="{0:d}" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridDateTimeColumn DataType="System.DateTime" UniqueName="EndDate" FilterControlWidth="100px" HeaderText="Ends" DataField="EndDate" DataFormatString="{0:d}" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridNumericColumn UniqueName="Rent" FilterControlWidth="40px" HeaderText="Rent" DataField="Rent" DataFormatString="{0:C}" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridBoundColumn UniqueName="Frequency" FilterControlWidth="60px" HeaderText="Rent Frequency" DataField="Frequency" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| <telerik:GridBoundColumn UniqueName="Status" FilterControlWidth="60px" HeaderText="Status" DataField="Status" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" /> |
| </Columns> |
| <SortExpressions> |
| <telerik:GridSortExpression FieldName="ContractID" SortOrder="Descending" /> |
| </SortExpressions> |
| </MasterTableView> |
| <ClientSettings AllowColumnsReorder="true" Resizing-AllowColumnResize="true" /> |
| </telerik:RadGrid> |
| Private Sub RadGrid1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.Init |
| Dim menu As GridFilterMenu = RadGrid1.FilterMenu |
| Dim i As Integer = 0 |
| While i < menu.Items.Count |
| If menu.Items(i).Text = "NoFilter" Or _ |
| menu.Items(i).Text = "Contains" Or _ |
| menu.Items(i).Text = "EqualTo" Or _ |
| menu.Items(i).Text = "GreaterThan" Or _ |
| menu.Items(i).Text = "LessThan" Then |
| i = i + 1 |
| Else |
| menu.Items.RemoveAt(i) |
| End If |
| End While |
| End Sub |
<telerik:RadScheduler runat="server" ID="RadScheduler1" width="700px" height="565px" Skin="Office2007" overflowbehavior="Scroll" shownavigationpane="true" timezoneoffset="00:00:00" selectedview="MonthView" daystarttime="08:00:00" dayendtime="20:29:59" datasourceid="Appointments_DS" datakeyfield="Key" datastartfield="EventDate" dataendfield="EndDate" datasubjectfield="Title" datarecurrencefield="RecurrenceRule" datarecurrenceparentkeyfield="MasterSeriesItemID"
customattributenames="Description, Category, Location, Event_Cancelled, RecurrenceData" allowdelete="false" allowedit="false" allowinsert="false" showviewtabs="true"> <monthview userselectable="true" visibleappointmentsperday="2" /> <TimelineView UserSelectable="false" /> <appointmenttemplate> <asp:literal id="ApptBtn" runat="server" text='<%# (Eval("Subject").ToString().Length >= 16) ? Eval("Subject").ToString().Substring(0, Eval("Subject").ToString().IndexOf(" ")) + "..." : Eval("Subject") %>'></asp:literal> </appointmenttemplate> </telerik:RadScheduler><Appointment> <Key>171</Key> <Title>Policy Committee</Title> <Location>Room 100 (55 Somewhere Street)</Location> <EventDate>2011-01-01T10:30:00</EventDate> <StartDateString>1/1/2011</StartDateString> <EndDate>2094-03-04T10:30:00</EndDate> <Description>Meeting Description</Description> <Category>Committee Meeting</Category> <Event_Cancelled>0</Event_Cancelled> <fRecurrence>1</fRecurrence> <RecurrenceData><recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><monthlyByDay th="TRUE" weekdayOfMonth="first" monthFrequency="1" /></repeat><repeatForever>FALSE</repeatForever></rule></recurrence></RecurrenceData> <RecurrenceRule> <![CDATA[ DTSTART:20110101T103000Z DTEND:20110101T103000Z RRULE:FREQ=MONTHLY;UNTIL=20940304T103000Z;INTERVAL=1;BYSETPOS=1;BYDAY=TH; ]]></RecurrenceRule> <fAllDayEvent>0</fAllDayEvent> <EventType>1</EventType> <Modified>2010-12-03T13:13:06</Modified> </Appointment> <Appointment> <Key>172</Key> <Title>Policy Committee</Title> <Location>Room 100 (55 Somewhere Street)</Location> <EventDate>2011-12-01T10:30:00</EventDate> <StartDateString>12/1/2011</StartDateString> <EndDate>2011-12-01T10:30:00</EndDate> <Description>Meeting Description</Description> <Category>Committee Meeting</Category> <Event_Cancelled>1</Event_Cancelled> <fRecurrence>1</fRecurrence> <RecurrenceData>Every 1 month(s) on the first Thursday</RecurrenceData> <RecurrenceRule> <![CDATA[ DTSTART:20111201T103000Z DTEND:20111201T103000Z RRULE:UNTIL=20111201T103000Z;BYSETPOS=-1; ]]></RecurrenceRule> <fAllDayEvent>0</fAllDayEvent> <EventType>4</EventType> <RecurrenceID>2011-12-01T10:30:00</RecurrenceID> <MasterSeriesItemID>171</MasterSeriesItemID> <Modified>2010-12-03T14:41:34</Modified> </Appointment><?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Appointments"> <Appointments> <xsl:apply-templates select="Appointment"/> </Appointments> </xsl:template> <xsl:template match="Appointment"> <Appointment> <xsl:attribute name="Key"> <xsl:value-of select="Key"/> </xsl:attribute>
<xsl:attribute name="MasterSeriesItemID"> <xsl:value-of select="MasterSeriesItemID"/> </xsl:attribute>
<xsl:attribute name="Title"> <xsl:value-of select="Title"/> </xsl:attribute> <xsl:attribute name="EventDate"> <xsl:value-of select="EventDate"/> </xsl:attribute> <xsl:attribute name="EndDate"> <xsl:value-of select="EndDate"/> </xsl:attribute> <xsl:attribute name="Category"> <xsl:value-of select="Category"/> </xsl:attribute> <xsl:attribute name="Location"> <xsl:value-of select="Location"/> </xsl:attribute> <xsl:attribute name="Description"> <xsl:value-of select="Description"/> </xsl:attribute> <xsl:attribute name="Event_Cancelled"> <xsl:value-of select="Event_Cancelled"/> </xsl:attribute> <xsl:attribute name="RecurrenceData"> <xsl:value-of select="RecurrenceData"/> </xsl:attribute> <xsl:attribute name="RecurrenceRule"> <xsl:value-of select="RecurrenceRule"/> </xsl:attribute> </Appointment> </xsl:template> </xsl:stylesheet>