Move uEvents
This commit is contained in:
@@ -4730,10 +4730,6 @@
|
||||
<Project>{a625544f-660a-4c01-ba49-1b467d0322d9}</Project>
|
||||
<Name>our.umbraco.org</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uEvents\uEvents.csproj">
|
||||
<Project>{f356b339-296a-4594-81b6-cf69a802483e}</Project>
|
||||
<Name>uEvents</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uForum\uForum.csproj">
|
||||
<Project>{547c2d0d-1b55-493b-ae0b-e031a5b8ee77}</Project>
|
||||
<Name>uForum</Name>
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.XPath;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.DataLayer;
|
||||
using System.Xml;
|
||||
using uEvents.Relations;
|
||||
|
||||
namespace uEvents.Library
|
||||
{
|
||||
[Umbraco.Core.Macros.XsltExtension("uEvents")]
|
||||
public class Xslt
|
||||
{
|
||||
public static bool isSignedUp(int eventId, int memberId)
|
||||
{
|
||||
return umbraco.cms.businesslogic.relation.Relation.IsRelated(eventId, memberId);
|
||||
}
|
||||
|
||||
public static bool isFull(int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
return e.IsFull;
|
||||
}
|
||||
|
||||
public static void SignUp(int memberId, int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
e.SignUp(memberId, "no comment");
|
||||
}
|
||||
|
||||
public static void Cancel(int memberId, int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
e.Cancel(memberId, "no comment");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator UpcomingEvents()
|
||||
{
|
||||
int contentType = DocumentType.GetByAlias("Event").Id;
|
||||
string property = "start";
|
||||
|
||||
string sql = string.Format(@"SELECT distinct contentNodeId from cmsPropertyData
|
||||
inner join cmsPropertyType ON
|
||||
cmspropertytype.contenttypeid = {0} and
|
||||
cmspropertytype.Alias = '{1}' and
|
||||
cmspropertytype.id = cmspropertydata.propertytypeid
|
||||
where dataDate > GETDATE()", contentType, property);
|
||||
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
IRecordsReader rr = sqlhelper.ExecuteReader(sql);
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = umbraco.xmlHelper.addTextNode(doc, "events", "");
|
||||
|
||||
while (rr.Read())
|
||||
{
|
||||
XmlNode x = (XmlNode)umbraco.content.Instance.XmlContent.GetElementById( rr.GetInt("contentNodeId").ToString() );
|
||||
|
||||
if (x != null)
|
||||
{
|
||||
x = doc.ImportNode(x, true);
|
||||
root.AppendChild(x);
|
||||
}
|
||||
}
|
||||
rr.Close();
|
||||
rr.Dispose();
|
||||
|
||||
return root.CreateNavigator().Select(".");
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.XPath;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.DataLayer;
|
||||
using System.Xml;
|
||||
using uEvents.Relations;
|
||||
|
||||
namespace uEvents.Library
|
||||
{
|
||||
[Umbraco.Core.Macros.XsltExtension("uEvents")]
|
||||
public class Xslt
|
||||
{
|
||||
public static bool isSignedUp(int eventId, int memberId)
|
||||
{
|
||||
return umbraco.cms.businesslogic.relation.Relation.IsRelated(eventId, memberId);
|
||||
}
|
||||
|
||||
public static bool isFull(int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
return e.IsFull;
|
||||
}
|
||||
|
||||
public static void SignUp(int memberId, int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
e.SignUp(memberId, "no comment");
|
||||
}
|
||||
|
||||
public static void Cancel(int memberId, int eventId)
|
||||
{
|
||||
Event e = new Event(eventId);
|
||||
e.Cancel(memberId, "no comment");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator UpcomingEvents()
|
||||
{
|
||||
int contentType = DocumentType.GetByAlias("Event").Id;
|
||||
string property = "start";
|
||||
|
||||
string sql = string.Format(@"SELECT distinct contentNodeId from cmsPropertyData
|
||||
inner join cmsPropertyType ON
|
||||
cmspropertytype.contenttypeid = {0} and
|
||||
cmspropertytype.Alias = '{1}' and
|
||||
cmspropertytype.id = cmspropertydata.propertytypeid
|
||||
where dataDate > GETDATE()", contentType, property);
|
||||
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
IRecordsReader rr = sqlhelper.ExecuteReader(sql);
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = umbraco.xmlHelper.addTextNode(doc, "events", "");
|
||||
|
||||
while (rr.Read())
|
||||
{
|
||||
XmlNode x = (XmlNode)umbraco.content.Instance.XmlContent.GetElementById( rr.GetInt("contentNodeId").ToString() );
|
||||
|
||||
if (x != null)
|
||||
{
|
||||
x = doc.ImportNode(x, true);
|
||||
root.AppendChild(x);
|
||||
}
|
||||
}
|
||||
rr.Close();
|
||||
rr.Dispose();
|
||||
|
||||
return root.CreateNavigator().Select(".");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +1,120 @@
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web;
|
||||
using Relation = umbraco.cms.businesslogic.relation.Relation;
|
||||
using RelationType = umbraco.cms.businesslogic.relation.RelationType;
|
||||
|
||||
namespace uEvents.Relations
|
||||
{
|
||||
public class Event
|
||||
{
|
||||
private readonly IPublishedContent _content;
|
||||
|
||||
public Event(int eventId)
|
||||
{
|
||||
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
|
||||
_content = umbracoHelper.TypedContent(eventId);
|
||||
}
|
||||
|
||||
public Event(IPublishedContent eventDocument)
|
||||
{
|
||||
_content = eventDocument;
|
||||
}
|
||||
|
||||
public bool IsFull {
|
||||
get
|
||||
{
|
||||
return this.SignedUp >= this.Capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public int OnWaitingList
|
||||
{
|
||||
get
|
||||
{
|
||||
return Relations.EventRelation.GetWaiting(_content.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int Capacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _content.GetPropertyValue<int>("capacity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int SignedUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return Relations.EventRelation.GetSignedUp(_content.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Cancel(int memberid, string comment)
|
||||
{
|
||||
Relations.EventRelation.ClearRelations(memberid, _content.Id);
|
||||
|
||||
syncCapacity();
|
||||
}
|
||||
|
||||
|
||||
public void SignUp(int memberid, string comment)
|
||||
{
|
||||
if (!IsFull)
|
||||
{
|
||||
Relations.EventRelation.RelateMemberToEvent(memberid, _content.Id, comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
Relations.EventRelation.PutMemberOnWaitingList(memberid, _content.Id, comment);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncCapacity()
|
||||
{
|
||||
int max = this.Capacity;
|
||||
int signedUp = this.SignedUp;
|
||||
int waiting = this.OnWaitingList;
|
||||
|
||||
//2 scenarios, either the room is now smaller or bigger
|
||||
if (max >= signedUp)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "bigger cap");
|
||||
|
||||
//get people on the waitinglist and promote them to coming to event
|
||||
int diff = max - signedUp;
|
||||
RelationType coming = RelationType.GetByAlias("event");
|
||||
foreach (Relation r in Relations.EventRelation.GetPeopleWaiting(_content.Id, diff))
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "R:" + r.Id.ToString() );
|
||||
r.RelType = coming;
|
||||
r.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "smaller cap");
|
||||
|
||||
//get people on the signedup list and put the people who signed up last on the waiting list.
|
||||
//remember to preserve the original sign-up date
|
||||
int diff = signedUp - max;
|
||||
RelationType waitinglist = RelationType.GetByAlias("waitinglist");
|
||||
foreach (Relation r in Relations.EventRelation.GetPeopleSignedUpLast(_content.Id, diff))
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "R:" + r.Id.ToString());
|
||||
r.RelType = waitinglist;
|
||||
r.Save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web;
|
||||
using Relation = umbraco.cms.businesslogic.relation.Relation;
|
||||
using RelationType = umbraco.cms.businesslogic.relation.RelationType;
|
||||
|
||||
namespace uEvents.Relations
|
||||
{
|
||||
public class Event
|
||||
{
|
||||
private readonly IPublishedContent _content;
|
||||
|
||||
public Event(int eventId)
|
||||
{
|
||||
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
|
||||
_content = umbracoHelper.TypedContent(eventId);
|
||||
}
|
||||
|
||||
public Event(IPublishedContent eventDocument)
|
||||
{
|
||||
_content = eventDocument;
|
||||
}
|
||||
|
||||
public bool IsFull {
|
||||
get
|
||||
{
|
||||
return this.SignedUp >= this.Capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public int OnWaitingList
|
||||
{
|
||||
get
|
||||
{
|
||||
return Relations.EventRelation.GetWaiting(_content.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int Capacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _content.GetPropertyValue<int>("capacity");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int SignedUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return Relations.EventRelation.GetSignedUp(_content.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Cancel(int memberid, string comment)
|
||||
{
|
||||
Relations.EventRelation.ClearRelations(memberid, _content.Id);
|
||||
|
||||
syncCapacity();
|
||||
}
|
||||
|
||||
|
||||
public void SignUp(int memberid, string comment)
|
||||
{
|
||||
if (!IsFull)
|
||||
{
|
||||
Relations.EventRelation.RelateMemberToEvent(memberid, _content.Id, comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
Relations.EventRelation.PutMemberOnWaitingList(memberid, _content.Id, comment);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncCapacity()
|
||||
{
|
||||
int max = this.Capacity;
|
||||
int signedUp = this.SignedUp;
|
||||
int waiting = this.OnWaitingList;
|
||||
|
||||
//2 scenarios, either the room is now smaller or bigger
|
||||
if (max >= signedUp)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "bigger cap");
|
||||
|
||||
//get people on the waitinglist and promote them to coming to event
|
||||
int diff = max - signedUp;
|
||||
RelationType coming = RelationType.GetByAlias("event");
|
||||
foreach (Relation r in Relations.EventRelation.GetPeopleWaiting(_content.Id, diff))
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "R:" + r.Id.ToString() );
|
||||
r.RelType = coming;
|
||||
r.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "smaller cap");
|
||||
|
||||
//get people on the signedup list and put the people who signed up last on the waiting list.
|
||||
//remember to preserve the original sign-up date
|
||||
int diff = signedUp - max;
|
||||
RelationType waitinglist = RelationType.GetByAlias("waitinglist");
|
||||
foreach (Relation r in Relations.EventRelation.GetPeopleSignedUpLast(_content.Id, diff))
|
||||
{
|
||||
Log.Add(LogTypes.Debug, _content.Id, "R:" + r.Id.ToString());
|
||||
r.RelType = waitinglist;
|
||||
r.Save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+119
-119
@@ -1,119 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
using umbraco.DataLayer;
|
||||
|
||||
namespace uEvents.Relations
|
||||
{
|
||||
public class EventRelation
|
||||
{
|
||||
private static string _event = "event";
|
||||
private static string _waitinglist = "waitinglist";
|
||||
|
||||
|
||||
public static void RelateMemberToEvent(int memberId, int eventId, string comment)
|
||||
{
|
||||
if (!Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
RelationType rt = RelationType.GetByAlias(_event);
|
||||
Relation.MakeNew(eventId, memberId, rt, comment);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PutMemberOnWaitingList(int memberId, int eventId, string comment)
|
||||
{
|
||||
if (!Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
RelationType rt = RelationType.GetByAlias(_waitinglist);
|
||||
Relation.MakeNew(eventId, memberId, rt, comment);
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetRelations(string alias, int parentId)
|
||||
{
|
||||
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
int result = sqlhelper.ExecuteScalar<int>(
|
||||
@"
|
||||
SELECT count(umbracoRelation.id)
|
||||
FROM umbracoRelation
|
||||
INNER JOIN umbracoRelationType ON umbracoRelationType.id = umbracoRelation.relType AND umbracoRelationType.alias = @alias
|
||||
where parentId = @parent
|
||||
"
|
||||
,
|
||||
sqlhelper.CreateParameter("@parent", parentId),
|
||||
sqlhelper.CreateParameter("@alias", alias)
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int GetSignedUp(int eventId)
|
||||
{
|
||||
return GetRelations(_event, eventId);
|
||||
}
|
||||
|
||||
public static int GetWaiting(int eventId)
|
||||
{
|
||||
return GetRelations(_waitinglist, eventId);
|
||||
}
|
||||
|
||||
private static List<Relation> GetRelations(string alias, string sort, int parentId, int number)
|
||||
{
|
||||
List<Relation> retval = new List<Relation>();
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
|
||||
IRecordsReader rr = sqlhelper.ExecuteReader(
|
||||
|
||||
string.Format(@"
|
||||
SELECT TOP {0} umbracoRelation.id
|
||||
FROM umbracoRelation
|
||||
INNER JOIN umbracoRelationType ON umbracoRelationType.id = umbracoRelation.relType AND umbracoRelationType.alias = @alias
|
||||
where parentId = @parent
|
||||
ORDER BY datetime {1}
|
||||
", number, sort)
|
||||
|
||||
,
|
||||
sqlhelper.CreateParameter("@parent", parentId),
|
||||
sqlhelper.CreateParameter("@alias", alias)
|
||||
);
|
||||
|
||||
while (rr.Read())
|
||||
{
|
||||
retval.Add( new Relation( rr.GetInt("id") ) );
|
||||
}
|
||||
rr.Close();
|
||||
rr.Dispose();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static List<Relation> GetPeopleWaiting(int eventId, int number)
|
||||
{
|
||||
return GetRelations(_waitinglist, "ASC", eventId, number);
|
||||
}
|
||||
|
||||
public static List<Relation> GetPeopleSignedUpLast(int eventId, int number)
|
||||
{
|
||||
return GetRelations(_event, "DESC", eventId, number);
|
||||
}
|
||||
|
||||
|
||||
public static void ClearRelations(int memberId, int eventId)
|
||||
{
|
||||
if (Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
foreach (Relation r in Relation.GetRelations(eventId))
|
||||
{
|
||||
if (r.Child.Id == memberId)
|
||||
{
|
||||
r.Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using umbraco.cms.businesslogic.relation;
|
||||
using umbraco.DataLayer;
|
||||
|
||||
namespace uEvents.Relations
|
||||
{
|
||||
public class EventRelation
|
||||
{
|
||||
private static string _event = "event";
|
||||
private static string _waitinglist = "waitinglist";
|
||||
|
||||
|
||||
public static void RelateMemberToEvent(int memberId, int eventId, string comment)
|
||||
{
|
||||
if (!Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
RelationType rt = RelationType.GetByAlias(_event);
|
||||
Relation.MakeNew(eventId, memberId, rt, comment);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PutMemberOnWaitingList(int memberId, int eventId, string comment)
|
||||
{
|
||||
if (!Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
RelationType rt = RelationType.GetByAlias(_waitinglist);
|
||||
Relation.MakeNew(eventId, memberId, rt, comment);
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetRelations(string alias, int parentId)
|
||||
{
|
||||
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
int result = sqlhelper.ExecuteScalar<int>(
|
||||
@"
|
||||
SELECT count(umbracoRelation.id)
|
||||
FROM umbracoRelation
|
||||
INNER JOIN umbracoRelationType ON umbracoRelationType.id = umbracoRelation.relType AND umbracoRelationType.alias = @alias
|
||||
where parentId = @parent
|
||||
"
|
||||
,
|
||||
sqlhelper.CreateParameter("@parent", parentId),
|
||||
sqlhelper.CreateParameter("@alias", alias)
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int GetSignedUp(int eventId)
|
||||
{
|
||||
return GetRelations(_event, eventId);
|
||||
}
|
||||
|
||||
public static int GetWaiting(int eventId)
|
||||
{
|
||||
return GetRelations(_waitinglist, eventId);
|
||||
}
|
||||
|
||||
private static List<Relation> GetRelations(string alias, string sort, int parentId, int number)
|
||||
{
|
||||
List<Relation> retval = new List<Relation>();
|
||||
ISqlHelper sqlhelper = umbraco.BusinessLogic.Application.SqlHelper;
|
||||
|
||||
IRecordsReader rr = sqlhelper.ExecuteReader(
|
||||
|
||||
string.Format(@"
|
||||
SELECT TOP {0} umbracoRelation.id
|
||||
FROM umbracoRelation
|
||||
INNER JOIN umbracoRelationType ON umbracoRelationType.id = umbracoRelation.relType AND umbracoRelationType.alias = @alias
|
||||
where parentId = @parent
|
||||
ORDER BY datetime {1}
|
||||
", number, sort)
|
||||
|
||||
,
|
||||
sqlhelper.CreateParameter("@parent", parentId),
|
||||
sqlhelper.CreateParameter("@alias", alias)
|
||||
);
|
||||
|
||||
while (rr.Read())
|
||||
{
|
||||
retval.Add( new Relation( rr.GetInt("id") ) );
|
||||
}
|
||||
rr.Close();
|
||||
rr.Dispose();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static List<Relation> GetPeopleWaiting(int eventId, int number)
|
||||
{
|
||||
return GetRelations(_waitinglist, "ASC", eventId, number);
|
||||
}
|
||||
|
||||
public static List<Relation> GetPeopleSignedUpLast(int eventId, int number)
|
||||
{
|
||||
return GetRelations(_event, "DESC", eventId, number);
|
||||
}
|
||||
|
||||
|
||||
public static void ClearRelations(int memberId, int eventId)
|
||||
{
|
||||
if (Relation.IsRelated(eventId, memberId))
|
||||
{
|
||||
foreach (Relation r in Relation.GetRelations(eventId))
|
||||
{
|
||||
if (r.Child.Id == memberId)
|
||||
{
|
||||
r.Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+119
-119
@@ -1,119 +1,119 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using AjaxControlToolkit;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace uEvents.controls
|
||||
{
|
||||
[ValidationProperty("SelectedDate")]
|
||||
public class DatePicker : System.Web.UI.WebControls.WebControl, System.Web.UI.INamingContainer
|
||||
{
|
||||
private System.Web.UI.WebControls.TextBox tb;
|
||||
private CalendarExtender ca;
|
||||
|
||||
private System.Web.UI.WebControls.TextBox hour;
|
||||
private System.Web.UI.WebControls.TextBox minute;
|
||||
private System.Web.UI.WebControls.Literal colon;
|
||||
private System.Web.UI.WebControls.Literal at;
|
||||
public DatePicker()
|
||||
{
|
||||
EnsureChildControls();
|
||||
}
|
||||
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
colon = new Literal();
|
||||
colon.ID = "lt_" + this.ID;
|
||||
colon.Text = ":";
|
||||
|
||||
at = new Literal();
|
||||
at.ID = "lt_at_" + this.ID;
|
||||
at.Text = "@";
|
||||
|
||||
minute = new System.Web.UI.WebControls.TextBox();
|
||||
minute.ID = "tb_minute" + this.ID;
|
||||
minute.CssClass = "minute";
|
||||
|
||||
hour = new System.Web.UI.WebControls.TextBox();
|
||||
hour.ID = "tb_hour" + this.ID;
|
||||
hour.CssClass = "hour";
|
||||
|
||||
tb = new System.Web.UI.WebControls.TextBox();
|
||||
tb.ID = "tb" + this.ID;
|
||||
tb.CssClass = "calendar";
|
||||
//this.Controls.Add(tb);
|
||||
|
||||
ca = new CalendarExtender();
|
||||
DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
|
||||
ca.Format = di.ShortDatePattern;
|
||||
ca.TargetControlID = tb.ID;
|
||||
ca.ID = "ce" + this.ID;
|
||||
//this.Controls.Add(ca);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
this.Controls.Add(tb);
|
||||
this.Controls.Add(hour);
|
||||
this.Controls.Add(colon);
|
||||
this.Controls.Add(minute);
|
||||
|
||||
this.Controls.Add(ca);
|
||||
}
|
||||
|
||||
|
||||
public DateTime? SelectedDate
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureChildControls();
|
||||
DateTime selected;
|
||||
|
||||
if (DateTime.TryParse(tb.Text, out selected))
|
||||
{
|
||||
selected = selected.Subtract(new TimeSpan(int.Parse(hour.Text), int.Parse(minute.Text), 0));
|
||||
|
||||
// then add back your assigned hours and minutes
|
||||
selected = selected.AddHours(int.Parse(hour.Text)).AddMinutes(int.Parse(minute.Text));
|
||||
|
||||
return selected;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
EnsureChildControls();
|
||||
if (value != null)
|
||||
{
|
||||
|
||||
DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
|
||||
tb.Text = ((DateTime)value).ToString(di.ShortDatePattern);
|
||||
hour.Text = ((DateTime)value).Hour.ToString();
|
||||
minute.Text = ((DateTime)value).Minute.ToString();
|
||||
|
||||
ca.SelectedDate = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
hour.Text = "12";
|
||||
minute.Text = "00";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using AjaxControlToolkit;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace uEvents.controls
|
||||
{
|
||||
[ValidationProperty("SelectedDate")]
|
||||
public class DatePicker : System.Web.UI.WebControls.WebControl, System.Web.UI.INamingContainer
|
||||
{
|
||||
private System.Web.UI.WebControls.TextBox tb;
|
||||
private CalendarExtender ca;
|
||||
|
||||
private System.Web.UI.WebControls.TextBox hour;
|
||||
private System.Web.UI.WebControls.TextBox minute;
|
||||
private System.Web.UI.WebControls.Literal colon;
|
||||
private System.Web.UI.WebControls.Literal at;
|
||||
public DatePicker()
|
||||
{
|
||||
EnsureChildControls();
|
||||
}
|
||||
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
colon = new Literal();
|
||||
colon.ID = "lt_" + this.ID;
|
||||
colon.Text = ":";
|
||||
|
||||
at = new Literal();
|
||||
at.ID = "lt_at_" + this.ID;
|
||||
at.Text = "@";
|
||||
|
||||
minute = new System.Web.UI.WebControls.TextBox();
|
||||
minute.ID = "tb_minute" + this.ID;
|
||||
minute.CssClass = "minute";
|
||||
|
||||
hour = new System.Web.UI.WebControls.TextBox();
|
||||
hour.ID = "tb_hour" + this.ID;
|
||||
hour.CssClass = "hour";
|
||||
|
||||
tb = new System.Web.UI.WebControls.TextBox();
|
||||
tb.ID = "tb" + this.ID;
|
||||
tb.CssClass = "calendar";
|
||||
//this.Controls.Add(tb);
|
||||
|
||||
ca = new CalendarExtender();
|
||||
DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
|
||||
ca.Format = di.ShortDatePattern;
|
||||
ca.TargetControlID = tb.ID;
|
||||
ca.ID = "ce" + this.ID;
|
||||
//this.Controls.Add(ca);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
this.Controls.Add(tb);
|
||||
this.Controls.Add(hour);
|
||||
this.Controls.Add(colon);
|
||||
this.Controls.Add(minute);
|
||||
|
||||
this.Controls.Add(ca);
|
||||
}
|
||||
|
||||
|
||||
public DateTime? SelectedDate
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureChildControls();
|
||||
DateTime selected;
|
||||
|
||||
if (DateTime.TryParse(tb.Text, out selected))
|
||||
{
|
||||
selected = selected.Subtract(new TimeSpan(int.Parse(hour.Text), int.Parse(minute.Text), 0));
|
||||
|
||||
// then add back your assigned hours and minutes
|
||||
selected = selected.AddHours(int.Parse(hour.Text)).AddMinutes(int.Parse(minute.Text));
|
||||
|
||||
return selected;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
EnsureChildControls();
|
||||
if (value != null)
|
||||
{
|
||||
|
||||
DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
|
||||
tb.Text = ((DateTime)value).ToString(di.ShortDatePattern);
|
||||
hour.Text = ((DateTime)value).Hour.ToString();
|
||||
minute.Text = ((DateTime)value).Minute.ToString();
|
||||
|
||||
ca.SelectedDate = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
hour.Text = "12";
|
||||
minute.Text = "00";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AjaxControlToolkit">
|
||||
<HintPath>..\dependencies\Our\AjaxControlToolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -122,6 +125,10 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=104.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SQLCE4Umbraco, Version=1.0.5683.14549, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\UmbracoCms.Core.7.2.8-build103\lib\SQLCE4Umbraco.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -144,6 +151,7 @@
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -231,6 +239,16 @@
|
||||
<Compile Include="Documentation\Busineslogic\GithubSourcePull\ZipDownloader.cs" />
|
||||
<Compile Include="Documentation\Busineslogic\MarkdownLogic.cs" />
|
||||
<Compile Include="Documentation\DocumentationContentFinder.cs" />
|
||||
<Compile Include="Events\Api\EventsController.cs" />
|
||||
<Compile Include="Events\App_Startup\ControllerRouting.cs" />
|
||||
<Compile Include="Events\controls\DateTimePicker.cs" />
|
||||
<Compile Include="Events\Library\Xslt.cs" />
|
||||
<Compile Include="Events\Meetup\DateTimeExtensions.cs" />
|
||||
<Compile Include="Events\Meetup\MeetupController.cs" />
|
||||
<Compile Include="Events\Meetup\UnixDateTimeConverter.cs" />
|
||||
<Compile Include="Events\Models\Event.cs" />
|
||||
<Compile Include="Events\Relations\Event.cs" />
|
||||
<Compile Include="Events\Relations\EventRelation.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repository\Project.cs" />
|
||||
<Compile Include="Repository\Projects.cs" />
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<package id="MiniProfiler" version="2.1.0" targetFramework="net451" />
|
||||
<package id="MySql.Data" version="6.9.7" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net451" />
|
||||
<package id="RestSharp" version="104.1" targetFramework="net451" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net451" />
|
||||
<package id="UmbracoCms.Core" version="7.2.8-build103" targetFramework="net451" />
|
||||
<package id="xmlrpcnet" version="2.5.0" targetFramework="net451" />
|
||||
|
||||
@@ -17,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uPowers", "uPowers\uPowers.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "our.umbraco.org", "our.umbraco.org\our.umbraco.org.csproj", "{A625544F-660A-4C01-BA49-1B467D0322D9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uEvents", "uEvents\uEvents.csproj", "{F356B339-296A-4594-81B6-CF69A802483E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notification", "Notification\Notification.csproj", "{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationsWeb", "NotificationsWeb\NotificationsWeb.csproj", "{6CF53D68-BD81-47BB-8F56-350A1B04F114}"
|
||||
@@ -86,16 +84,6 @@ Global
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
|
||||
@@ -422,10 +422,6 @@
|
||||
<Project>{a8e5c936-ecab-45b3-bfda-d12f680eb2a6}</Project>
|
||||
<Name>OurUmbraco</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uEvents\uEvents.csproj">
|
||||
<Project>{F356B339-296A-4594-81B6-CF69A802483E}</Project>
|
||||
<Name>uEvents</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uForum\uForum.csproj">
|
||||
<Project>{547C2D0D-1B55-493B-AE0B-E031A5B8EE77}</Project>
|
||||
<Name>uForum</Name>
|
||||
|
||||
@@ -241,17 +241,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Api\EventsController.cs" />
|
||||
<Compile Include="App_Startup\ControllerRouting.cs" />
|
||||
<Compile Include="controls\DateTimePicker.cs" />
|
||||
<Compile Include="Library\Xslt.cs" />
|
||||
<Compile Include="Meetup\DateTimeExtensions.cs" />
|
||||
<Compile Include="Meetup\MeetupController.cs" />
|
||||
<Compile Include="Meetup\UnixDateTimeConverter.cs" />
|
||||
<Compile Include="Models\Event.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Relations\Event.cs" />
|
||||
<Compile Include="Relations\EventRelation.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
|
||||
Reference in New Issue
Block a user