This repository has been archived by the owner on Sep 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomAppointmentSaveCallbackCommand .cs
59 lines (50 loc) · 2.48 KB
/
CustomAppointmentSaveCallbackCommand .cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using DevExpress.Web;
using DevExpress.Web.ASPxScheduler;
using DevExpress.Web.ASPxScheduler.Internal;
using DevExpress.XtraScheduler.Native;
using DevExpress.XtraScheduler;
namespace WebApplication1.CustomControls {
public class CustomAppointmentSaveCallbackCommand : AppointmentFormSaveCallbackCommand {
public CustomAppointmentSaveCallbackCommand(ASPxScheduler control) : base(control) { }
protected internal new CustomAppointmentFormController Controller {
get { return (CustomAppointmentFormController)base.Controller; }
}
protected override System.Web.UI.Control FindControlByID(string id) {
return FindTemplateControl(TemplateContainer, id);
}
System.Web.UI.Control FindTemplateControl(System.Web.UI.Control RootControl, string id) {
System.Web.UI.Control foundedControl = RootControl.FindControl(id);
if(foundedControl == null) {
foreach(System.Web.UI.Control item in RootControl.Controls) {
foundedControl = FindTemplateControl(item, id);
if(foundedControl != null) break;
}
}
return foundedControl;
}
protected override void AssignControllerValues() {
base.AssignControllerValues();
ASPxTextBox tbSubject = (ASPxTextBox)FindControlByID("ASPxTextBoxSubject");
ASPxDateEdit deStart = (ASPxDateEdit)FindControlByID("ASPxDateEditStart");
ASPxDateEdit deEnd = (ASPxDateEdit)FindControlByID("ASPxDateEditEnd");
ASPxMemo tbDescription = (ASPxMemo)FindControlByID("ASPxTextBoxDescription");
ASPxTextBox tbCustomInfo = (ASPxTextBox)FindControlByID("ASPxTextBoxCustomInfo");
Controller.Subject = tbSubject.Text;
Controller.Start = Convert.ToDateTime(deStart.Value);
Controller.End = Convert.ToDateTime(deEnd.Value);
Controller.Description = tbDescription.Text;
Controller.CustomInfoField = tbCustomInfo.Text;
if(Controller.ResourceId == ResourceEmpty.Id) {
Controller.ResourceId = Control.SelectedResource.Id;
}
}
protected override AppointmentFormController CreateAppointmentFormController(DevExpress.XtraScheduler.Appointment apt) {
return new CustomAppointmentFormController(Control, apt);
}
}
}