コード例 #1
0
ファイル: Program.cs プロジェクト: PradeepTM/TechTicketPOC
        private static void AddCheckBoxField(int emailTemplateId)
        {
            var checkBoxField = new EmailTemplateField
            {
                FieldName       = "IsClaimsApproved",
                DisplayName     = "Is claims approved",
                DataType        = "Bool",
                FieldOrder      = 1,
                FieldType       = "CheckBox",
                IsAllowBlank    = false,
                EmailTemplateId = emailTemplateId
            };

            using (var dbSession = DocumentStoreHolder.Store.OpenSession())
            {
                var emailTemplate = dbSession.Load <EmailTemplate>(emailTemplateId);
                dbSession.Store(checkBoxField);
                emailTemplate.TemplateFieldIds.Add(checkBoxField.Id);
                dbSession.SaveChanges();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: PradeepTM/TechTicketPOC
        private static List <EmailTemplateField> GetTemplateFields(out List <FieldOption> locationOptioins, out EmailTemplateField locationField)
        {
            locationField = new EmailTemplateField
            {
                FieldName    = "Location",
                DisplayName  = "Location",
                DataType     = "String",
                FieldOrder   = 4,
                FieldType    = "DropDown",
                IsAllowBlank = true,
            };

            locationOptioins = new List <FieldOption>
            {
                new FieldOption()
                {
                    DisplayName = "Richmond", Value = "Richmond", TemplateFieldId = locationField.Id
                },
                new FieldOption()
                {
                    DisplayName = "New York", Value = "New York", TemplateFieldId = locationField.Id
                }
            };

            var templateFields = new List <EmailTemplateField>()
            {
                new EmailTemplateField
                {
                    FieldName    = "ClaimNumber",
                    DisplayName  = "Claim Number",
                    DataType     = "Int",
                    FieldOrder   = 1,
                    FieldType    = "TextBox",
                    IsAllowBlank = false
                },
                //new EmailTemplateField
                //{
                //    FieldName = "Submission",
                //    DisplayName = "Submission Number",
                //    DataType = "Int",
                //    FieldOrder = 2,
                //    FieldType = "TextBox",
                //    FormatRegEx = "/[0-9]/",
                //    IsAllowBlank = false
                //},
                //new EmailTemplateField
                //{
                //    FieldName = "SubmissionVersion",
                //    DisplayName = "Submission Version",
                //    DataType = "Int",
                //    FieldOrder = 3,
                //    FieldType = "TextBox",
                //    IsAllowBlank = false
                //},
                locationField
                ,
                new EmailTemplateField
                {
                    FieldName    = "BrokerName",
                    DisplayName  = "Broker Name",
                    DataType     = "String",
                    FieldOrder   = 5,
                    FieldType    = "TextBox",
                    IsAllowBlank = true
                },
            };

            return(templateFields);
        }