コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ActionType != null)
         {
             hashCode = hashCode * 59 + ActionType.GetHashCode();
         }
         if (FormFields != null)
         {
             hashCode = hashCode * 59 + FormFields.GetHashCode();
         }
         if (RedirectData != null)
         {
             hashCode = hashCode * 59 + RedirectData.GetHashCode();
         }
         if (RenderingData != null)
         {
             hashCode = hashCode * 59 + RenderingData.GetHashCode();
         }
         if (ShowData != null)
         {
             hashCode = hashCode * 59 + ShowData.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        public async Task <ActionResult <FormFields> > AddFormField(FormFields item)
        {
            _context.FormFields.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(AddFormField), new { id = item.Id }, item));
        }
コード例 #3
0
ファイル: FormFieldModel.cs プロジェクト: Tyre88/Gradera
        internal static FormFields MapFormFieldDbModel(FormFieldModel model)
        {
            FormFields formField = new FormFields()
            {
                ClassName = model.ClassName,
                FormId = model.FormId,
                Id = model.Id,
                IsRequired = model.IsRequired,
                Label = model.Label,
                Type = model.Type,
                CanMultiply = model.CanMultiply
            };

            if(model.Options.Count > 0)
            {
                formField.FormFieldsOptions = new List<FormFieldsOptions>();

                foreach (var option in model.Options)
                {
                    formField.FormFieldsOptions.Add(MapFormFieldOption(option));
                }
            }

            return formField;
        }
コード例 #4
0
ファイル: LogController.cs プロジェクト: eboxmaker/X
 static LogController()
 {
     // 日志列表需要显示详细信息,不需要显示用户编号
     ListFields.AddField("Action", "Remark");
     ListFields.RemoveField("CreateUserID");
     FormFields.RemoveField("Remark");
 }
コード例 #5
0
        internal static FormFields MapFormFieldDbModel(FormFieldModel model)
        {
            FormFields formField = new FormFields()
            {
                ClassName   = model.ClassName,
                FormId      = model.FormId,
                Id          = model.Id,
                IsRequired  = model.IsRequired,
                Label       = model.Label,
                Type        = model.Type,
                CanMultiply = model.CanMultiply
            };

            if (model.Options.Count > 0)
            {
                formField.FormFieldsOptions = new List <FormFieldsOptions>();

                foreach (var option in model.Options)
                {
                    formField.FormFieldsOptions.Add(MapFormFieldOption(option));
                }
            }

            return(formField);
        }
コード例 #6
0
 /// <summary>
 /// Gets a fields value as a string suitable for things like, oh, a velocity template
 /// </summary>
 /// <param name="field">A FormFields enum value</param>
 /// <returns>The value of the field, OR, and error message</returns>
 public override string GetFieldAsString(FormFields field)
 {
     switch (field)
     {
     default: return("Error Retrieving Field");
     }
 }
コード例 #7
0
        private void PopulateForm(List <BaseControl> savedForm)
        {
            for (int i = 0; i < _form.Fields.Count; i++)
            {
                var field = _form.Fields[i];

                if (field.Type == "text" ||
                    field.Type == "numeric" ||
                    field.Type == "decimal" ||
                    field.Type == "document" ||
                    field.Type == "comment")
                {
                    FormFields.Add(new TextControl(field)
                    {
                        Value = (savedForm[i] as TextControl)?.Value
                    });
                }
                else if (field.Type == "date")
                {
                    FormFields.Add(new DateTimeControl(field)
                    {
                        Value = (savedForm[i] as DateTimeControl).Value
                    });
                }
                else if (field.Type == "radio" || field.Type == "dropdown")
                {
                    FormFields.Add(new RadioControl(field)
                    {
                        SelectedIndex = (savedForm[i] as RadioControl).SelectedIndex
                    });
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Logs an error in the ParseErrors array on the Search Params
        /// </summary>
        private void LogParseError(FormFields field, string errorMessage, CTSSearchParams searchParams)
        {
            CTSSearchFieldParamError error = new CTSSearchFieldParamError();

            error.Field        = field;
            error.ErrorMessage = errorMessage;
            searchParams.ParseErrors.Add(error);
        }
コード例 #9
0
ファイル: MenuController.cs プロジェクト: LX0/X_NET40
        static MenuController()
        {
            MenuOrder = 80;

            // 过滤要显示的字段
            ListFields.RemoveField("Remark");
            FormFields.RemoveField("Remark");
        }
コード例 #10
0
        static CategoryController()
        {
            // 过滤掉一些字段
            var list = ListFields;

            list.RemoveAll(e => e.Name.EqualIgnoreCase("ModelID", "ModelName"));

            FormFields.RemoveField("Remark");
        }
コード例 #11
0
        /// <summary>
        /// Gets a fields value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        public override string GetFieldAsString(FormFields field)
        {
            switch (field)
            {
            case FormFields.Hospital: return(Hospital);

            default: return("Error Retrieving Field");
            }
        }
コード例 #12
0
        /// <summary>
        /// Gets a location field value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        private string GetLocFieldAsString(FormFields field)
        {
            CountryCityStateLocationSearchParams cLoc = LocationParams as CountryCityStateLocationSearchParams;
            HospitalLocationSearchParams         hLoc = LocationParams as HospitalLocationSearchParams;
            ZipCodeLocationSearchParams          zLoc = LocationParams as ZipCodeLocationSearchParams;

            switch (field)
            {
            case FormFields.AtNIH:
            {
                if (Location == LocationType.AtNIH)
                {
                    return("Yes");
                }
                else
                {
                    throw new Exception();
                }
            }

            case FormFields.City:
            {
                return(cLoc.City);
            }

            case FormFields.Country:
            {
                return(cLoc.Country);
            }

            case FormFields.State:
            {
                return(String.Join(", ", cLoc.State.Select(st => st.Label)));
            }

            case FormFields.Hospital:
            {
                return(hLoc.Hospital);
            }

            case FormFields.ZipCode:
            {
                return(zLoc.ZipCode);
            }

            case FormFields.ZipRadius:
            {
                return(zLoc.ZipRadius.ToString());
            }

            default:
            {
                throw new Exception();
            }
            }
        }
コード例 #13
0
 static EntityControllerBase()
 {
     // 过滤掉一些字段
     ListFields.Replace("CreateUserID", "CreateUserName")
     .Replace("UpdateUserID", "UpdateUserName");
     FormFields.Replace("CreateUserID", "CreateUserName")
     .Replace("UpdateUserID", "UpdateUserName")
     .RemoveField("CreateTime")
     .RemoveField("UpdateTime");
 }
コード例 #14
0
        /// <summary>
        /// Gets a fields value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        public override string GetFieldAsString(FormFields field)
        {
            switch (field)
            {
            case FormFields.ZipRadius: return(ZipRadius.ToString());

            case FormFields.ZipCode: return(ZipCode);

            default: return("Error Retrieving Field");
            }
        }
コード例 #15
0
        private void addStringToDocument(DocumentPart part)
        {
            FormFields fields = this.document.FormFields;

            foreach (FormField field in fields)
            {
                if (field.Name == part.PartName)
                {
                    field.Range.Text += "\n" + part.PartValue;
                }
            }
        }
コード例 #16
0
 /// <summary>
 /// Gets a fields value as a string suitable for things like, oh, a velocity template
 /// </summary>
 /// <param name="fieldName">The string representation of a FormFields enum value</param>
 /// <returns>The value of the field, OR, and error message</returns>
 public string GetFieldAsString(string fieldName)
 {
     try
     {
         FormFields field = (FormFields)Enum.Parse(typeof(FormFields), fieldName, true);
         return(GetFieldAsString(field));
     }
     catch (Exception)
     {
         return("Error Retrieving Field");
     }
 }
コード例 #17
0
        public async Task <IActionResult> UpdateFormField(long id, FormFields formFields)
        {
            if (id != formFields.Id)
            {
                return(BadRequest());
            }

            _context.Entry(formFields).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
コード例 #18
0
        static MenuController()
        {
            //// 过滤要显示的字段
            //var names = "ID,TreeNodeName,DisplayName,Url,Sort,Visible,Necessary".Split(",");
            //var fs = Menu.Meta.AllFields;
            //var list = names.Select(e => fs.FirstOrDefault(f => f.Name.EqualIgnoreCase(e))).Where(e => e != null);
            ////list.RemoveAll(e => !names.Contains(e.Name));
            //ListFields.Clear();
            //ListFields.AddRange(list);

            ListFields.RemoveField("Remark");
            FormFields.RemoveField("Remark");
        }
コード例 #19
0
        /// <summary>
        /// Gets a fields value as a string suitable for things like, oh, a velocity template
        /// </summary>
        /// <param name="field">A FormFields enum value</param>
        /// <returns>The value of the field, OR, and error message</returns>
        public override string GetFieldAsString(FormFields field)
        {
            switch (field)
            {
            case FormFields.Country: return(Country);

            case FormFields.City: return(City);

            case FormFields.State: return(string.Join(", ", State.Select(s => s.Label).OrderBy(s => s)));

            default: return("Error Retrieving Field");
            }
        }
コード例 #20
0
        /// <summary>
        /// Executes the action with the specified <paramref name="data" />.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="formSubmitContext">The form submit context.</param>
        /// <returns>
        ///   <c>true</c> if the action is executed correctly; otherwise <c>false</c>
        /// </returns>
        protected override bool Execute(string data, FormSubmitContext formSubmitContext)
        {
            Assert.ArgumentNotNull(formSubmitContext, nameof(formSubmitContext));
            Assert.ArgumentNotNullOrEmpty(_connectionstring, nameof(_connectionstring));

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_connectionstring);
            CloudQueueClient    queueClient    = storageAccount.CreateCloudQueueClient();

            // Retrieve a reference to a container. use only lowercase!!
            CloudQueue queue = queueClient.GetQueueReference("stockpickformsqueue");

            // Create the queue if it doesn't already exist
            queue.CreateIfNotExists();

            // Create a message
            var message = new FormFields
            {
                FormId = formSubmitContext.FormId.ToString(),
                Fields = new List <FormFieldSmall>()
            };

            foreach (var viewModel in formSubmitContext.Fields)
            {
                var          postedField = (IValueField)viewModel;
                IValueField  valueField  = postedField as IValueField;
                PropertyInfo property    = postedField.GetType().GetProperty("Value");
                object       postedValue =
                    (object)property != null?property.GetValue((object)postedField) : (object)null;

                property = postedField.GetType().GetProperty("Title");
                object postedTitle =
                    (object)property != null?property.GetValue((object)postedField) : (object)null;

                if (valueField.AllowSave && postedValue != null && postedTitle != null)
                {
                    message.Fields.Add(new FormFieldSmall()
                    {
                        Name   = viewModel.Name,
                        Title  = postedTitle.ToString(),
                        ItemId = viewModel.ItemId,
                        Value  = postedValue.ToString()
                    });
                }
            }

            // Create a queue message with JSON and add it to the queue.
            CloudQueueMessage queuemessage = new CloudQueueMessage(JsonConvert.SerializeObject(message));

            queue.AddMessage(queuemessage);
            return(true);
        }
コード例 #21
0
        private void DoSaveFormCommand()
        {
            BaseControl failedField = ValidateForm();

            if (failedField != null)
            {
                _messageService.Send <string>("FailedFormValidation", failedField.ErrorMessage);
            }
            else
            {
                _filerReaderWriter.SaveForm(FormFields.ToList(), GenerateFilename());
                _messageService.Send <string>("SavedSuccessfull", this);
            }
        }
コード例 #22
0
        private void addPictureToDocument(DocumentPart part)
        {
            FormFields fields = this.document.FormFields;

            foreach (FormField field in fields)
            {
                if (field.Name == part.PartName)
                {
                    object msoTrue = Microsoft.Office.Core.MsoTriState.msoTrue;
                    object missing = Missing.Value;
                    field.Range.InlineShapes.AddPicture(part.PartValue, ref msoTrue, ref msoTrue, ref missing);
                    field.Range.InsertAfter("\n");
                }
            }
        }
コード例 #23
0
        private void Initialize()
        {
            var nodeParser = new AgilityNodeParser(html);

            ParseAction(nodeParser);
            ParseMethod(nodeParser);

            FormFields = ParseFormFields(nodeParser);

            if (!FormFields.Any() && html.ParentNode != null) //forms can have a with agility pack
            {
                nodeParser = new AgilityNodeParser(html.ParentNode);
                FormFields = ParseFormFields(nodeParser);
            }
        }
コード例 #24
0
        internal static FormFieldModel MapFormFieldModel(FormFields formField)
        {
            FormFieldModel model = new FormFieldModel()
            {
                ClassName   = formField.ClassName,
                FormId      = formField.FormId,
                Id          = formField.Id,
                IsRequired  = formField.IsRequired,
                Label       = formField.Label,
                Type        = formField.Type,
                CanMultiply = formField.CanMultiply
            };

            formField.FormFieldsOptions.ToList().ForEach(f => model.Options.Add(FormFieldOptionModel.MapFormFieldOptionModel(f)));

            return(model);
        }
コード例 #25
0
        /// <summary>
        /// Extract property values for 'Labelled' Field search params (e.g. state, phase, trial type)
        /// </summary>
        /// <param name="paramData"></param>
        /// <returns>Array of param objects</returns>
        private LabelledSearchParam[] GetLabelledFieldFromParam(string paramData, FormFields field, CTSSearchParams searchParams)
        {
            List <LabelledSearchParam> rtnParams = new List <LabelledSearchParam>();
            bool hasInvalidParam = false;

            //TODO: Update mapping to handle different cases (like state abbreviation vs primary purpose label)
            try
            {
                string[] items = paramData.Split(',');
                for (int i = 0; i < items.Length; i++)
                {
                    if (!string.IsNullOrWhiteSpace(items[i]))
                    {
                        bool contains = this._lookupSvc.MappingContainsKey(items[i], true);
                        if (this._lookupSvc.MappingContainsKey(items[i], true))
                        {
                            LabelledSearchParam type = new LabelledSearchParam();
                            type.Key   = items[i];
                            type.Label = this._lookupSvc.Get(type.Key);
                            rtnParams.Add(type);
                        }
                        else
                        {
                            hasInvalidParam = true;
                            LogParseError(field, "Invalid param(s) for lookup: " + items[i], searchParams);
                        }
                    }
                }
            }
            catch
            {
                LogParseError(field, "Please enter a valid parameter.", searchParams);
            }

            if (hasInvalidParam == false)
            {
                return(rtnParams.ToArray());
            }
            else
            {
                return(new LabelledSearchParam[] {});
            }
        }
コード例 #26
0
        private async void btnSave_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (Validations())
                {
                    FormFields objFormFields = new FormFields();
                    objFormFields.name              = txtName.Text.Trim();
                    objFormFields.age               = txtAge.Text.Trim();
                    objFormFields.phone             = txtPhone.Text.Trim();
                    objFormFields.medical_condition = txtMedicalCondition.Text.Trim();
                    objFormFields.location          = txtLocation.Text.Trim();
                    CommonDropDowns objobjFormFields = pkrGender.SelectedItem as CommonDropDowns;
                    objFormFields.gender     = objobjFormFields.Name;
                    objFormFields.service_id = objHCAH.id;
                    var answer = await DisplayAlert("Confirm Submission", "Are You Sure? Clicking on continue will take you to the payment gateway", "CONTINUE", "CANCEL");

                    if (answer)
                    {
                        overlay.IsVisible = true;
                        HCAHFormResponse objHCAHFormResponse = await App.TodoManager.PostHCAHFormData(objFormFields);

                        if (objHCAHFormResponse.status.ToLower() == "success")
                        {
                            ClearControls();
                            await DisplayAlert("Success", "Success Added", "OK");
                        }
                        else
                        {
                            await DisplayAlert(" ", "The given data failed to pass validations.", "OK");
                        }
                        overlay.IsVisible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                overlay.IsVisible = false;
                DependencyService.Get <IMessage>().LongAlert();
            }
        }
コード例 #27
0
 private void CreateEmptyForm()
 {
     foreach (var field in _form.Fields)
     {
         if (field.Type == "text" ||
             field.Type == "numeric" ||
             field.Type == "decimal" ||
             field.Type == "document" ||
             field.Type == "comment")
         {
             FormFields.Add(new TextControl(field));
         }
         else if (field.Type == "date")
         {
             FormFields.Add(new DateTimeControl(field));
         }
         else if (field.Type == "radio" || field.Type == "dropdown")
         {
             FormFields.Add((new RadioControl(field)));
         }
     }
 }
コード例 #28
0
        /// <summary>
        /// Returns true if MerchantAction instances are equal
        /// </summary>
        /// <param name="other">Instance of MerchantAction to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MerchantAction other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ActionType == other.ActionType ||
                     ActionType != null &&
                     ActionType.Equals(other.ActionType)
                     ) &&
                 (
                     FormFields == other.FormFields ||
                     FormFields != null &&
                     FormFields.SequenceEqual(other.FormFields)
                 ) &&
                 (
                     RedirectData == other.RedirectData ||
                     RedirectData != null &&
                     RedirectData.Equals(other.RedirectData)
                 ) &&
                 (
                     RenderingData == other.RenderingData ||
                     RenderingData != null &&
                     RenderingData.Equals(other.RenderingData)
                 ) &&
                 (
                     ShowData == other.ShowData ||
                     ShowData != null &&
                     ShowData.SequenceEqual(other.ShowData)
                 ));
        }
コード例 #29
0
        /// <summary>
        /// Executes the action with the specified <paramref name="data" />.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="formSubmitContext">The form submit context.</param>
        /// <returns>
        ///   <c>true</c> if the action is executed correctly; otherwise <c>false</c>
        /// </returns>
        protected override bool Execute(string data, FormSubmitContext formSubmitContext)
        {
            Assert.ArgumentNotNull(formSubmitContext, nameof(formSubmitContext));
            Assert.ArgumentNotNullOrEmpty(_connectionstring, nameof(_connectionstring));

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_connectionstring);
            CloudQueueClient    queueClient    = storageAccount.CreateCloudQueueClient();

            // Retrieve a reference to a container. use only lowercase!!
            CloudQueue queue = queueClient.GetQueueReference("stockpickformsqueue");

            // Create the queue if it doesn't already exist
            queue.CreateIfNotExists();

            // Create a message
            var message = new FormFields
            {
                FormId = formSubmitContext.FormId.ToString(),
                Fields = new List <FormFieldSmall>()
            };
            List <Guid> filesource = new List <Guid>();

            foreach (var viewModel in formSubmitContext.Fields)
            {
                AddFieldData(viewModel, message);
                filesource.AddRange((IEnumerable <Guid>)GetCommittedFileIds(viewModel));
            }

            if (filesource.Any <Guid>())
            {
                StoreFiles(storageAccount, formSubmitContext, (IEnumerable <Guid>)filesource);
            }
            // Create a queue message with JSON and add it to the queue.
            CloudQueueMessage queuemessage = new CloudQueueMessage(JsonConvert.SerializeObject(message));

            queue.AddMessage(queuemessage);
            return(true);
        }
コード例 #30
0
        private static void AddFieldData(IViewModel viewModel, FormFields message)
        {
            var          postedField = (IValueField)viewModel;
            IValueField  valueField  = postedField as IValueField;
            PropertyInfo property    = postedField.GetType().GetProperty("Value");
            object       postedValue =
                (object)property != null?property.GetValue((object)postedField) : (object)null;

            property = postedField.GetType().GetProperty("Title");
            object postedTitle =
                (object)property != null?property.GetValue((object)postedField) : (object)null;

            if (valueField.AllowSave && postedValue != null && postedTitle != null)
            {
                message.Fields.Add(new FormFieldSmall()
                {
                    Name   = viewModel.Name,
                    Title  = postedTitle.ToString(),
                    ItemId = viewModel.ItemId,
                    Value  = ParseFieldValue(postedValue)
                });
            }
        }
コード例 #31
0
        static RoleController()
        {
            MenuOrder = 90;

            FormFields.RemoveField("Remark");
        }
コード例 #32
0
ファイル: FormFieldModel.cs プロジェクト: Tyre88/Gradera
        internal static FormFieldModel MapFormFieldModel(FormFields formField)
        {
            FormFieldModel model = new FormFieldModel()
            {
                ClassName = formField.ClassName,
                FormId = formField.FormId,
                Id = formField.Id,
                IsRequired = formField.IsRequired,
                Label = formField.Label,
                Type = formField.Type,
                CanMultiply = formField.CanMultiply
            };

            formField.FormFieldsOptions.ToList().ForEach(f => model.Options.Add(FormFieldOptionModel.MapFormFieldOptionModel(f)));

            return model;
        }