Skip to content

Instantly share code, notes, and snippets.

View JRondeau16's full-sized avatar

Jeffrey Rondeau JRondeau16

View GitHub Profile
namespace MyProjectNamespace
{
public interface IInjectedClass
{
int TestMethod();
}
public class InjectedClass : IInjectedClass
{
private readonly IInjectedClassDependency _classDependency;
namespace MyProjectNamespace
{
public interface IInjectedClassDependency
{
}
public class InjectedClassDependency : IInjectedClassDependency
{
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<guide>
<InjectedClass type="MyProjectNamespace.InjectedClass, MyAssembly" />
<InjectedClassDependency type="MyProjectNamespace.InjectedClassDependency, MyAssembly" />
</guide>
</sitecore>
</configuration>
using Sitecore.Data.Items;
using Sitecore.Forms.Mvc.Attributes;
using Sitecore.Forms.Mvc.Controllers.ModelBinders.FieldBinders;
using Sitecore.Forms.Mvc.Models.Fields;
using Sitecore.Forms.Mvc.Validators;
namespace MyProject.Integration.Wfm
{
public class TermsAgreementField : CheckBoxField
{
@using System.Web.Mvc.Html
@model MyProject.Integration.Wfm.TermsAgreementField
@if (!Model.Visible)
{
return;
}
<div class="@Model.CssClass checkbox-border">
<div class="@Model.CssClass field-panel">
using Sitecore.Form.Core.Attributes;
using Sitecore.Form.Core.Visual;
using Sitecore.Form.Web.UI.Controls;
namespace MyProject.Integration.Wfm
{
public class TermsAgreement : Checkbox
{
[VisualProperty("Agreement Text:", 200)]
[VisualFieldType(typeof(TextAreaField))]
@JRondeau16
JRondeau16 / HoursOfOperation24HourRaw.xml
Created August 20, 2015 17:19
Hours of Operation Raw Value - Open 24 Hours
<?xml version="1.0" encoding="utf-16"?>
<hoursofoperationmodel xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<days>
<day>
<isclosed>false</isclosed>
<openingtime></openingtime>
<closingtime></closingtime>
<dayofweek>Monday</dayofweek>
</day>
<day>
@JRondeau16
JRondeau16 / HoursOfOperationOpenWeekdaysRaw.xml
Created August 20, 2015 17:23
Hours of Operation Raw Value - Open Monday-Friday 8-5 and closed weekends
<?xml version="1.0" encoding="utf-16"?>
<hoursofoperationmodel xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<days>
<day>
<isclosed>false</isclosed>
<openingtime>8:00 AM</openingtime>
<closingtime>5:00 PM</closingtime>
<dayofweek>Monday</dayofweek>
</day>
<day>
@JRondeau16
JRondeau16 / InstantiateHoursOfOperationModel.cs
Created August 20, 2015 17:28
Instantiate New HoursOfOperationModel
var model = new HoursOfOperationModel(rawXmlValue);
@JRondeau16
JRondeau16 / SerializeHoursOfOperationModel.cs
Created August 20, 2015 17:57
Serialize HoursOfOperationModel
private string SerializeModelToRawValue(HoursOfOperationModel model)
{
var serializer = new XmlSerializer(typeof(HoursOfOperationModel));
var stringwriter = new StringWriter();
serializer.Serialize(stringwriter, model);
return stringwriter.ToString();
}