public HtmlTemplate FindByStoreAndType(long storeId, HtmlTemplateType templateType)
        {
            int typeId = (int)templateType;

            IQueryable <Data.EF.bvc_HtmlTemplates> items = repository.Find().Where(y => y.StoreId == storeId)
                                                           .Where(y => y.TemplateType == typeId);

            return(SinglePoco(items));
        }
Beispiel #2
0
        public static string GetHtmlTemplate(HtmlTemplateType type)
        {
            switch (type)
            {
            case HtmlTemplateType.Receipt:
                return(HelloCashAPIWrapper.Properties.Resources.HelloCashReceiptTemplate);

            default:
                throw new NotImplementedException($"{type} of Type {typeof(HtmlTemplateType)} is not implemented in the GetHtmlTemplate Method");
            }
        }
Beispiel #3
0
 public HtmlTemplate()
 {
     this.Id = 0;
     this.StoreId = 0;
     this.LastUpdatedUtc = DateTime.UtcNow;
     this.From = string.Empty;
     this.DisplayName = string.Empty;
     this.Subject = string.Empty;
     this.Body = string.Empty;
     this.RepeatingSection = string.Empty;
     this.TemplateType = HtmlTemplateType.Custom;
 }
 public HtmlTemplate()
 {
     this.Id               = 0;
     this.StoreId          = 0;
     this.LastUpdatedUtc   = DateTime.UtcNow;
     this.From             = string.Empty;
     this.DisplayName      = string.Empty;
     this.Subject          = string.Empty;
     this.Body             = string.Empty;
     this.RepeatingSection = string.Empty;
     this.TemplateType     = HtmlTemplateType.Custom;
 }
 private void CheckForType(HtmlTemplateType checkType, List<HtmlTemplate> existing)
 {
     var existCount = existing.Where(y => y.TemplateType == checkType).Count();
     if (existCount < 1)
     {
         HtmlTemplate standard = GetDefaultTemplate(checkType);
         if (standard != null)
         {
             standard.Id = 0;
             standard.StoreId = context.CurrentStore.Id;
             HtmlTemplates.Create(standard);
             existing.Add(standard);
         }
     }
 }
Beispiel #6
0
        private void CheckForType(HtmlTemplateType checkType, List <HtmlTemplate> existing)
        {
            var existCount = existing.Where(y => y.TemplateType == checkType).Count();

            if (existCount < 1)
            {
                var standard = GetDefaultTemplate(checkType);
                if (standard != null)
                {
                    standard.Id      = 0;
                    standard.StoreId = Context.CurrentStore.Id;
                    HtmlTemplates.Create(standard, true);
                    existing.Add(standard);
                }
            }
        }
Beispiel #7
0
        public HtmlTemplate GetHtmlTemplateOrDefault(HtmlTemplateType templateType)
        {
            var existing = HtmlTemplates.FindByStoreAndType(Context.CurrentStore.Id, templateType);

            if (existing == null)
            {
                var standard = GetDefaultTemplate(templateType);

                if (standard != null)
                {
                    standard.Id      = 0;
                    standard.StoreId = Context.CurrentStore.Id;
                    HtmlTemplates.Create(standard, true);
                }

                return(standard);
            }

            return(existing);
        }
        public HtmlTemplate GetHtmlTemplateOrDefault(HtmlTemplateType templateType)
        {
            HtmlTemplate existing = HtmlTemplates.FindByStoreAndType(context.CurrentStore.Id, templateType);

            if (existing == null)
            {
                HtmlTemplate standard = GetDefaultTemplate(templateType);

                if (standard != null)
                {
                    standard.Id = 0;
                    standard.StoreId = context.CurrentStore.Id;
                    HtmlTemplates.Create(standard);
                }

                return standard;
            }
            
            return existing;
        }
Beispiel #9
0
 private HtmlTemplate GetDefaultTemplate(HtmlTemplateType templateType)
 {
     return(HtmlTemplates.FindByStoreAndType(0, templateType));
 }
        private void SetTemplate(HtmlTemplateType templType)
        {
            var templ = HccApp.ContentServices.GetHtmlTemplateOrDefault(templType);

            SetTemplate(templ.Id.ToString());
        }
 private HtmlTemplate GetDefaultTemplate(HtmlTemplateType templateType)
 {
     return HtmlTemplates.FindByStoreAndType(0, templateType);
 }
Beispiel #12
0
        public HtmlTemplate FindByStoreAndType(long storeId, HtmlTemplateType templateType)
        {
            var typeId = (int)templateType;

            return(FindFirstPoco(ht => ht.Item.StoreId == storeId && ht.Item.TemplateType == typeId));
        }