Created
March 13, 2018 13:59
-
-
Save hishaamn/e8628d933a7de0deb3a17e03e976b57c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Sitecore.Data; | |
| using Sitecore.Data.Items; | |
| using Sitecore.Data.Managers; | |
| using Sitecore.Diagnostics; | |
| public class OffersImportCommandItem : CustomItem | |
| { | |
| public static readonly ID TemplateID = ID.Parse("{CC29CCE7-D1CC-4EA2-90CF-573CBA493616}"); | |
| public static readonly ID SiteNameFieldId = ID.Parse("{D7D0D0EA-1904-473B-B003-3B4E88F9740C}"); | |
| public static readonly ID DatabaseFieldId = ID.Parse("{E6CC55CD-F215-438B-91E3-02C145FC996F}"); | |
| public static readonly ID CouponPathFieldId = ID.Parse("{41950956-4EB8-4459-9B79-9C9582A711D7}"); | |
| public OffersImportCommandItem(Item innerItem) : base(innerItem) | |
| { | |
| Assert.ArgumentNotNull(innerItem, nameof(innerItem)); | |
| } | |
| public string Sitename | |
| { | |
| get | |
| { | |
| return this.InnerItem[SiteNameFieldId]; | |
| } | |
| set | |
| { | |
| Assert.ArgumentNotNull(value, nameof(value)); | |
| this.InnerItem[SiteNameFieldId] = value; | |
| } | |
| } | |
| public new string Database | |
| { | |
| get | |
| { | |
| return this.InnerItem[DatabaseFieldId]; | |
| } | |
| set | |
| { | |
| Assert.ArgumentNotNull(value, nameof(value)); | |
| this.InnerItem[DatabaseFieldId] = value; | |
| } | |
| } | |
| public string CouponPath | |
| { | |
| get | |
| { | |
| return this.InnerItem[CouponPathFieldId]; | |
| } | |
| set | |
| { | |
| Assert.ArgumentNotNull(value, nameof(value)); | |
| this.InnerItem[CouponPathFieldId] = value; | |
| } | |
| } | |
| public static explicit operator OffersImportCommandItem(Item item) | |
| { | |
| if (item == null) | |
| { | |
| return null; | |
| } | |
| var template = TemplateManager.GetTemplate(item); | |
| if (template == null || !template.InheritsFrom(TemplateID)) | |
| { | |
| return null; | |
| } | |
| return Create(item); | |
| } | |
| public static OffersImportCommandItem Create(Item item) | |
| { | |
| Assert.ArgumentNotNull(item, nameof(item)); | |
| return new OffersImportCommandItem(item); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment