Exemplo n.º 1
0
        public void UpdateFormMode(FormInfoBO formInfoBO, FormSettingBO formSettingBO = null)
        {
            var formId = formInfoBO.FormId;

            if (string.IsNullOrEmpty(formInfoBO.FormName))
            {
                formInfoBO.FormName = _metadataAccessor.GetFormDigest(formId).FormName;
            }
            var formSettings = formInfoBO.ToFormSettings();

            if (formSettingBO != null)
            {
                formSettings.ResponseDisplaySettings = formSettingBO.ResponseGridColumnNameList.OrderBy(k => k.Key)
                                                       .Select(kvp => new ResponseGridColumnSettings {
                    FormId = formId, ColumnName = kvp.Value, SortOrder = kvp.Key
                })
                                                       .ToList();
            }

            _formResponseCRUD.UpdateFormSettings(formSettings);

            // Temporarily update WebEnter tables too
            _formSettingDao_EF.UpdateFormMode(formInfoBO);

#if false
            try
            {
                Guid id = new Guid(formInfoBO.FormId);

                //Update Form Mode
                using (var context = DataObjectFactory.CreateContext())
                {
                    var query = from response in context.SurveyMetaDatas
                                where response.SurveyId == id
                                select response;

                    var dataRow = query.Single();
                    dataRow.IsDraftMode      = formInfoBO.IsDraftMode;
                    dataRow.IsShareable      = formInfoBO.IsShareable;
                    dataRow.DataAccessRuleId = formInfoBO.DataAccesRuleId;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
#endif
        }
Exemplo n.º 2
0
 public void UpdateFormSettings(Epi.Common.Core.DataStructures.FormSettings formSettings)
 {
     _formResponseCRUD.UpdateFormSettings(formSettings);
 }