public static SurveyInfoDTO ToSurveyInfoDTO(this FormInfoDTO formInfoDTO, FormDigest formDigest) { return(new SurveyInfoDTO { DataAccessRuleId = formInfoDTO.DataAccessRuleId, HasDraftModeData = formInfoDTO.HasDraftModeData, IsDraftMode = formInfoDTO.IsDraftMode, IsShareable = formInfoDTO.IsShareable, IsShared = formInfoDTO.IsShared, OrganizationName = formInfoDTO.OrganizationName, OwnerId = formInfoDTO.OwnerId, SurveyId = formInfoDTO.FormId, SurveyName = formInfoDTO.FormName, SurveyNumber = formInfoDTO.FormName, ViewId = formDigest.ViewId, StartDate = DateTime.MinValue, ClosingDate = DateTime.MinValue, SurveyType = SurveyTypes.MultipleResponse, OrganizationKey = Guid.Empty, UserPublishKey = Guid.Empty, DepartmentName = string.Empty, IntroductionText = string.Empty, ExitText = string.Empty, IsSqlProject = formInfoDTO.IsSQLProject, DBConnectionString = null, ParentFormId = null }); }
public static FormsHierarchyDTO ToFormsHierarchyDTO(this FormDigest formDigest, SurveyInfoDTO surveyInfoDTO) { var formsHierarchyDTO = new FormsHierarchyDTO { SurveyInfo = surveyInfoDTO, IsSqlProject = true }; return(formDigest.MergeIntoFormsHierarchyDTO(formsHierarchyDTO)); }
public static FormsHierarchyBO MergeIntoFormsHierarchyBO(this FormDigest formDigest, FormsHierarchyBO formsHierarchyBO) { formsHierarchyBO.FormId = formDigest.FormId; formsHierarchyBO.ViewId = formDigest.ViewId; formsHierarchyBO.RootFormId = formDigest.RootFormId; formsHierarchyBO.IsRoot = formDigest.IsRootForm; return(formsHierarchyBO); }
public static FormsHierarchyDTO MergeIntoFormsHierarchyDTO(this FormDigest formDigest, FormsHierarchyDTO formsHierarchyDTO, SurveyInfoDTO surveyInfoDTO = null) { formsHierarchyDTO.FormId = formDigest.FormId; formsHierarchyDTO.ViewId = formDigest.ViewId; formsHierarchyDTO.RootFormId = formDigest.RootFormId; formsHierarchyDTO.IsRoot = formDigest.IsRootForm; if (surveyInfoDTO != null) { formsHierarchyDTO.SurveyInfo = surveyInfoDTO; } return(formsHierarchyDTO); }
public static SurveyInfoBO MergeIntoSurveyInfoBO(this FormDigest formDigest, SurveyInfoBO surveyInfoBO) { surveyInfoBO.SurveyId = formDigest.FormId; surveyInfoBO.SurveyName = formDigest.FormName; surveyInfoBO.OrganizationName = formDigest.OrganizationName; surveyInfoBO.OwnerId = formDigest.OwnerUserId; surveyInfoBO.ParentFormId = formDigest.ParentFormId; surveyInfoBO.ViewId = formDigest.ViewId; surveyInfoBO.IsShareable = formDigest.IsShareable; surveyInfoBO.DataAccessRuleId = formDigest.DataAccessRuleId; surveyInfoBO.IsDraftMode = formDigest.IsDraftMode; return(surveyInfoBO); }
public static FormDigest[] ToFormDigests(this Template projectTemplateMetadata) { var formDigests = new List <FormDigest>(); var rootFormId = projectTemplateMetadata.Project.Views.Where(v => v.ParentFormId == null).First().FormId; foreach (var view in projectTemplateMetadata.Project.Views) { var formDigest = new FormDigest { RootFormId = rootFormId, ViewId = view.ViewId, FormId = view.FormId, FormName = view.Name, ParentFormId = view.ParentFormId, OrganizationId = view.OrganizationId, OrganizationName = view.OrganizationName, OrganizationKey = view.OrganizationKey, OwnerUserId = view.OwnerUserId, NumberOfPages = view.Pages.Length, Orientation = view.Orientation, Height = view.Height.HasValue ? view.Height.Value : 0, Width = view.Width.HasValue ? view.Width.Value : 0, CheckCode = view.CheckCode, IsShareable = view.IsShareable, DataAccessRuleId = view.DataAccessRuleId, IsDraftMode = view.IsDraftMode }; formDigest.FieldNameToPageIdDirectory = new Dictionary <string, int>(); foreach (var page in view.Pages) { foreach (var field in page.Fields) { formDigest.FieldNameToPageIdDirectory.Add(field.Name.ToLower(), Convert.ToInt32(field.PageId)); } } formDigests.Add(formDigest); } return(formDigests.ToArray()); }
protected override void CreateChildControls() { if (SPContext.Current.Web.CurrentUser != null) { FormDigest child = new FormDigest(); child.ID = "myFormDigest"; this.Controls.Add(child); txtDocUrl = new TextBox(); txtDocUrl.ID = "txtDocUrl"; txtDocUrl.Text = SPContext.Current.Site.Url; this.Controls.Add(txtDocUrl); Button button = new Button(); button.Text = "分享"; button.Click += new EventHandler(this.btn_Click); this.Controls.Add(button); Button btn2 = new Button(); btn2.Text = "关注"; btn2.Click += btn2_Click; this.Controls.Add(btn2); } }
public virtual Form GetForm(SurveyInfoDTO surveyInfo, int pageNumber, SurveyAnswerDTO surveyAnswer, List <SurveyAnswerDTO> surveyAnswerList, List <SurveyInfoDTO> surveyInfoList, bool isAndroid) { // Save last values for subsequent calls from ValidateAll in SurveyController SurveyAnswerList = surveyAnswerList; SurveyInfoList = surveyInfoList; var surveyId = CurrentFormId = surveyInfo.SurveyId; FormDigest currentFormDigest = GetFormDigest(surveyId); PageDigest currentPageDigest = GetPageDigestByPageNumber(surveyId, pageNumber); var pageId = currentPageDigest.PageId; string formId = currentFormDigest.FormId; string formName = currentFormDigest.FormName; FormResponseDetail formResponseDetail = surveyAnswer.ResponseDetail != null ? surveyAnswer.ResponseDetail : new FormResponseDetail { FormId = formId, FormName = formName }; PageResponseDetail pageResponseDetail = formResponseDetail.GetPageResponseDetailByPageId(pageId); var form = new Form(); form.PageId = pageId.ToString(); form.IsAndroid = isAndroid; form.ResponseId = surveyAnswer.ResponseId; form.FormName = surveyAnswer.FormName; form.FormId = surveyAnswer.FormId; form.ParentResponseId = surveyAnswer.ParentResponseId; form.ParentFormName = surveyAnswer.ParentFormName; form.ParentFormId = surveyAnswer.ParentFormId; form.RootResponseId = surveyAnswer.RootResponseId; form.RootFormName = surveyAnswer.RootFormName; form.RootFormId = surveyAnswer.RootFormId; form.SurveyInfo = surveyInfo; //Watermark if (form.SurveyInfo.IsDraftMode) { form.IsDraftModeStyleClass = "draft"; } form.CurrentPage = pageNumber; form.NumberOfPages = currentFormDigest.NumberOfPages; double _Width, _Height; var orientationIsPortrait = currentFormDigest.Orientation == "Portrait"; _Height = orientationIsPortrait ? currentFormDigest.Height : currentFormDigest.Width; _Width = orientationIsPortrait ? currentFormDigest.Width : currentFormDigest.Height; //Add checkcode to Form string checkcode = currentFormDigest.CheckCode; StringBuilder javaScript = new StringBuilder(); StringBuilder VariableDefinitions = new StringBuilder(); string defineFormat = "cce_Context.define(\"{0}\", \"{1}\", \"{2}\", \"{3}\");"; string defineNumberFormat = "cce_Context.define(\"{0}\", \"{1}\", \"{2}\", new Number({3}));"; if (surveyAnswerList != null && surveyAnswerList.Count > 0) { form.FormCheckCodeObj = form.GetRelateCheckCodeObj(GetRelateFormObj(surveyAnswerList, surveyInfoList), checkcode); } else { form.FormCheckCodeObj = form.GetCheckCodeObj(surveyInfo.GetFieldDigests(surveyId), formResponseDetail, checkcode); } form.HiddenFieldsList = formResponseDetail.HiddenFieldsList; form.HighlightedFieldsList = formResponseDetail.HighlightedFieldsList; form.DisabledFieldsList = formResponseDetail.DisabledFieldsList; form.RequiredFieldsList = formResponseDetail.RequiredFieldsList; form.FormCheckCodeObj.GetVariableJavaScript(VariableDefinitions); form.FormCheckCodeObj.GetSubroutineJavaScript(VariableDefinitions); string pageName = currentPageDigest.PageName; //Generate page level Java script (Before) javaScript.Append(GetPageLevelJS(pageNumber, form, pageName, "Before")); //Generate page level Java script (After) javaScript.Append(GetPageLevelJS(pageNumber, form, pageName, "After")); SetProviderSpecificProperties(form, _Height, _Width); var responseQA = pageResponseDetail != null ? pageResponseDetail.ResponseQA : new Dictionary <string, string>(); //if (responseQA.Count == 0) //{ // var pageFieldAttributes = GetPageFieldAttributesByPageId(surveyId, pageId); // responseQA = new Dictionary<string, string>(); // foreach (var fieldAttributes in pageFieldAttributes.Values) // { // if (fieldAttributes.Value != null) // { // responseQA.Add(fieldAttributes.FieldName.ToLower(), fieldAttributes.Value); // } // } //} AddFormFields(surveyInfo, pageId, responseQA, form, _Width, _Height, checkcode, javaScript); form.FormJavaScript = VariableDefinitions.ToString() + "\n" + javaScript.ToString(); return(form); }
public static SurveyInfoBO ToSurveyInfoBO(this FormDigest formDigest) { var surveyInfoBO = new SurveyInfoBO(); return(formDigest.MergeIntoSurveyInfoBO(surveyInfoBO)); }