private static List <TemplateBlock> ToSmsTemplatesBlockModel(TableBody table) { return(table.Rows.Select(x => { var p = x.Elements[5].SafeTrim(); var res = new TemplateBlock { TriggerName = x.Elements[x.Elements.Count - 2], //Название триггера всегда предпоследнее TriggerGroupName = x.Elements.Last(), //Название группы триггеров всегда последнее TemplateBody = x.Elements[3], TemplateBodyTranslation = x.Elements[4], TriggerDescription = x.Elements[1], Type = InteractionType.Sms, MessageType = MessageType.Service }; if (p == "любое") { res.AnyTimeAllowed = true; } else { res.AnyTimeAllowed = false; res.AllowedFromHour = 6; res.AllowedToHour = 23; } return res; }).Select(x => TemplateBlock.Process(x)).ToList()); }
private static List <TemplateBlock> ToEmailTemplatesBlockModel(TableBody table) { return(table.Rows.Select(x => new TemplateBlock { TriggerName = x.Elements[x.Elements.Count - 2], //Название триггера всегда предпоследнее TriggerGroupName = x.Elements.Last(), //Название группы триггеров всегда последнее Header = x.Elements[3], HeaderTranslation = x.Elements[4], TemplateBody = x.Elements[5], TemplateBodyTranslation = x.Elements[6], TriggerDescription = x.Elements[1], Type = InteractionType.Email, AnyTimeAllowed = true, //Все Email можно отправлять когда захочется AllowedFromHour = null, AllowedToHour = null, }).Select(x => TemplateBlock.Process(x)).ToList()); }