Esempio n. 1
0
        private void StartContainerClean()
        {
            const string    description = "Select containers to delete:";
            const string    listCommand = "docker ps -a --format \"{{.ID}}:{{.Names}}:{{.Status}}\"";
            ProcessRunner   runner      = new ProcessRunner();
            string          listOutput  = runner.RunWithDefault(listCommand);
            ContainerResult containers  = new ContainerResult(listOutput);

            if (containers.Ids.Length == 0)
            {
                Log.Info("No containers found. Quiting...");
                return;
            }

            var selectedForDelete = new MultiSelect(description, containers.MenuLines).Show();

            if (selectedForDelete.Count == 0)
            {
                Log.Info("Nothing is selected. Quiting...");
                return;
            }

            var deleteCommand = "docker rm -v ";

            foreach (int index in selectedForDelete)
            {
                Log.Green($"Removing container: {containers.Names[index]}");
                deleteCommand += $"{containers.Ids[index]} ";
            }

            runner.RunWithDefault(deleteCommand);
            Log.Green("Done.");
        }
Esempio n. 2
0
        protected string ConvertToSelectJson1 <T>(List <T> list, string labelField, string valueField)
        {
            List <MultiSelect> selectList = new List <MultiSelect>();

            foreach (T t in list)
            {
                PropertyInfo[] propertys = t.GetType().GetProperties();

                MultiSelect select = new MultiSelect();
                foreach (PropertyInfo pi in propertys)
                {
                    if (pi.Name == labelField)
                    {
                        select.label = pi.GetValue(t, null).ToString();
                    }
                    else if (pi.Name == valueField)
                    {
                        select.value = pi.GetValue(t, null).ToString();
                    }
                }
                selectList.Add(select);
            }

            return(JsonConvert.SerializeObject(selectList));;
        }
Esempio n. 3
0
        public void basic_select_renders_select_with_options_from_select_list()
        {
            var items = new List <FakeModel>
            {
                new FakeModel {
                    Id = 1, Title = "One"
                },
                new FakeModel {
                    Id = 2, Title = "Two"
                },
                new FakeModel {
                    Id = 3, Title = "Three"
                }
            };
            var selectedOptions = new List <int> {
                1, 3
            };

            var selectList = new MultiSelectList(items, "Id", "Title", selectedOptions);

            var html = new MultiSelect("foo.Bar").Options(selectList).ToString();

            var element = html.ShouldHaveHtmlNode("foo_Bar");

            var optionNodes = element.ShouldHaveChildNodesCount(3);

            optionNodes[0].ShouldBeSelectedOption(items[0].Id, items[0].Title);
            optionNodes[1].ShouldBeUnSelectedOption(items[1].Id, items[1].Title);
            optionNodes[2].ShouldBeSelectedOption(items[2].Id, items[2].Title);
        }
Esempio n. 4
0
        private void StartMultiSelectClean()
        {
            using Repository repo = new Repository(Environment.CurrentDirectory);
            var deletableBranches = GetDeletableBranches(repo);

            var          branchNames = deletableBranches.Select(b => b.FriendlyName).ToArray();
            const string description = "Select branches to delete:";

            var selectedForDelete = new MultiSelect(description, branchNames).Show();

            if (selectedForDelete.Count == 0)
            {
                Log.Info("Nothing is selected. Quiting...");
                return;
            }

            foreach (int index in selectedForDelete)
            {
                Branch branch = deletableBranches[index];
                repo.Branches.Remove(branch);
                Log.Green($"Deleted branch: {branch.FriendlyName}");
            }

            Log.Green("Done.");
        }
Esempio n. 5
0
        private void StartImageClean()
        {
            const string  description = "Select images to delete:";
            const string  listCommand = "docker images --format \"{{.ID}}:{{.Repository}} @{{.Tag}}:{{.Size}}\"";
            ProcessRunner runner      = new ProcessRunner();
            string        listOutput  = runner.RunWithDefault(listCommand);
            ImageResult   images      = new ImageResult(listOutput);

            if (images.Ids.Length == 0)
            {
                Log.Info("No images found. Quiting...");
                return;
            }

            var selectedForDelete = new MultiSelect(description, images.MenuLines).Show();

            if (selectedForDelete.Count == 0)
            {
                Log.Info("Nothing is selected. Quiting...");
                return;
            }

            var deleteCommand = "docker rmi ";

            foreach (int index in selectedForDelete)
            {
                Log.Green($"Removing image: {images.Names[index]}");
                deleteCommand += $"{images.Ids[index]} ";
            }

            runner.RunWithDefault(deleteCommand);
            Log.Green("Done.");
        }
Esempio n. 6
0
        /// <summary>
        /// 将数据转换为下拉框的JSON格式
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list">要转换的对象类表</param>
        /// <param name="labelField">下拉框的显示内容字段</param>
        /// <param name="valueField">下拉框的值字段</param>
        /// <returns>JSON格式的下拉框数据</returns>
        /// <remarks>liujf  2016/11/23  create</remarks>
        protected string ConvertToSelectJson<T>(List<T> list, string labelField, string valueField)  
        {
            List<MultiSelect> selectList = new List<MultiSelect>(); 

            foreach (T t in list)
            {
                PropertyInfo[] propertys = t.GetType().GetProperties();
 
                MultiSelect select = new MultiSelect();
                foreach (PropertyInfo pi in propertys)
                {
                    if (pi.Name == labelField)
                    {
                        select.label = pi.GetValue(t, null).ToString();

                    }
                    else if (pi.Name == valueField)
                    {
                        select.value = pi.GetValue(t, null).ToString();
                    }

                }
                selectList.Add(select);
            }

            if(selectList.Count>0)
            {
                MultiSelect all = new MultiSelect();
                all.label = "全部";
                all.value = string.Empty;
                selectList.Insert(0, all);
            }
            return JsonConvert.SerializeObject(selectList); ;
        }
Esempio n. 7
0
        public static IEnumerable <T> MultiSelect <T>(string message, IEnumerable <T> items, int?pageSize = null,
                                                      int minimum = 1, int maximum = -1, Func <T, string> valueSelector = null)
        {
            using var form = new MultiSelect <T>(message, items, pageSize, minimum, maximum,
                                                 valueSelector ?? (x => x.ToString()));

            return(form.Start());
        }
Esempio n. 8
0
        public static IEnumerable <T> MultiSelect <T>(string message, int?pageSize = null, int minimum = 1,
                                                      int maximum = -1, Func <T, string> valueSelector = null) where T : struct, Enum
        {
            var items = (T[])Enum.GetValues(typeof(T));

            using var form = new MultiSelect <T>(message, items, pageSize, minimum, maximum,
                                                 valueSelector ?? (x => x.GetDisplayName()));

            return(form.Start());
        }
Esempio n. 9
0
        public ActionResult Test()
        {
            MultiSelect model = new MultiSelect();

            model.List = db.Exam_Subjects.Select(x => new SelectListItem()
            {
                Text = x.Title, Value = x.Id.ToString()
            }).ToList();
            return(View(model));
        }
Esempio n. 10
0
 private static void ProcessMultiSelect <TPage>(PropertyInfo prop, IDriver driver, TPage page)
 {
     if (prop.PropertyType == typeof(IMultiSelect))
     {
         var      el = new MultiSelect(driver);
         Selector s  = GetSelector(prop, el);
         el.Selector = s;
         prop.SetValue(page, el);
     }
 }
Esempio n. 11
0
        public void SetSearchLineForMultiSelectField(int index, string fieldName, string criteria, string conditionValue = "and")
        {
            Select      field     = new Select(By.XPath($"{fieldXpath}[{index}]"));
            MultiSelect value     = new MultiSelect(By.XPath($"{valueXpath}[{index}]/following-sibling::input"));
            Select      condition = new Select(By.XPath($"{conditionXpath}[{index}]"));

            field.SelectByText(fieldName);
            value.SetValue(criteria);
            condition.SelectByText(conditionValue);
            field.Click();
        }
Esempio n. 12
0
        public void outputs_sql()
        {
            // set-up
            MultiSelect multiSelect = new MultiSelect();

            multiSelect.Add(new Select <View>());
            multiSelect.Add(new Select <View>());

            // call & assert
            Assert.AreEqual("select * from dbo.View\r\nselect * from dbo.View", multiSelect.Sql());
        }
Esempio n. 13
0
        public void basic_multi_select_renders_with_no_options()
        {
            var element = new MultiSelect("foo.Bar").ToString()
                          .ShouldHaveHtmlNode("foo_Bar")
                          .ShouldHaveAttributesCount(3)
                          .ShouldBeNamed(HtmlTag.Select);

            element.ShouldHaveAttribute(HtmlAttribute.Name).WithValue("foo.Bar");
            element.ShouldHaveAttribute(HtmlAttribute.Multiple).WithValue(HtmlAttribute.Multiple);
            element.ShouldHaveNoChildNodes();
        }
Esempio n. 14
0
        public void basic_multi_select_renders_with_no_options()
        {
            var element = new MultiSelect("foo.Bar").ToString()
                .ShouldHaveHtmlNode("foo_Bar")
                .ShouldHaveAttributesCount(3)
                .ShouldBeNamed(HtmlTag.Select);

            element.ShouldHaveAttribute(HtmlAttribute.Name).WithValue("foo.Bar");
            element.ShouldHaveAttribute(HtmlAttribute.Multiple).WithValue(HtmlAttribute.Multiple);
            element.ShouldHaveNoChildNodes();
        }
Esempio n. 15
0
        protected override System.Web.UI.Control AddEditor(System.Web.UI.Control container)
        {
            var multiSelect = new MultiSelect {
                ID = Name
            };

            multiSelect.Items.AddRange(GetListItems());
            Configure(multiSelect);
            container.Controls.Add(multiSelect);
            return(multiSelect);
        }
        public void Should_apply_model_state_values_to_multiselect_element_selected_values_when_only_one_item_is_in_model_state()
        {
            stateDictionary.SetModelValue("foo", new ValueProviderResult(1, "1", CultureInfo.InvariantCulture));
            var select = new MultiSelect("foo").Options(new[] { 1, 2, 3 });

            target.Execute(select);
            var selectedValues = ConvertToGeneric <string>(select.SelectedValues);

            select.SelectedValues.ShouldNotBeNull();
            selectedValues.ShouldCount(1);
            Assert.Contains("1", selectedValues);
        }
Esempio n. 17
0
        public CraftingMenu(IEnumerable <InventoryItem> items)
        {
            var options = items.Select(item => new Option($"{item.Item.Icon} {item.Item.Name}", item.InventoryPosition.ToString())).ToList();

            var accessory = new MultiSelect(options, new PlainText(DougMessages.CraftingSelect), Actions.Craft.ToString());
            var text      = new MarkdownText(DougMessages.CraftingDialog);

            Blocks = new List <Block>
            {
                CraftingHeader(),
                new Divider(),
                new Section(text, accessory)
            };
        }
Esempio n. 18
0
        public void basic_multiselect_renders_with_options_from_dictionary()
        {
            var options = new Dictionary<int, string> { { 1, "One" }, { 2, "Two" }, { 3, "Three" } };
            var selectedOptions = new List<int> { 1, 3 };

            var html = new MultiSelect("foo.Bar").Options(options).Selected(selectedOptions).ToString();

            var element = html.ShouldHaveHtmlNode("foo_Bar");

            var optionNodes = element.ShouldHaveChildNodesCount(3);

            optionNodes[0].ShouldBeSelectedOption(1, options[1]);
            optionNodes[1].ShouldBeUnSelectedOption(2, options[2]);
            optionNodes[2].ShouldBeSelectedOption(3, options[3]);
        }
Esempio n. 19
0
        public void basic_multiselect_renders_with_options_from_dictionary()
        {
            var options = new Dictionary <int, string> {
                { 1, "One" }, { 2, "Two" }, { 3, "Three" }
            };
            var selectedOptions = new List <int> {
                1, 3
            };

            var html = new MultiSelect("foo.Bar").Options(options).Selected(selectedOptions).ToString();

            var element = html.ShouldHaveHtmlNode("foo_Bar");

            var optionNodes = element.ShouldHaveChildNodesCount(3);

            optionNodes[0].ShouldBeSelectedOption(1, options[1]);
            optionNodes[1].ShouldBeUnSelectedOption(2, options[2]);
            optionNodes[2].ShouldBeSelectedOption(3, options[3]);
        }
Esempio n. 20
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VariousPropertyBits;
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PicturePosition;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (Accelerator?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Size?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Picture?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MouseIcon?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)MaxLength;
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ DisplayStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ (PasswordChar?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ListWidth;
         hashCode = (hashCode * 397) ^ BoundColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ TextColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnCount.GetHashCode();
         hashCode = (hashCode * 397) ^ ListRows.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnInfoCount.GetHashCode();
         hashCode = (hashCode * 397) ^ MatchEntry.GetHashCode();
         hashCode = (hashCode * 397) ^ ListStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ ShowDropButtonWhen.GetHashCode();
         hashCode = (hashCode * 397) ^ DropButtonStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ MultiSelect.GetHashCode();
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (GroupName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Remainder?.Length.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Esempio n. 21
0
        public void basic_select_renders_select_with_options_from_select_list()
        {
            var items = new List<FakeModel>
            {
                new FakeModel {Id = 1, Title = "One"},
                new FakeModel {Id = 2, Title = "Two"},
                new FakeModel {Id = 3, Title = "Three"}
            };
            var selectedOptions = new List<int> { 1, 3 };

            var selectList = new MultiSelectList(items, "Id", "Title", selectedOptions);

            var html = new MultiSelect("foo.Bar").Options(selectList).ToString();

            var element = html.ShouldHaveHtmlNode("foo_Bar");

            var optionNodes = element.ShouldHaveChildNodesCount(3);

            optionNodes[0].ShouldBeSelectedOption(items[0].Id, items[0].Title);
            optionNodes[1].ShouldBeUnSelectedOption(items[1].Id, items[1].Title);
            optionNodes[2].ShouldBeSelectedOption(items[2].Id, items[2].Title);
        }
Esempio n. 22
0
        private void StartVolumeClean()
        {
            const string  description = "Select volumes to delete:";
            const string  listCommand = "docker volume ls --format \"{{.Name}}\"";
            ProcessRunner runner      = new ProcessRunner();
            string        listOutput  = runner.RunWithDefault(listCommand);

            string[] volumeNames = listOutput
                                   .Split('\n')
                                   .Where(s => !string.IsNullOrWhiteSpace(s))
                                   .Select(s => s.Trim())
                                   .ToArray();

            if (volumeNames.Length == 0)
            {
                Log.Info("No volumes found. Quiting...");
                return;
            }

            var selectedForDelete = new MultiSelect(description, volumeNames).Show();

            if (selectedForDelete.Count == 0)
            {
                Log.Info("Nothing is selected. Quiting...");
                return;
            }

            var deleteCommand = "docker volume rm ";

            foreach (int index in selectedForDelete)
            {
                Log.Green($"Removing volume: {volumeNames[index]}");
                deleteCommand += $"{volumeNames[index]} ";
            }

            runner.RunWithDefault(deleteCommand);
            Log.Green("Done.");
        }
Esempio n. 23
0
 protected virtual void Configure(MultiSelect ddl)
 {
     ddl.EnableFilter = SearchTreshold >= 0 && ddl.Items.Count >= SearchTreshold;
     ddl.SelectedList = byte.MaxValue;
 }
Esempio n. 24
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }

                if (TickVals != null)
                {
                    hashCode = hashCode * 59 + TickVals.GetHashCode();
                }

                if (TickText != null)
                {
                    hashCode = hashCode * 59 + TickText.GetHashCode();
                }

                if (TickFormat != null)
                {
                    hashCode = hashCode * 59 + TickFormat.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (Range != null)
                {
                    hashCode = hashCode * 59 + Range.GetHashCode();
                }

                if (ConstraintRange != null)
                {
                    hashCode = hashCode * 59 + ConstraintRange.GetHashCode();
                }

                if (MultiSelect != null)
                {
                    hashCode = hashCode * 59 + MultiSelect.GetHashCode();
                }

                if (Values != null)
                {
                    hashCode = hashCode * 59 + Values.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (TemplateItemName != null)
                {
                    hashCode = hashCode * 59 + TemplateItemName.GetHashCode();
                }

                if (TickValsSrc != null)
                {
                    hashCode = hashCode * 59 + TickValsSrc.GetHashCode();
                }

                if (TickTextSrc != null)
                {
                    hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
                }

                if (ValuesSrc != null)
                {
                    hashCode = hashCode * 59 + ValuesSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Esempio n. 25
0
        public bool Equals([AllowNull] Dimension other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Label == other.Label && Label != null && other.Label != null && Label.Equals(other.Label)) &&
                   (Equals(TickVals, other.TickVals) || TickVals != null && other.TickVals != null && TickVals.SequenceEqual(other.TickVals)) &&
                   (Equals(TickText, other.TickText) || TickText != null && other.TickText != null && TickText.SequenceEqual(other.TickText)) &&
                   (TickFormat == other.TickFormat && TickFormat != null && other.TickFormat != null && TickFormat.Equals(other.TickFormat)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Equals(Range, other.Range) || Range != null && other.Range != null && Range.SequenceEqual(other.Range)) &&
                   (Equals(ConstraintRange, other.ConstraintRange) || ConstraintRange != null && other.ConstraintRange != null && ConstraintRange.SequenceEqual(other.ConstraintRange)) &&
                   (MultiSelect == other.MultiSelect && MultiSelect != null && other.MultiSelect != null && MultiSelect.Equals(other.MultiSelect)) &&
                   (Equals(Values, other.Values) || Values != null && other.Values != null && Values.SequenceEqual(other.Values)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (TemplateItemName == other.TemplateItemName && TemplateItemName != null && other.TemplateItemName != null && TemplateItemName.Equals(other.TemplateItemName)) &&
                   (TickValsSrc == other.TickValsSrc && TickValsSrc != null && other.TickValsSrc != null && TickValsSrc.Equals(other.TickValsSrc)) &&
                   (TickTextSrc == other.TickTextSrc && TickTextSrc != null && other.TickTextSrc != null && TickTextSrc.Equals(other.TickTextSrc)) &&
                   (ValuesSrc == other.ValuesSrc && ValuesSrc != null && other.ValuesSrc != null && ValuesSrc.Equals(other.ValuesSrc)));
        }
Esempio n. 26
0
    /// <summary>
    /// Registers the client script with the Page object using a key and a URL, which enables the script to be called from the client.
    /// </summary>
    private void RegisterScripts()
    {
        if (!IsPostBack)
        {
            string OrganizationName = string.Empty;
            string ProfileOrg       = string.Empty;
            if (Organization != null)
            {
                ProfileOrg       = NexsoHelper.GetCulturedUrlByTabName("insprofile") + "/in/" + Organization.OrganizationID;
                OrganizationName = Organization.Name;
            }

            Page.ClientScript.RegisterClientScriptInclude(
                this.GetType(), "countryStateCity", ControlPath + "resources/js/countryStateCity.js");

            if (address.Value != string.Empty)
            {
                if (string.IsNullOrEmpty(ValidateSecurity.ValidateString(address.Value, false)))
                {
                    lblMessage.ErrorMessage = Localization.GetString("InvalidFormat", LocalResourceFile);
                    lblMessage.IsValid      = false;
                    return;
                }
            }
            string script = "<script>" +

                            "var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/organizationbldg.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var iconGenTestLocation" + this.ClientID + "='" + String.Format("{0}Images/testlocationcrc.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var profileOrg" + this.ClientID + "='" + ProfileOrg.ToString().ToLower() + "';"
                            +
                            "var orgName" + this.ClientID + "='" + OrganizationName.ToLower() + "';"
                            +
                            "var iconGenIni" + this.ClientID + "='" + String.Format("{0}Images/marker-yellow.png", PortalSettings.HomeDirectory) + "';"
                            +
                            //"var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/marker-blue.png", PortalSettings.HomeDirectory) + "';"
                            //+
                            "var multiSelectIni" + this.ClientID + "=" + MultiSelect.ToString().ToLower() + ";"
                            +
                            "var addressRequiredIni" + this.ClientID + "=" + AddressRequired.ToString().ToLower() + ";"

                            +
                            "var viewInEditModeIni" + this.ClientID + "=" + ViewInEditMode.ToString().ToLower() + ";"
                            +
                            "var addressPlaceHolderIni" + this.ClientID + "='" + GetLabelAddresPlaceHolder() + "';"
                            +
                            "var cscPlaceHolderIni" + this.ClientID + "='" + GetLabelCityStateCountryPlaceHolder() + "';"
                            +
                            "function load" + ClientID + "(){initializemap(document.getElementById('map_canvas" +
                            ClientID + "'), document.getElementById('" + pac_input.ClientID +
                            "'), document.getElementById('" + address.ClientID +
                            "'),document.getElementById('btnGeocode" + ClientID + "'),document.getElementById('" +
                            hdVal1.ClientID + "'),'" + this.ClientID + "');}" +

                            "$(document).ready(function () {Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(load" +
                            ClientID + ");Sys.WebForms.PageRequestManager.getInstance().add_endRequest(load" + ClientID +
                            ");});" +


                            "</script>";


            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script" + ClientID, script);
            rfvAddress.Visible = LocationRequired;
        }
    }
Esempio n. 27
0
        public static IHtmlString MultiSelectList(this HtmlHelper helper, string name, IEnumerable <MultiSelectItem> items = null, MultiSelectOptions options = null)
        {
            MultiSelect ms = new MultiSelect(items, options);

            return(new HtmlString(ms.Render(name)));
        }
Esempio n. 28
0
        private DataItem UnpackDataItem(JObject dataItemObj)
        {
            DataItem dataItem = dataItemObj.ToObject <DataItem>();

            if (dataItemObj["Type"].ToString() == "Picture")
            {
                Picture picture = new Picture(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                              dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy,
                                              int.Parse(dataItemObj["Multi"].ToString()), bool.Parse(dataItemObj["GeolocationEnabled"].ToString()));
                return(picture);
            }
            else if (dataItemObj["Type"].ToString() == "SaveButton")
            {
                SaveButton saveButton = new SaveButton(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                                       dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy,
                                                       dataItemObj["Value"].ToString());
                return(saveButton);
            }
            else if (dataItemObj["Type"].ToString() == "Timer")
            {
                Timer timer = new Timer(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                        dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy,
                                        bool.Parse(dataItemObj["StopOnSave"].ToString()));
                return(timer);
            }
            else if (dataItemObj["Type"].ToString() == "None")
            {
                None none = new None(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                     dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy);
                return(none);
            }
            else if (dataItemObj["Type"].ToString() == "Signature")
            {
                Signature signature = new Signature(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                                    dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy);
                return(signature);
            }
            else if (dataItemObj["Type"].ToString() == "Date")
            {
                Date date = new Date(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                     dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, (bool)dataItem.Dummy,
                                     DateTime.ParseExact(dataItemObj["MinValue"].ToString(), "yyyy-MM-dd hh:mm:ss", null),
                                     DateTime.ParseExact(dataItemObj["MaxValue"].ToString(), "yyyy-MM-dd hh:mm:ss", null),
                                     dataItemObj["DefaultValue"].ToString());
                return(date);
            }
            else if (dataItemObj["Type"].ToString() == "ShowPdf")
            {
                ShowPdf showPdf = new ShowPdf(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                              dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy,
                                              dataItemObj["Value"].ToString());
                return(showPdf);
            }
            else if (dataItemObj["Type"].ToString() == "CheckBox")
            {
                CheckBox checkBox = new CheckBox(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                                 dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy,
                                                 bool.Parse(dataItemObj["DefaultValue"].ToString()), bool.Parse(dataItemObj["Selected"].ToString()));
                return(checkBox);
            }
            else if (dataItemObj["Type"].ToString() == "MultiSelect")
            {
                List <KeyValuePair> keyValuePairList = new List <KeyValuePair>();
                foreach (JObject keyValuePairObj in dataItemObj["KeyValuePairList"])
                {
                    KeyValuePair keyValuePair = keyValuePairObj.ToObject <KeyValuePair>();
                    keyValuePairList.Add(keyValuePair);
                }
                MultiSelect multiSelect = new MultiSelect(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                                          dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy, keyValuePairList);
                return(multiSelect);
            }
            else if (dataItemObj["Type"].ToString() == "SingleSelect")
            {
                List <KeyValuePair> keyValuePairList = new List <KeyValuePair>();
                foreach (JObject keyValuePairObj in dataItemObj["KeyValuePairList"])
                {
                    KeyValuePair keyValuePair = keyValuePairObj.ToObject <KeyValuePair>();
                    keyValuePairList.Add(keyValuePair);
                }
                SingleSelect singleSelect = new SingleSelect(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                                             dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy, keyValuePairList);
                return(singleSelect);
            }
            else if (dataItemObj["Type"].ToString() == "Number")
            {
                Number number = new Number(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                           dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy,
                                           dataItemObj["MinValue"].ToString(), dataItemObj["MaxValue"].ToString(),
                                           int.Parse(dataItemObj["DefaultValue"].ToString()), int.Parse(dataItemObj["DecimalCount"].ToString()),
                                           dataItemObj["UnitName"].ToString());
                return(number);
            }
            else if (dataItemObj["Type"].ToString() == "Text")
            {
                Text text = new Text(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                     dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy,
                                     dataItemObj["Value"].ToString(), int.Parse(dataItemObj["MaxLength"].ToString()),
                                     bool.Parse(dataItemObj["GeolocationEnabled"].ToString()), bool.Parse(dataItemObj["GeolocationForced"].ToString()),
                                     bool.Parse(dataItemObj["GeolocationHidden"].ToString()), bool.Parse(dataItemObj["BarcodeEnabled"].ToString()),
                                     dataItemObj["BarcodeType"].ToString());
                return(text);
            }
            else if (dataItemObj["Type"].ToString() == "Comment")
            {
                Comment comment = new Comment(dataItem.Id, dataItem.Mandatory, dataItem.ReadOnly, dataItem.Label,
                                              dataItem.Description.ToString(), dataItem.Color, dataItem.DisplayOrder, dataItem.Dummy,
                                              dataItemObj["Value"].ToString(), int.Parse(dataItemObj["MaxLength"].ToString()),
                                              bool.Parse(dataItemObj["SplitScreen"].ToString()));
                return(comment);
            }
            else if (dataItemObj["Type"].ToString() == "FieldContainer")
            {
                List <DataItem> dataItemList = new List <DataItem>();
                foreach (JObject diObj in dataItemObj["DataItemList"])
                {
                    DataItem di = UnpackDataItem(diObj);
                    dataItemList.Add(di);
                }
                FieldContainer fieldContainer = new FieldContainer(dataItem.Id, dataItem.Label, dataItem.Description,
                                                                   dataItem.Color, dataItem.DisplayOrder, dataItemObj["Value"].ToString(), dataItemList);
                return(fieldContainer);
            }
            return(dataItem);
        }
Esempio n. 29
0
 protected virtual void Configure(MultiSelect ddl)
 {
     ddl.SearchTreshold = SearchTreshold;
 }
Esempio n. 30
0
 public MultiSelectHtmlBuilder(MultiSelect component)
 {
     this.Component = component;
 }