case 3892

This commit is contained in:
2021-06-22 19:13:05 +00:00
parent bc0e4dacc3
commit 86eea2e5fc

View File

@@ -479,7 +479,7 @@ namespace AyaNova
//back again to facilitate saving last viewed date range //back again to facilitate saving last viewed date range
MyDateNavigator mDateNav = null; MyDateNavigator mDateNav = null;
public MyDateNavigator DateNav public MyDateNavigator DateNav
{ {
set set
{ {
if (mDateNav == null) if (mDateNav == null)
@@ -531,7 +531,7 @@ namespace AyaNova
ToolBarManager.Tools["LT:UI.Toolbar.Schedule.AddToActiveWorkorderItem"].SharedProps.Visible = false; ToolBarManager.Tools["LT:UI.Toolbar.Schedule.AddToActiveWorkorderItem"].SharedProps.Visible = false;
ss.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("AyaInfo", "")); ss.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("AyaInfo", ""));
Util.LocalizeHelperInsertMenu(ToolBarManager, this); //case 1810 Util.LocalizeHelperInsertMenu(ToolBarManager, this); //case 1810
Util.Localize(this); Util.Localize(this);
@@ -554,26 +554,30 @@ namespace AyaNova
//case 3172 //case 3172
ToolBarManager.Tools["LT:UI.Toolbar.Schedule.NewScheduleMarker"].SharedProps.Visible = (AyaBizUtils.Right("Object.ScheduleMarker") > (int)SecurityLevelTypes.ReadOnly); ToolBarManager.Tools["LT:UI.Toolbar.Schedule.NewScheduleMarker"].SharedProps.Visible = (AyaBizUtils.Right("Object.ScheduleMarker") > (int)SecurityLevelTypes.ReadOnly);
ToolBarManager.Tools["LT:UI.Toolbar.Schedule.NewWorkorder"].SharedProps.Visible = ToolBarManager.Tools["LT:UI.Toolbar.Schedule.NewWorkorder"].SharedProps.Visible =
(AyaBizUtils.Right("Object.WorkorderService") > (int)SecurityLevelTypes.ReadOnly && (AyaBizUtils.Right("Object.WorkorderService") > (int)SecurityLevelTypes.ReadOnly &&
AyaBizUtils.Right("Object.WorkorderItemScheduledUser") > (int)SecurityLevelTypes.ReadOnly); AyaBizUtils.Right("Object.WorkorderItemScheduledUser") > (int)SecurityLevelTypes.ReadOnly);
//case 1219 - need user for more stuff below //case 1219 - need user for more stuff below
User currentUser=User.GetItem(User.CurrentThreadUserID); User currentUser = User.GetItem(User.CurrentThreadUserID);
mSelectedUserGroupID = currentUser.LastSchedGroupID; mSelectedUserGroupID = currentUser.LastSchedGroupID;
FillScheduleableUserGroupList(); FillScheduleableUserGroupList();
bIgnoreSchedUserGroupChange = false; bIgnoreSchedUserGroupChange = false;
sc.Start = DBUtil.CurrentWorkingDateTime; sc.Start = DBUtil.CurrentWorkingDateTime;
//case 714 //case 714
sc.DayView.TopRowTime = TimeSpan.FromHours(8); sc.DayView.TopRowTime = TimeSpan.FromHours(8);
//NewDateRange();
//case 3892 restrict scrollable day view day to that day only as it's not working outside of the current day
sc.DayView.VisibleTime.Start = TimeSpan.FromHours(0);
sc.DayView.VisibleTime.End = TimeSpan.FromHours(24);
//************************************** //**************************************
@@ -587,24 +591,24 @@ namespace AyaNova
currentUser.LastSchedStopDate.Date = DateTime.Today; currentUser.LastSchedStopDate.Date = DateTime.Today;
} }
TimeIntervalCollection coll = new TimeIntervalCollection(); TimeIntervalCollection coll = new TimeIntervalCollection();
coll.Add(new TimeInterval(currentUser.LastSchedStartDate.Date, currentUser.LastSchedStopDate.Date)); coll.Add(new TimeInterval(currentUser.LastSchedStartDate.Date, currentUser.LastSchedStopDate.Date));
sc.ActiveView.SetVisibleIntervals(coll); sc.ActiveView.SetVisibleIntervals(coll);
if (AyaBizUtils.OverrideTimeZone) if (AyaBizUtils.OverrideTimeZone)
{ {
TimeRuler trOffset = sc.Views.DayView.TimeRulers[0]; TimeRuler trOffset = sc.Views.DayView.TimeRulers[0];
trOffset.ShowCurrentTime = false; trOffset.ShowCurrentTime = false;
} }
//************************************** //**************************************
//case 1219 - make initial start window same as users saved //case 1219 - make initial start window same as users saved
//test test //test test
//MessageBox.Show("MaxWindow at form load is:" + nMaxWindow.ToString()); //MessageBox.Show("MaxWindow at form load is:" + nMaxWindow.ToString());
//case 1548 //case 1548
TimeSpan ts = currentUser.LastSchedStopDate.Date - currentUser.LastSchedStartDate.Date; TimeSpan ts = currentUser.LastSchedStopDate.Date - currentUser.LastSchedStartDate.Date;
if (ts.TotalDays < nMaxWindow) if (ts.TotalDays < nMaxWindow)
@@ -624,25 +628,25 @@ namespace AyaNova
StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.ShowClosed"]; StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.ShowClosed"];
sbt.Checked = !currentUser.ScheduleLastViewOpenOnly; sbt.Checked = !currentUser.ScheduleLastViewOpenOnly;
//case 701
//case 701
#if (DEBUG) #if (DEBUG)
//testing interval (5 minutes) //testing interval (5 minutes)
this.SchedRefreshTimer.Interval = 300000; this.SchedRefreshTimer.Interval = 300000;
#else #else
//5 minutes //5 minutes
SchedRefreshTimer.Interval=300000; SchedRefreshTimer.Interval=300000;
#endif #endif
SchedRefreshTimer.Enabled = true; SchedRefreshTimer.Enabled = true;
SchedRefreshTimer.Start(); SchedRefreshTimer.Start();
DoNotAllowFetchAndBind = false;
BindData(true);
DoNotAllowFetchAndBind = false;
BindData(true);
} }
private void ScheduleForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void ScheduleForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
@@ -657,11 +661,11 @@ namespace AyaNova
//case 1219 //case 1219
u.LastSchedView = (int)sc.ActiveViewType; u.LastSchedView = (int)sc.ActiveViewType;
u.LastSchedStartDate = new CSLA.SmartDate(sc.ActiveView.GetVisibleIntervals().Start); u.LastSchedStartDate = new CSLA.SmartDate(sc.ActiveView.GetVisibleIntervals().Start);
u.LastSchedStopDate = new CSLA.SmartDate(sc.ActiveView.GetVisibleIntervals().End); u.LastSchedStopDate = new CSLA.SmartDate(sc.ActiveView.GetVisibleIntervals().End);
//case 1390 //case 1390
int nstartdays=(u.LastSchedStartDate.Date - DateTime.Today).Days; int nstartdays = (u.LastSchedStartDate.Date - DateTime.Today).Days;
int nstopdays = (u.LastSchedStopDate.Date - DateTime.Today).Days; int nstopdays = (u.LastSchedStopDate.Date - DateTime.Today).Days;
if (nstartdays == 0 && nstopdays == 1) if (nstartdays == 0 && nstopdays == 1)
{ {
@@ -672,10 +676,10 @@ namespace AyaNova
//case 1553 //case 1553
StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.ShowClosed"]; StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.ShowClosed"];
if (!sbt.Checked) if (!sbt.Checked)
u.ScheduleLastViewOpenOnly=true; u.ScheduleLastViewOpenOnly = true;
else else
u.ScheduleLastViewOpenOnly=false; u.ScheduleLastViewOpenOnly = false;
u.Save(); u.Save();
Util.SaveFormCustomization("ScheduleFormEx", this, ToolBarManager, true); Util.SaveFormCustomization("ScheduleFormEx", this, ToolBarManager, true);
@@ -718,15 +722,15 @@ namespace AyaNova
DoNotAllowFetchAndBind = false; DoNotAllowFetchAndBind = false;
return; return;
} }
LastFetchEndWindow = NextFetchEndWindow; LastFetchEndWindow = NextFetchEndWindow;
LastFetchStartWindow = NextFetchStartWindow; LastFetchStartWindow = NextFetchStartWindow;
//Add a day on either side to ensure date range is inclusive to the very start and end date of the range //Add a day on either side to ensure date range is inclusive to the very start and end date of the range
NextFetchStartWindow = NextFetchStartWindow.AddDays(-10); NextFetchStartWindow = NextFetchStartWindow.AddDays(-10);
NextFetchEndWindow = NextFetchEndWindow.AddDays(10); NextFetchEndWindow = NextFetchEndWindow.AddDays(10);
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
//this is required otherwise the date navigator sometimes doesn't bold the dates properly //this is required otherwise the date navigator sometimes doesn't bold the dates properly
mDateNav.BeginInit(); mDateNav.BeginInit();
ss.BeginUpdate(); ss.BeginUpdate();
@@ -741,9 +745,9 @@ namespace AyaNova
Resource r = new Resource(Guid.Empty.ToString(), Util.LocaleText.GetLocalizedText("Dashboard.Label.NotAssigned"));//case 1821 Resource r = new Resource(Guid.Empty.ToString(), Util.LocaleText.GetLocalizedText("Dashboard.Label.NotAssigned"));//case 1821
//Lite version has no unscheduled user //Lite version has no unscheduled user
if(!AyaBizUtils.Lite) if (!AyaBizUtils.Lite)
ss.Resources.Add(r); ss.Resources.Add(r);
foreach (UserListScheduleable.UserListScheduleableInfo ui in uls) foreach (UserListScheduleable.UserListScheduleableInfo ui in uls)
@@ -926,15 +930,15 @@ namespace AyaNova
#endregion #endregion
ss.EndUpdate(); ss.EndUpdate();
mDateNav.EndInit(); mDateNav.EndInit();
DoNotAllowFetchAndBind = false; DoNotAllowFetchAndBind = false;
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }
/// <summary> /// <summary>
@@ -1016,7 +1020,7 @@ namespace AyaNova
case "LT:UI.Toolbar.Print": // ButtonTool case "LT:UI.Toolbar.Print": // ButtonTool
{ {
////case 1177 ////case 1177
if (this.sc.ActivePrintStyle is DailyPrintStyle) if (this.sc.ActivePrintStyle is DailyPrintStyle)
{ {
@@ -1039,8 +1043,8 @@ namespace AyaNova
pStyle.ResourceOptions.UseActiveViewGroupType = true; pStyle.ResourceOptions.UseActiveViewGroupType = true;
pStyle.ResourceOptions.ResourcesKind = ResourcesKind.Visible; pStyle.ResourceOptions.ResourcesKind = ResourcesKind.Visible;
pStyle.PrintAllAppointments = false; pStyle.PrintAllAppointments = false;
} }
@@ -1076,8 +1080,8 @@ namespace AyaNova
#endregion old stuff #endregion old stuff
BindData(true); BindData(true);
} }
break; break;
@@ -1141,7 +1145,7 @@ namespace AyaNova
} }
private void HideDateRangeControlsInPreviewDialog(Control ctl) private void HideDateRangeControlsInPreviewDialog(Control ctl)
{ {
switch (ctl.Name) switch (ctl.Name)
{ {
@@ -1153,21 +1157,21 @@ namespace AyaNova
ctl.Visible = false; ctl.Visible = false;
return; return;
} }
} }
foreach(Control c in ctl.Controls) foreach (Control c in ctl.Controls)
HideDateRangeControlsInPreviewDialog(c); HideDateRangeControlsInPreviewDialog(c);
} }
private string GetAllControls(Control ctl) private string GetAllControls(Control ctl)
{ {
System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (Control c in ctl.Controls) foreach (Control c in ctl.Controls)
{ {
sb.Append(c.ToString()); sb.Append(c.ToString());
sb.Append(" - "); sb.Append(" - ");
sb.Append(c.Name); sb.Append(c.Name);
if (c.Controls.Count > 0) if (c.Controls.Count > 0)
@@ -1201,6 +1205,9 @@ namespace AyaNova
#region Events #region Events
#region Active view and date navigation events #region Active view and date navigation events
/// <summary> /// <summary>
/// Event fired when active view is about to change /// Event fired when active view is about to change
/// </summary> /// </summary>
@@ -1210,6 +1217,7 @@ namespace AyaNova
{ {
if (ignoreActiveViewChanging) if (ignoreActiveViewChanging)
return; return;
ShowView(e.NewView.Type); ShowView(e.NewView.Type);
e.Cancel = true; e.Cancel = true;
} }
@@ -1221,6 +1229,8 @@ namespace AyaNova
/// <param name="newView"></param> /// <param name="newView"></param>
private void ShowView(SchedulerViewType newView) private void ShowView(SchedulerViewType newView)
{ {
StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.TimeLineView"]; StateButtonTool sbt = (StateButtonTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.TimeLineView"];
bool useTimeLineView = sbt.Checked; bool useTimeLineView = sbt.Checked;
ignoreActiveViewChanging = true; ignoreActiveViewChanging = true;
@@ -1230,7 +1240,10 @@ namespace AyaNova
if (useTimeLineView) if (useTimeLineView)
newView = SchedulerViewType.Timeline; newView = SchedulerViewType.Timeline;
else//case 714 else//case 714
{
sc.DayView.TopRowTime = TimeSpan.FromHours(8); sc.DayView.TopRowTime = TimeSpan.FromHours(8);
}
} }
sc.ActiveViewType = newView; sc.ActiveViewType = newView;
@@ -1240,7 +1253,7 @@ namespace AyaNova
} }
#endregion active view and date navigation #endregion active view and date navigation
@@ -1309,7 +1322,7 @@ namespace AyaNova
ToolBarManager.Tools["LT:UI.Toolbar.Schedule.AddToActiveWorkorderItem"].SharedProps.ToolTipText = ToolBarManager.Tools["LT:UI.Toolbar.Schedule.AddToActiveWorkorderItem"].SharedProps.ToolTipText =
Util.LocaleText.GetLocalizedText("UI.Toolbar.Schedule.AddToActiveWorkorderItem") + " (" + i.ServiceNumber + ")"; Util.LocaleText.GetLocalizedText("UI.Toolbar.Schedule.AddToActiveWorkorderItem") + " (" + i.ServiceNumber + ")";
} }
ToolBarManager.Tools["LT:UI.Toolbar.Schedule.PrintWorkorders"].SharedProps.Visible = true; ToolBarManager.Tools["LT:UI.Toolbar.Schedule.PrintWorkorders"].SharedProps.Visible = true;
} }
} }
@@ -1448,19 +1461,19 @@ namespace AyaNova
WorkorderItem wi = w.WorkorderItems[i.WorkorderItemID.ToString()]; WorkorderItem wi = w.WorkorderItems[i.WorkorderItemID.ToString()];
WorkorderItemScheduledUser su = wi.ScheduledUsers[i.SourceObjectID.ToString()]; WorkorderItemScheduledUser su = wi.ScheduledUsers[i.SourceObjectID.ToString()];
su.StartDate = apt.Start; su.StartDate = apt.Start;
su.StopDate = apt.End; su.StopDate = apt.End;
//case 1051 //case 1051
TimeSpan ts = apt.End.Subtract(apt.Start); TimeSpan ts = apt.End.Subtract(apt.Start);
su.EstimatedQuantity = decimal.Round( su.EstimatedQuantity = decimal.Round(
(decimal)ts.TotalHours, (decimal)ts.TotalHours,
2, MidpointRounding.AwayFromZero); 2, MidpointRounding.AwayFromZero);
su.UserID = gNewResourceID;
su.UserID = gNewResourceID;
if (w.IsDirty) if (w.IsDirty)
{ {
@@ -1559,13 +1572,13 @@ namespace AyaNova
} }
WorkorderItem wi = w.WorkorderItems[iLastSelected.WorkorderItemID.ToString()]; WorkorderItem wi = w.WorkorderItems[iLastSelected.WorkorderItemID.ToString()];
WorkorderItemScheduledUser wisu = wi.ScheduledUsers.Add(wi); WorkorderItemScheduledUser wisu = wi.ScheduledUsers.Add(wi);
// Guid gUserID; // Guid gUserID;
@@ -1577,7 +1590,7 @@ namespace AyaNova
wisu.StartDate = sc.SelectedInterval.Start; wisu.StartDate = sc.SelectedInterval.Start;
wisu.StopDate = sc.SelectedInterval.End; wisu.StopDate = sc.SelectedInterval.End;
wisu.UserID = new Guid(sc.SelectedResource.Id.ToString()); wisu.UserID = new Guid(sc.SelectedResource.Id.ToString());
//case 1161 //case 1161
TimeSpan ts = sc.SelectedInterval.End.Subtract(sc.SelectedInterval.Start); TimeSpan ts = sc.SelectedInterval.End.Subtract(sc.SelectedInterval.Start);
wisu.EstimatedQuantity = decimal.Round( wisu.EstimatedQuantity = decimal.Round(
@@ -1624,7 +1637,7 @@ namespace AyaNova
private void EditAppointment(Appointment apt) private void EditAppointment(Appointment apt)
{ {
if (apt.CustomFields==null || apt.CustomFields["AyaInfo"] == null) return; if (apt.CustomFields == null || apt.CustomFields["AyaInfo"] == null) return;
AppointmentList.AppointmentListInfo i = (AppointmentList.AppointmentListInfo)apt.CustomFields["AyaInfo"]; AppointmentList.AppointmentListInfo i = (AppointmentList.AppointmentListInfo)apt.CustomFields["AyaInfo"];
switch (i.SourceObjectType) switch (i.SourceObjectType)
@@ -1714,9 +1727,9 @@ namespace AyaNova
w.ClientID = c.SelectedClientID; w.ClientID = c.SelectedClientID;
WorkorderItemScheduledUser wisu = w.WorkorderItems[0].ScheduledUsers.Add(w.WorkorderItems[0]); WorkorderItemScheduledUser wisu = w.WorkorderItems[0].ScheduledUsers.Add(w.WorkorderItems[0]);
wisu.StartDate = sc.SelectedInterval.Start; wisu.StartDate = sc.SelectedInterval.Start;
wisu.StopDate = sc.SelectedInterval.End; wisu.StopDate = sc.SelectedInterval.End;
@@ -1817,9 +1830,9 @@ namespace AyaNova
//case 1039 //log.Debug("FillScheduleableUserGroupList"); //case 1039 //log.Debug("FillScheduleableUserGroupList");
ComboBoxTool cbt = (ComboBoxTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.SelectScheduleableUserGroup"]; ComboBoxTool cbt = (ComboBoxTool)ToolBarManager.Tools["LT:UI.Toolbar.Schedule.SelectScheduleableUserGroup"];
cbt.AutoComplete=true; cbt.AutoComplete = true;
cbt.ValueList.ValueListItems.Clear(); cbt.ValueList.ValueListItems.Clear();
cbt.ValueList.ValueListItems.Add(ScheduleableUserGroup.AllUsersGroupID, Util.LocaleText.GetLocalizedText("UI.Grid.RowFilterDropDownAllItem")); cbt.ValueList.ValueListItems.Add(ScheduleableUserGroup.AllUsersGroupID, Util.LocaleText.GetLocalizedText("UI.Grid.RowFilterDropDownAllItem"));
//Case 303 - check if current user is scheduleable before adding to drop combo //Case 303 - check if current user is scheduleable before adding to drop combo
@@ -1829,9 +1842,9 @@ namespace AyaNova
} }
//NVCHANGED //NVCHANGED
GenericNVList l = GenericNVList.GetList("aScheduleableUserGroup", "aID", "aName", true, true,false); GenericNVList l = GenericNVList.GetList("aScheduleableUserGroup", "aID", "aName", true, true, false);
//Loop through the items in the list and put them //Loop through the items in the list and put them
//into the combo box //into the combo box
@@ -1863,7 +1876,7 @@ namespace AyaNova
} }
#endregion #endregion
#region Custom painting #region Custom painting
#pragma warning disable 618 #pragma warning disable 618
/// <summary> /// <summary>
/// Only way to turn off all popup menus /// Only way to turn off all popup menus
@@ -1877,7 +1890,7 @@ namespace AyaNova
#pragma warning restore 618 #pragma warning restore 618
private void sc_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) private void sc_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e)
{ {
DevExpress.XtraScheduler.Drawing.AppointmentViewInfo aptinfo = (DevExpress.XtraScheduler.Drawing.AppointmentViewInfo)e.ObjectInfo; DevExpress.XtraScheduler.Drawing.AppointmentViewInfo aptinfo = (DevExpress.XtraScheduler.Drawing.AppointmentViewInfo)e.ObjectInfo;
if (aptinfo.Appointment.CustomFields == null) if (aptinfo.Appointment.CustomFields == null)
{ {
@@ -1886,15 +1899,15 @@ namespace AyaNova
object info = aptinfo.Appointment.CustomFields["AyaInfo"]; object info = aptinfo.Appointment.CustomFields["AyaInfo"];
if (info == null) return; if (info == null) return;
AppointmentList.AppointmentListInfo i = (AppointmentList.AppointmentListInfo)info; AppointmentList.AppointmentListInfo i = (AppointmentList.AppointmentListInfo)info;
int nBackWidth = 16; int nBackWidth = 16;
if (aptinfo is DevExpress.XtraScheduler.Drawing.HorizontalAppointmentViewInfo) if (aptinfo is DevExpress.XtraScheduler.Drawing.HorizontalAppointmentViewInfo)
nBackWidth = 5; nBackWidth = 5;
Color clAppointmentBackground = SystemColors.Window; Color clAppointmentBackground = SystemColors.Window;
if (aptinfo.Selected) if (aptinfo.Selected)
clAppointmentBackground = SystemColors.Highlight; clAppointmentBackground = SystemColors.Highlight;
Color clPriorityColour = SystemColors.Window; Color clPriorityColour = SystemColors.Window;
@@ -1913,7 +1926,7 @@ namespace AyaNova
Brush brAppointmentBackground = e.Cache.GetGradientBrush(rBack, clPriorityColour, Color.White, Brush brAppointmentBackground = e.Cache.GetGradientBrush(rBack, clPriorityColour, Color.White,
System.Drawing.Drawing2D.LinearGradientMode.Horizontal); System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
e.Cache.FillRectangle(brAppointmentBackground, rBack); e.Cache.FillRectangle(brAppointmentBackground, rBack);
e.Cache.FillRectangle(e.Cache.GetSolidBrush(clAppointmentBackground), rectAppointmentBackground); e.Cache.FillRectangle(e.Cache.GetSolidBrush(clAppointmentBackground), rectAppointmentBackground);
@@ -1926,15 +1939,15 @@ namespace AyaNova
} }
else else
{ {
Rectangle r = e.Bounds; Rectangle r = e.Bounds;
FillRoundedRect(e.Cache.Paint, e.Graphics, e.Cache.GetSolidBrush(clPriorityColour), r, 5); FillRoundedRect(e.Cache.Paint, e.Graphics, e.Cache.GetSolidBrush(clPriorityColour), r, 5);
r.Inflate(-1, -1); r.Inflate(-1, -1);
FillRoundedRect(e.Cache.Paint, e.Graphics, e.Cache.GetSolidBrush(clAppointmentBackground), r, 5); FillRoundedRect(e.Cache.Paint, e.Graphics, e.Cache.GetSolidBrush(clAppointmentBackground), r, 5);
//case 1228 //case 1228
r.Inflate(-3, -3); r.Inflate(-3, -3);
e.Cache.FillRectangle(System.Drawing.Brushes.White, r); e.Cache.FillRectangle(System.Drawing.Brushes.White, r);
e.Handled = true; e.Handled = true;
} }
@@ -1972,7 +1985,7 @@ namespace AyaNova
rTextArea.Height -= 5; rTextArea.Height -= 5;
//write the text //write the text
aptinfo.Appearance.DrawString(e.Cache, i.Subject, rTextArea, aptinfo.Appearance.TextOptions.GetStringFormat(TextOptions.DefaultOptionsMultiLine)); aptinfo.Appearance.DrawString(e.Cache, i.Subject, rTextArea, aptinfo.Appearance.TextOptions.GetStringFormat(TextOptions.DefaultOptionsMultiLine));
if (i.SourceObjectType == RootObjectTypes.WorkorderItemScheduledUser) if (i.SourceObjectType == RootObjectTypes.WorkorderItemScheduledUser)
{ {
if (i.PriorityARGB != 0) if (i.PriorityARGB != 0)
@@ -1990,7 +2003,7 @@ namespace AyaNova
Rectangle ir = new Rectangle(e.Bounds.X, e.Bounds.Y, 16, 16); Rectangle ir = new Rectangle(e.Bounds.X, e.Bounds.Y, 16, 16);
Brush br = e.Cache.GetSolidBrush(Color.WhiteSmoke); Brush br = e.Cache.GetSolidBrush(Color.WhiteSmoke);
//case 739 //case 739
e.Cache.Paint.DrawImage(e.Graphics,Util.Flag(i.PriorityARGB), ir); e.Cache.Paint.DrawImage(e.Graphics, Util.Flag(i.PriorityARGB), ir);
} }
} }
@@ -2009,8 +2022,8 @@ namespace AyaNova
{ {
Rectangle ir = new Rectangle(e.Bounds.X, e.Bounds.Y, 16, 16); Rectangle ir = new Rectangle(e.Bounds.X, e.Bounds.Y, 16, 16);
Brush br = e.Cache.GetSolidBrush(Color.WhiteSmoke); Brush br = e.Cache.GetSolidBrush(Color.WhiteSmoke);
e.Cache.Paint.DrawImage(e.Graphics,Resource1.ScheduleMarker16, ir); e.Cache.Paint.DrawImage(e.Graphics, Resource1.ScheduleMarker16, ir);
} }
e.Handled = true; e.Handled = true;
} }
@@ -2023,7 +2036,7 @@ namespace AyaNova
xp.FillRegion(gr, br, rgn); xp.FillRegion(gr, br, rgn);
} }
} }
void FillRoundedRect(Graphics gr, Brush br, Rectangle r, int roundRadius) void FillRoundedRect(Graphics gr, Brush br, Rectangle r, int roundRadius)
{ {
using (System.Drawing.Region rgn = new System.Drawing.Region(CreateRoundedRectPath(r, roundRadius))) using (System.Drawing.Region rgn = new System.Drawing.Region(CreateRoundedRectPath(r, roundRadius)))
@@ -2032,7 +2045,7 @@ namespace AyaNova
} }
} }
static public GraphicsPath CreateRoundedRectPath(Rectangle r, int radius) static public GraphicsPath CreateRoundedRectPath(Rectangle r, int radius)
{ {
@@ -2057,7 +2070,7 @@ namespace AyaNova
SchedRefreshTimer.Stop(); SchedRefreshTimer.Stop();
if (MouseButtons == MouseButtons.None)// Case 731 if (MouseButtons == MouseButtons.None)// Case 731
BindData(true); BindData(true);
SchedRefreshTimer.Start(); SchedRefreshTimer.Start();
} }
@@ -2065,70 +2078,79 @@ namespace AyaNova
#region Date range changed event #region Date range changed event
double nMaxWindow = 0; double nMaxWindow = 0;
// double nCurrentWindow = 0; // double nCurrentWindow = 0;
private void sc_VisibleIntervalChanged(object sender, EventArgs e) private void sc_VisibleIntervalChanged(object sender, EventArgs e)
{ {
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + "sc_VisibleIntervalChanged fired"); //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + "sc_VisibleIntervalChanged fired");
BindData(); BindData();
} }
/// <summary> /// <summary>
/// Check if the next fetch window really needs to be fetched /// Check if the next fetch window really needs to be fetched
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private bool NextFetchOutsideLastFetchWindow() private bool NextFetchOutsideLastFetchWindow()
{ {
if (NextFetchStartWindow < LastFetchStartWindow || NextFetchEndWindow > LastFetchEndWindow) if (NextFetchStartWindow < LastFetchStartWindow || NextFetchEndWindow > LastFetchEndWindow)
{ {
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " *New date range should fetch*"); //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " *New date range should fetch*");
return true; return true;
} }
// System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " Not a new date range no fetch"); // System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " Not a new date range no fetch");
return false; return false;
} }
#endregion date range change //case 3892
//void DayView_TopRowTimeChanged(object sender, DevExpress.XtraScheduler.Native.ChangeEventArgs e)
//{
// System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + "DayView_TopRowTimeChanged fired");
// BindData();
//}
#region case 812 selected appointments
public System.Collections.Generic.List<AppointmentList.AppointmentListInfo> SelectedAppointments
{
get
{
System.Collections.Generic.List<AppointmentList.AppointmentListInfo> apts = new List<AppointmentList.AppointmentListInfo>();
if (sc.SelectedAppointments.Count == 0) return apts;
foreach (Appointment a in sc.SelectedAppointments)
{
apts.Add((AppointmentList.AppointmentListInfo)a.CustomFields["AyaInfo"]);
}
return apts;
}
}
public System.Collections.Generic.List<Guid> VisibleUsers #endregion date range change
{
get
{ #region case 812 selected appointments
System.Collections.Generic.List<Guid> usrs = new List<Guid>(); public System.Collections.Generic.List<AppointmentList.AppointmentListInfo> SelectedAppointments
for (int x = 0; x < ss.Resources.Count; x++) {
{ get
Resource r = ss.Resources[x]; {
if (r.Id == null || string.IsNullOrEmpty(r.Id.ToString())) continue; System.Collections.Generic.List<AppointmentList.AppointmentListInfo> apts = new List<AppointmentList.AppointmentListInfo>();
Guid id = new Guid(r.Id.ToString()); if (sc.SelectedAppointments.Count == 0) return apts;
if (id == Guid.Empty) continue; foreach (Appointment a in sc.SelectedAppointments)
if(r.Visible) {
usrs.Add(id); apts.Add((AppointmentList.AppointmentListInfo)a.CustomFields["AyaInfo"]);
}
return apts;
}
}
public System.Collections.Generic.List<Guid> VisibleUsers
{
get
{
System.Collections.Generic.List<Guid> usrs = new List<Guid>();
for (int x = 0; x < ss.Resources.Count; x++)
{
Resource r = ss.Resources[x];
if (r.Id == null || string.IsNullOrEmpty(r.Id.ToString())) continue;
Guid id = new Guid(r.Id.ToString());
if (id == Guid.Empty) continue;
if (r.Visible)
usrs.Add(id);
}
return usrs;
}
}
#endregion
}
return usrs;
}
}
#endregion
@@ -2147,5 +2169,5 @@ namespace AyaNova
get { return this.EndDate; } get { return this.EndDate; }
} }
} }
} }