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,146 @@
using System;
using System.Xml;
using System.IO;
namespace ri.util
{
/// <summary>
/// Persistence of RI specific application settings
/// used with the IntegrationSimple object
/// </summary>
[Serializable]
public class RIIntegrationData
{
public RIIntegrationData() { }
#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("RISettings");
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
{
XmlDocument xmldoc = new XmlDocument();
try
{
xmldoc.LoadXml(value);
}
catch (Exception ex)
{
throw new ApplicationException("Error: exception in RIIntegrationData::XMLData.set()->LoadXml:\r\n." + ex.Message, ex.InnerException);
}
_ClientWorkorderReportID = XmlConvert.ToGuid(xmldoc.SelectSingleNode("/RISettings/ClientWorkorderReportID").InnerText);
_CSRInfoText = xmldoc.SelectSingleNode("/RISettings/CSRInfoText").InnerText;
//FUTURE: items are going to have to check for presence of nodes before attempting to retrieve them...
//case 1169
if (xmldoc.SelectSingleNode("/RISettings/ClientViewWorkorderWiki") != null)
_ClientViewWorkorderWiki = XmlConvert.ToBoolean(xmldoc.SelectSingleNode("/RISettings/ClientViewWorkorderWiki").InnerText);
else
_ClientViewWorkorderWiki = false;
}
}
#endregion
}
}//end namespace

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Web.Mvc;
namespace ri.util.extensions
{
public static class ayUriExtensions
{
//The purpose of this class is to set Bootstrap menu item to active when
//the matching route is returned
//http://stackoverflow.com/questions/12194603/mvc-4-and-extension-methods-with-razor
//http://stackoverflow.com/questions/22407367/mvc-with-bootstrap-navbar-set-selected-item-to-active
public static string MakeActive(this UrlHelper urlHelper, string action, string controller, string area = "")
{
string result = "active";
string requestContextRoute;
string passedInRoute;
// Get the route values from the request
var sb = new StringBuilder().Append(urlHelper.RequestContext.RouteData.DataTokens["area"]);
sb.Append("/");
sb.Append(urlHelper.RequestContext.RouteData.Values["controller"].ToString());
sb.Append("/");
sb.Append(urlHelper.RequestContext.RouteData.Values["action"].ToString());
requestContextRoute = sb.ToString();
if (string.IsNullOrWhiteSpace(area))
{
passedInRoute = "/" + controller + "/" + action;
}
else
{
passedInRoute = area + "/" + controller + "/" + action;
}
// Are the 2 routes the same?
if (!requestContextRoute.Equals(passedInRoute, StringComparison.OrdinalIgnoreCase))
{
result = null;
}
return result;
}
//eoc
}
}

4251
source/ri/ri/util/util.cs Normal file

File diff suppressed because it is too large Load Diff