This commit is contained in:
2018-06-29 19:47:36 +00:00
commit be7f501333
3769 changed files with 1425961 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// AYMessage event used primarily to
/// send record action events from masterpage to content page
/// (i.e. when user clicks on save or delete in toolbar in master page
/// this event and args are raised so that the content page can handle them)
/// Or for any other message that might be required to send from one place to another
/// </summary>
public class AYMessageEventArgs : EventArgs
{
private AYMessageType _messageType;
private string _message;
private object _messageObject;
public AYMessageEventArgs(AYMessageType messageType, string message, object messageObject)
{
_messageType = messageType;
_message = message;
_messageObject = messageObject;
}
public AYMessageEventArgs(AYMessageType messageType, string message)
{
_messageType = messageType;
_message = message;
_messageObject = null;
}
public AYMessageType MessageType
{
get
{
return _messageType;
}
set
{
_messageType = value;
}
}
public string Message
{
get
{
return _message;
}
set
{
_message = value;
}
}
public object MessageObject
{
get
{
return _messageObject;
}
set
{
_messageObject = value;
}
}
}
public delegate void AYMessageEventHandler(object sender, AYMessageEventArgs e);
public enum AYMessageType : int
{
Custom = 0,
RecordAction = 1,
ToolBarClick = 2,
Print = 3,
UpdateObject=4
}
/// <summary>
/// Used within sub forms to indicate what to do
/// with the current record
/// </summary>
public enum RecordActionType : int
{
SaveOnly = 1,
SaveAndExit = 2,
SaveAndNew = 3,
PromptToSave = 4,
DeleteAndExit = 5
}

View File

@@ -0,0 +1,85 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Drawing;
using System.Collections.Generic;
namespace GZTW.CustomWebControls
{
/// <summary>
/// Summary description for AyColorPicker
/// </summary>
public class AyColorPicker : DropDownList
{
public AyColorPicker()
{
foreach (Color c in TypeDescriptor.GetConverter(typeof(Color)).GetStandardValues())
{
if (!c.IsSystemColor)
{
ListItem li = new ListItem();
li.Text = TypeDescriptor.GetConverter(c).ConvertToString(c);
li.Value = c.ToArgb().ToString();
li.Attributes.Add("style", "background-color:" + li.Text);
Items.Add(li);
}
}
}
public void SetPreselectedColors(Dictionary<string,int> lPreSelectedColors)
{
//Loop through the colors, see if they are named colors already in the list
//if not then add them
foreach (KeyValuePair<string, int> kvp in lPreSelectedColors)
{
if(Items.FindByValue(kvp.Value.ToString())==null)
{
//add as custom value
ListItem li = new ListItem();
li.Text = kvp.Key;
li.Value = kvp.Value.ToString();
li.Attributes.Add("style", "background-color:" +System.Drawing.ColorTranslator.ToHtml(Color.FromArgb(kvp.Value)));
Items.Add(li);
}
}
}
/// <summary>
/// append a single preselected color to the combo and select it
/// </summary>
/// <param name="sDisplay"></param>
/// <param name="nValue"></param>
public void SetPreselectedColor(string sDisplay, int nValue)
{
ListItem li=Items.FindByValue(nValue.ToString());
if (li == null)
{
//add as custom value
li = new ListItem();
li.Text = sDisplay;
li.Value = nValue.ToString();
li.Attributes.Add("style", "background-color:" + System.Drawing.ColorTranslator.ToHtml(Color.FromArgb(nValue)));
Items.Add(li);
}
SelectedValue = nValue.ToString();
}
}
}

View File

@@ -0,0 +1,253 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Infragistics.WebUI.Data;
using Infragistics.WebUI.WebSchedule;
using Infragistics.WebUI.Shared;
using GZTW.AyaNova.BLL;
using System.Drawing;
using System.Collections;
/// <summary>
/// Summary description for AyaScheduleProvider
/// </summary>
public class AyaScheduleProvider : WebScheduleDataProviderBase, IDataFetch, IDataUpdate
{
public AyaScheduleProvider()
{
}
private Guid _activeUserID = Guid.Empty;
public Guid ActiveUserID
{
get
{
return _activeUserID;
}
set
{
_activeUserID = value;
}
}
public void Fetch(DataContext context)
{
if(context is FetchActivitiesContext)
{
FetchActivities((FetchActivitiesContext)context);
}
//if (context is FetchResourcesContext)
//{
// FetchResourcesContext r = (FetchResourcesContext)context;
// Resource rs = new Resource();
// r.Resources.Clear();
// rs.Key = "1";
// rs.Name = "1";
// ((IList)r.Resources).Add(rs);
//}
}
#region IDataFetch Members
private void FetchActivities(FetchActivitiesContext context)
{
context.Activities.Clear();
//Case 835 commented out
//User user = null;
//if (ActiveUserID != Guid.Empty)
// user = User.GetItem(ActiveUserID);
//Case 835
UserListScheduleable uls = UserListScheduleable.GetList();
AppointmentList apl = AppointmentList.GetList(context.FrameInterval.StartDate.Value, context.FrameInterval.EndDate.Value, ActiveUserID);
foreach (AppointmentList.AppointmentListInfo i in apl)
{
switch (i.SourceObjectType)
{
case RootObjectTypes.WorkorderItemScheduledUser:
{
#region populate woitems
if (ActiveUserID == i.AppliesToObjectID)
{
// create a new appointment with a reference to the ScheduleInfo object that requested the fetch
Appointment a = new Appointment(this.WebScheduleInfo);
//Further update: currently just going to open workorder form, let user
//find the scheduled item, todo is to modify workorderedit to accept
//further parameters on the url for the workorderitem, subobject or whatever
a.Key = "WO," + i.WorkorderID.ToString()+","+i.WorkorderItemID+","+i.SourceObjectID;
a.Subject = i.Subject;
a.StartDateTime = new SmartDate(i.StartDateTime);
a.EndDateTime = new SmartDate(i.EndDateTime);
// a.ResourceKey = "1";
if (i.ShowPriorityFlag)
{
a.Style.BorderStyle = BorderStyle.Solid;
a.Style.BorderColor = Color.FromArgb(i.PriorityARGB);
a.Style.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(2);
}
//Workorder status colors
//if backcolor==0 that means no color was set so
//leave the appointment to it's natural default colors which are transparent
//background with black text
if (i.BackColorARGB != 0)
{
a.Style.BackColor = Color.FromArgb(i.BackColorARGB);
a.Style.ForeColor = Util.InvertColor(a.Style.BackColor);
}
// add appointment to the activities list in the context
((IList)context.Activities).Add(a);
}
#endregion
}
break;
case RootObjectTypes.ScheduleMarker:
{
//Don't process for unassigned user
if (ActiveUserID == Guid.Empty) break;
//Could be a bunch by region , global , dispatchzone, schedusergroup
//or could be a single by one user ID
switch (i.AppliesToObjectType)
{
case RootObjectTypes.User:
{
if(i.AppliesToObjectID==ActiveUserID)
CreateScheduleMarker(context, i);
}
break;
case RootObjectTypes.Region:
{
//Case 835
if(uls[ActiveUserID].RegionID==i.AppliesToObjectID)
//if (user.RegionID == i.AppliesToObjectID)
{
CreateScheduleMarker(context, i);
}
}
break;
case RootObjectTypes.DispatchZone:
{
//Case 835
if (uls[ActiveUserID].DispatchZoneID == i.AppliesToObjectID)
//if (user.DispatchZoneID == i.AppliesToObjectID)
{
CreateScheduleMarker(context, i);
}
}
break;
case RootObjectTypes.ScheduleableUserGroup:
{
ScheduleableUserGroupUsersList ScheduleMarkerGroup = ScheduleableUserGroupUsersList.GetList(i.AppliesToObjectID);
if (ScheduleMarkerGroup.Contains(ActiveUserID))//Case 835
{
CreateScheduleMarker(context, i);
}
}
break;
case RootObjectTypes.Global:
{
CreateScheduleMarker(context, i);
}
break;
}
}
break;
}
}
}
private void CreateScheduleMarker(FetchActivitiesContext context, AppointmentList.AppointmentListInfo i)
{
Appointment a = new Appointment(this.WebScheduleInfo);
a.Subject = i.Subject;
a.Key = "SM," + i.SourceObjectID.ToString();
a.StartDateTime = new SmartDate(i.StartDateTime);
a.EndDateTime = new SmartDate(i.EndDateTime);
if (i.BackColorARGB != 0)
{
//a.Style.BackColor = Color.FromArgb(i.BackColorARGB);
//a.Style.ForeColor = Util.InvertColor(a.Style.BackColor);
}
// a.Style.CustomRules = "Background-repeat:no-repeat;background-position:Top Right";
//a.Style.BackgroundImage = "~/graphics/ScheduleMarker16.png";
a.Style.BorderStyle = BorderStyle.Dashed;
a.Style.BorderColor = Color.FromArgb(i.BackColorARGB);
a.Style.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(2);
// add appointment to the activities list in the context
//a.ResourceKey = "1";
((IList)context.Activities).Add(a);
}
#endregion
#region IDataUpdate Members
public void Update(DataContext context)
{
if (context is UpdateActivityContext)
{
UpdateActivityContext up = (UpdateActivityContext)context;
string[] ar = up.Activity.Key.Split(',');
if (ar[0] == "WO")
{
Workorder w = Workorder.GetItem(new Guid(ar[1]));
WorkorderItemScheduledUser wsu=w.WorkorderItems[ar[2]].ScheduledUsers[ar[3]];
wsu.StartDate = up.Activity.StartDateTime.DBValue;
wsu.StopDate = up.Activity.EndDateTime.DBValue;
w.Save();
}
else
{
ScheduleMarker sm = ScheduleMarker.GetItem(new Guid(ar[1]));
sm.StartDate = up.Activity.StartDateTime.DBValue;
sm.StopDate = up.Activity.EndDateTime.DBValue;
sm.Save();
}
}
}
#endregion
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GZTW.AyaNova.BLL;
/// <summary>
/// Base page for all edit pages
/// Handles rights, localization and all other
/// common methods
/// </summary>
public class BaseEditPage : System.Web.UI.Page
{
public BaseEditPage()
{
//
// TODO: Add constructor logic here
//
}
protected override void OnPreInit(EventArgs e)
{
Util.SetUserLocale();
base.OnPreInit(e);
//if (Request.Cookies["Theme"] == null)
//{
// Response.Cookies["Theme"].Value = "Default";
// Response.Cookies["Theme"].Expires = DateTime.Now.AddYears(30);
// Page.Theme = "Default";
//}
//else
//{
// Page.Theme = ((string)Request.Cookies["Theme"].Value);
//}
////Test built in themes in new ajax controls
//Page.Theme = "Inox";
//if (Session["MyTheme"] == null)
//{
// Session.Add("MyTheme", "Default");
// Page.Theme = ((string)Session["MyTheme"]);
//}
//else
//{
// Page.Theme = ((string)Session["MyTheme"]);
//}
}
protected override void OnLoad(EventArgs e)
{
//Place code here that should be called before the inheriting page's onload is executed
//case 1651
string sIE9ForceCompatibility = System.Configuration.ConfigurationManager.AppSettings["IE9ForceCompatbilityMode"];
if (!string.IsNullOrWhiteSpace(sIE9ForceCompatibility))
{
if (sIE9ForceCompatibility.ToLower() == "true")
{
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "X-UA-Compatible";
meta.Content = "IE=8";
this.Header.Controls.Add(meta);
}
}
base.OnLoad(e);
//Place code here that should be called *after* the inheriting pages onload is executed
if (!IsAjaxCallback)
{
if (this.Context.Session != null)
Util.SessionAddKeepAlive(this.Page);
}
Literal l = new Literal();
l.Text = "<link rel=\"stylesheet\" href=\"aya.css\" type=\"text/css\" />";
l.ID = "aya";
if (Page.Header.FindControl(l.ID) == null)
Page.Header.Controls.Add(l);
//case 1111
Util.PageAddCustomContent(this.Page);
}
protected void CloseMe()
{
//this causes the original window to refresh, useful if record has changed
//Response.Write("<script language=\"JavaScript\">window.opener.location.reload();</script>");
// Response.Write("<script language=\"JavaScript\">window.setTimeout('window.close()',10);</script>");
//Response.Write("<script language=\"JavaScript\">window.close();</script>");
//This version works around the IE7 tab close warning, that the above one generates
Response.Write("<script type=\"text/javascript\"> window.open('','_parent',''); window.close(); </script> ");
}
private bool checkedforcallback=false;
private bool iscallback = false;
public bool IsAjaxCallback
{
get
{
if (!checkedforcallback)
{
iscallback = Page.IsCallback;
//HttpContext ctx = HttpContext.Current;
//iscallback = (
// ctx != null &&
// ctx.Request != null &&
// (ctx.Request.QueryString["rcbID"] != null ||
// ctx.Request.Form["RadAJAXControlID"]!=null));
checkedforcallback = true;
}
return iscallback;
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class BaseThemePage : System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{
Util.SetUserLocale();
base.OnPreInit(e);
//if (Request != null)
//{
// if (Request.Cookies["Theme"] == null)
// {
// Response.Cookies["Theme"].Value = "Default";
// Response.Cookies["Theme"].Expires = DateTime.Now.AddYears(30);
// Page.Theme = "Default";
// }
// else
// {
// Page.Theme = ((string)Request.Cookies["Theme"].Value);
// }
//}
////Test built in themes in new ajax controls
//Page.Theme = "Sunset";
}
protected override void OnLoad(EventArgs e)
{
//Place code here that should be called before the inheriting page's onload is executed
//case 1651
string sIE9ForceCompatibility = System.Configuration.ConfigurationManager.AppSettings["IE9ForceCompatbilityMode"];
if (!string.IsNullOrWhiteSpace(sIE9ForceCompatibility))
{
if (sIE9ForceCompatibility.ToLower() == "true")
{
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "X-UA-Compatible";
meta.Content = "IE=8";
this.Header.Controls.Add(meta);
}
}
base.OnLoad(e);
if (!IsAjaxCallback)
{
if (this.Context.Session != null)
Util.SessionAddKeepAlive(this.Page);
}
Literal l = new Literal();
l.Text = "<link rel=\"stylesheet\" href=\"aya.css\" type=\"text/css\" />";
l.ID = "aya";
if (Page.Header.FindControl(l.ID) == null)
Page.Header.Controls.Add(l);
//case 1111
Util.PageAddCustomContent(this.Page);
}
protected void CloseMe()
{
//this causes the original window to refresh, useful if record has changed
//Response.Write("<script language=\"JavaScript\">window.opener.location.reload();</script>");
// Response.Write("<script language=\"JavaScript\">window.setTimeout('window.close()',10);</script>");
//Response.Write("<script language=\"JavaScript\">window.close();</script>");
//This version works around the IE7 tab close warning, that the above one generates
Response.Write("<script type=\"text/javascript\"> window.open('','_parent',''); window.close(); </script> ");
}
private bool checkedforcallback = false;
private bool iscallback = false;
public bool IsAjaxCallback
{
get
{
if (!checkedforcallback)
{
iscallback = Page.IsCallback;
//HttpContext ctx = HttpContext.Current;
//iscallback = (
// ctx != null &&
// ctx.Request != null &&
// (ctx.Request.QueryString["rcbID"] != null ||
// ctx.Request.Form["RadAJAXControlID"] != null));
checkedforcallback = true;
}
return iscallback;
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CustomHandler
{
public class SessionStateDialogHandler : Telerik.Web.UI.DialogHandler, System.Web.SessionState.IRequiresSessionState
{
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class Theme
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
public Theme(string name)
{
Name = name;
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class ThemeManager
{
#region Theme-Related Method
public static List<Theme> GetThemes()
{
DirectoryInfo dInfo = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath("App_Themes"));
DirectoryInfo[] dArrInfo = dInfo.GetDirectories();
List<Theme> list = new List<Theme>();
foreach (DirectoryInfo sDirectory in dArrInfo)
{
Theme temp = new Theme(sDirectory.Name);
list.Add(temp);
}
return list;
}
#endregion
}

3893
source/WBI/App_Code/Util.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,143 @@
using System;
using System.Xml;
using System.IO;
/// <summary>
/// Persistence of WBI specific application settings
/// used with the Integration object
/// </summary>
[Serializable]
public class WBIIntegrationData
{
public WBIIntegrationData(){}
#region fields
private Guid _ClientWorkorderReportID = Guid.Empty;
private string _CSRInfoText = "";
//case 1169
private bool _ClientViewWorkorderWiki = false;
public bool IsDirty = false;
#endregion
#region Properties
public Guid ClientWorkorderReportID
{
get { return _ClientWorkorderReportID; }
set
{
if (_ClientWorkorderReportID != value)
{
_ClientWorkorderReportID = value;
IsDirty = true;
}
}
}
public string CSRInfoText
{
get { return _CSRInfoText; }
set
{
if (_CSRInfoText != value)
{
_CSRInfoText = value;
IsDirty = true;
}
}
}
public bool HasCSRInfoText
{
get
{
return !(string.IsNullOrEmpty(_CSRInfoText));
}
}
//case 1169
public bool ClientViewWorkorderWiki
{
get { return _ClientViewWorkorderWiki; }
set
{
if (_ClientViewWorkorderWiki != value)
{
_ClientViewWorkorderWiki = value;
IsDirty = true;
}
}
}
#endregion props
#region XML in/out
/// <summary>
/// Set - Sets the fields in this object based on the contents of the xml string
/// Get - Get's the fields of this object in the format of an xml string
/// </summary>
public string XMLData
{
get
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.Xml.XmlTextWriter w = new System.Xml.XmlTextWriter(new StringWriter(sb));
w.Formatting = System.Xml.Formatting.Indented;
w.WriteStartDocument(true);
w.WriteStartElement("WBISettings");
w.WriteElementString("ClientWorkorderReportID", XmlConvert.ToString(_ClientWorkorderReportID));
w.WriteElementString("CSRInfoText", _CSRInfoText);
//case 1169
w.WriteElementString("ClientViewWorkorderWiki", XmlConvert.ToString(_ClientViewWorkorderWiki));
w.WriteEndElement();
w.WriteEndDocument();
w.Flush();
w.Close();
return sb.ToString();
}
set
{
// Load the signed XML license file.
XmlDocument xmldoc = new XmlDocument();
try
{
xmldoc.LoadXml(value);
}
catch (Exception ex)
{
throw new ApplicationException("Error: exception in WBIIntegrationData::XMLData.set()->LoadXml:\r\n." + ex.Message, ex.InnerException);
}
_ClientWorkorderReportID = XmlConvert.ToGuid(xmldoc.SelectSingleNode("/WBISettings/ClientWorkorderReportID").InnerText);
_CSRInfoText = xmldoc.SelectSingleNode("/WBISettings/CSRInfoText").InnerText;
//FUTURE: items are going to have to check for presence of nodes before attempting to retrieve them...
//case 1169
if (xmldoc.SelectSingleNode("/WBISettings/ClientViewWorkorderWiki") != null)
_ClientViewWorkorderWiki = XmlConvert.ToBoolean(xmldoc.SelectSingleNode("/WBISettings/ClientViewWorkorderWiki").InnerText);
else
_ClientViewWorkorderWiki = false;
}
}
#endregion
}