Esempio n. 1
0
        public override string GetStringValue()
        {
            string t  = Value2.ToString("X4").Substring(1, 3);
            string t2 = _variable.GetStringValue();

            return(t2.Substring(0, 1) + t + "." + t2.Substring(1, 1));
        }
Esempio n. 2
0
        public override string GetStringValue()
        {
            string t = Value2.ToString("X4");

            t = "1" + t.Substring(0, 2) + "." + t.Substring(2, 2);
            return(t);
        }
Esempio n. 3
0
 private void Value2Downbutton_Click(object sender, EventArgs e)
 {
     Value2 = Value2 - i;
     if (Value2 == 60 || Value2 == -1)
     {
         Value2 = 0;
     }
     Value2textBox.Text = Value2.ToString();
 }
Esempio n. 4
0
        public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            #region << Init >>
            var initSuccess = InitFilter(context, output);

            if (!initSuccess)
            {
                return(Task.CompletedTask);
            }
            #endregion

            var inputGroupEl = new TagBuilder("div");
            inputGroupEl.AddCssClass("input-group");

            inputGroupEl.InnerHtml.AppendHtml(FilterTypeSelect);

            #region << valueDateControl >>
            {
                var valueDateControl = new TagBuilder("input");
                valueDateControl.AddCssClass("form-control value");
                if (QueryType != FilterType.BETWEEN && QueryType != FilterType.NOTBETWEEN)
                {
                    valueDateControl.AddCssClass("rounded-right");
                }
                valueDateControl.Attributes.Add("value", (Value != null ? Value.ToString("yyyy-MM-dd") : ""));
                valueDateControl.Attributes.Add("type", "date");
                valueDateControl.Attributes.Add("name", UrlQueryOfValue);
                inputGroupEl.InnerHtml.AppendHtml(valueDateControl);
            }
            #endregion


            inputGroupEl.InnerHtml.AppendHtml(AndDivider);

            #region << value2DateControl >>
            {
                var value2DateControl = new TagBuilder("input");
                value2DateControl.Attributes.Add("value", (Value2 != null ? Value2.ToString("yyyy-MM-dd") : ""));
                value2DateControl.AddCssClass("form-control value2");
                value2DateControl.Attributes.Add("type", "date");
                if (QueryType == FilterType.BETWEEN || QueryType == FilterType.NOTBETWEEN)
                {
                    value2DateControl.Attributes.Add("name", UrlQueryOfValue2);
                }
                else
                {
                    value2DateControl.AddCssClass("d-none");
                }
                inputGroupEl.InnerHtml.AppendHtml(value2DateControl);
            }
            #endregion


            output.Content.AppendHtml(inputGroupEl);

            return(Task.CompletedTask);
        }
Esempio n. 5
0
        public override IEnumerable <string> GetValueString()
        {
            List <string> result = new List <string>();

            result.Add(FuncName);
            result.Add(Value1.ToString());
            result.Add(Value2.ToString());
            result.Add(Value3.ToString());
            result.Add(Value4.ToString());
            return(result);
        }
Esempio n. 6
0
 private void ResetShotClock()
 {
     Second2 = 0;
     Pause   = 0;
     ShotClockTimer.Start();
     flag1 = 0;
     if (flag1 == 0 && ShotCheck == 0)
     {
         ShotClocktextBox.Text = Value1.ToString();
     }
     if (flag1 == 0 && ShotCheck == 1)
     {
         ShotClocktextBox.Text = Value2.ToString();
     }
 }
Esempio n. 7
0
        public void SetValue(string value)
        {
            if (Value2 != null && Result != null)
            {
                ResetCalculator();
            }

            if (this.Operation == OperationType.None)
            {
                //Starting a new operation. Build Value1
                Value1  = decimal.Parse(String.Concat(Value1, value));
                Display = Value1.ToString();
            }
            else
            {
                //set value for Value 2
                Value2  = decimal.Parse(String.Concat(Value2, value));
                Display = Value2.ToString();
            }
        }
Esempio n. 8
0
        public override string GetStringValue()
        {
            switch (ValueSize)
            {
            case 1:
                return(Value1.ToString());

            case 2:
                return(Value2.ToString());

            case 4:
                return(Value4.ToString());

            case 8:
                return(Value8.ToString());

            default:
                return("");
            }
        }
Esempio n. 9
0
 private void StartShotClock()
 {
     flag1 = 0;
     ShotClockTimer.Start();
     if (Pause == 1)
     {
     }
     else
     {
         if (flag1 == 0 && ShotCheck == 0)
         {
             ShotClocktextBox.Text = Value1.ToString();
         }
         if (flag1 == 0 && ShotCheck == 1)
         {
             ShotClocktextBox.Text = Value2.ToString();
         }
     }
     Startbutton2.Enabled = false;
     Pausebutton2.Enabled = true;
     //Gm.BringToFront();
 }
Esempio n. 10
0
 public override string ToString()
 {
     if (Value1Exception != null && Value2Exception != null)
     {
         if (Value1Exception.GetType().Equals(Value2Exception.GetType()))
         {
             return(Member.Name + ": Exception in both, same exception type of type " + Value1Exception.GetType().Name + ", message in first exception: " + Value1Exception.Message + ", message in second exception: " + Value2Exception.Message + ", differences in type value: " + string.Join("\n", ReflectiveCompare(Value1Exception, Value2Exception).ToArray()));
         }
         else if (!Value1Exception.GetType().Equals(Value2Exception.GetType()))
         {
             return(Member.Name + ": Exception in both, different exception type: " + Value1Exception.GetType().Name + " : " + Value2Exception.GetType().Name + ", message in first exception: " + Value1Exception.Message + ", message in second exception: " + Value2Exception.Message);
         }
     }
     else if (Value1Exception != null && Value2Exception == null)
     {
         return(Member.Name + ": " + Value2.ToString() + " Exception in first of type " + Value1Exception.GetType().Name + ", message is: " + Value1Exception.Message);
     }
     else if (Value1Exception == null && Value2Exception != null)
     {
         return(Member.Name + ": " + Value1.ToString() + " Exception in second of type " + Value2Exception.GetType().Name + ", message is: " + Value2Exception.Message);
     }
     return(Member.Name + ": " + Value1.ToString() + (Value1.Equals(Value2) ? " == " : " != ") + Value2.ToString());
 }
Esempio n. 11
0
            public override string GetStringValue()
            {
                string t = Value2.ToString("X4");

                return(t.Substring(1, 1) + t.Substring(3, 1));
            }
Esempio n. 12
0
 public override string ToString()
 {
     return(Member.Name + ": " + Value1.ToString() + (Value1.Equals(Value2) ? " == " : " != ") + Value2.ToString());
 }
Esempio n. 13
0
        private string InternalToString(bool withParamValues = true)
        {
            var result = PropertyName;

            switch (Operator)
            {
            case QueryOperator.Eq:
                result += " = ";
                break;

            case QueryOperator.Le:
                result += " <= ";
                break;

            case QueryOperator.Lt:
                result += " < ";
                break;

            case QueryOperator.Gt:
                result += " > ";
                break;

            case QueryOperator.Ge:
                result += " >= ";
                break;

            case QueryOperator.In:
                result += " In ";
                break;

            case QueryOperator.NotIn:
                result += " NOT In ";
                break;

            case QueryOperator.Contains:
                result += " Contains ";
                break;

            case QueryOperator.NotContains:
                result += " NOT Contains ";
                break;


            case QueryOperator.NotEq:
                result += " != ";
                break;

            case QueryOperator.StrStartsWith:
                result += " StartsWith ";
                break;

            case QueryOperator.StrEndsWith:
                result += " EndsWith ";
                break;

            case QueryOperator.StrContains:
                result += " Contains ";
                break;
            }


            if (Operator.IsRangeOperator())
            {
                var v1 = withParamValues ? Value.ToString() : "?";
                var v2 = withParamValues ? Value2.ToString() : "?";

                result += " in range ";

                if (Operator == QueryOperator.GeLe)
                {
                    result += $"[{v1}, {v2}]";
                }
                else if (Operator == QueryOperator.GeLt)
                {
                    result += $"[{v1}, {v2})";
                }
                else if (Operator == QueryOperator.GtLt)
                {
                    result += $"({v1}, {v2})";
                }
                else if (Operator == QueryOperator.GtLe)
                {
                    result += $"({v1}, {v2}]";
                }
            }
            else if (Operator == QueryOperator.In || Operator == QueryOperator.NotIn)
            {
                if (InValues.Count >= 4)
                {
                    var values = withParamValues ? InValues.Count.ToString() : "?";
                    result += "(" + values + " values)";
                }
                else
                {
                    if (withParamValues)
                    {
                        result += "(";
                        foreach (var keyValue in InValues)
                        {
                            result += keyValue;
                            result += " ";
                        }

                        result += ")";
                    }
                    else
                    {
                        result += "(?)";
                    }
                }
            }
            else
            {
                if (withParamValues)
                {
                    result += Value.ToString();
                    if (!ReferenceEquals(Value2, null))
                    {
                        result += ", " + Value2;
                    }
                }
                else
                {
                    result += "?";
                    if (!ReferenceEquals(Value2, null))
                    {
                        result += ", ?";
                    }
                }
            }

            return(result);
        }
        void Update()
        {
            Value1 = Slot1.GetComponent <SnapDropZoneOverride>().thisStack.Count;
            Value2 = Slot2.GetComponent <SnapDropZoneOverride>().thisStack.Count;
            Value3 = Slot3.GetComponent <SnapDropZoneOverride>().thisStack.Count;

            if (Value1 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value1 == 4)
                {
                    counter.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter.text = "M";
                }
                else
                {
                    counter.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter.text = Value1.ToString();
                }
            }
            else
            {
                counter.gameObject.SetActive(false);
            }

            if (Value2 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value2 == 4)
                {
                    counter2.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter2.text = "M";
                }
                else
                {
                    counter2.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter2.text = Value2.ToString();
                }
            }
            else
            {
                counter2.gameObject.SetActive(false);
            }

            if (Value3 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value3 == 4)
                {
                    counter3.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter3.text = "M";
                }
                else
                {
                    counter3.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter3.text = Value3.ToString();
                }
            }
            else
            {
                counter3.gameObject.SetActive(false);
            }
        }
Esempio n. 15
0
 public override string GetStringValue()
 {
     return(" " + Value2.ToString("X4"));
 }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Type", true, out subEle);
            subEle.Value = Type.ToString();

            ele.TryPathTo("Threshold", true, out subEle);
            subEle.Value = Threshold.ToString();

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            ele.TryPathTo("Interval", true, out subEle);
            subEle.Value = Interval.ToString();

            switch (Type)
            {
            case ChallengeType.KillFromAFormList:
                ele.TryPathTo("BodyPart", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("WeaponActorValue", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.KillASpecificFormID:
                ele.TryPathTo("BodyPart", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("WeaponActorValue", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.KillAnyInACategory:
                ele.TryPathTo("BodyPart", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("CreatureType", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.HitAnEnemy:
                ele.TryPathTo("BodyPart", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("TypeOfHit", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.DiscoverAMapMarker:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.UseAnItem:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.AcquireAnItem:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.UseASkill:
                ele.TryPathTo("Result", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("Difficulty", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.DoDamage:
                ele.TryPathTo("BodyPart", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("WeaponActorValue", true, out subEle);
                subEle.Value = Value2.ToString();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.UseAnItemFromAList:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.AcquireAnItemFromAList:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.MiscellaneousStat:
                ele.TryPathTo("MiscStat", true, out subEle);
                subEle.Value = Value1.ToString();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("WeaponCategory", true, out subEle);
                subEle.Value = Value3.ToString();
                break;

            case ChallengeType.CraftUsingAnItem:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;

            case ChallengeType.ScriptedChallenge:
                ele.TryPathTo("Unused1", true, out subEle);
                subEle.Value = (Value1 as byte[]).ToBase64();

                ele.TryPathTo("Unused2", true, out subEle);
                subEle.Value = (Value2 as byte[]).ToBase64();

                ele.TryPathTo("Unused3", true, out subEle);
                subEle.Value = (Value3 as byte[]).ToBase64();
                break;
            }
        }
Esempio n. 17
0
        public bool InitFilter(TagHelperContext context, TagHelperOutput output)
        {
            var isSuccess = true;

            #region << Init Props >>
            if (String.IsNullOrWhiteSpace(Name))
            {
                InitErrors.Add("Name attribute is required for wv-filter TagHelper!");
            }
            UrlQueryOfType   = $"{Prefix}q_{Name}_t";
            UrlQueryOfValue  = $"{Prefix}q_{Name}_v";
            UrlQueryOfValue2 = $"{Prefix}q_{Name}_v2";

            if (FilterId == Guid.Empty)
            {
                FilterId = Guid.NewGuid();
            }

            #endregion

            #region << Init Values >>

            #region << Preinit from URL - type,value,value2 >>
            var urlQueryDict = ViewContext.HttpContext.Request.Query;

            if (urlQueryDict.ContainsKey(UrlQueryOfType))
            {
                if (Enum.TryParse(urlQueryDict[UrlQueryOfType], out FilterType result))
                {
                    QueryType = result;
                }
            }

            if (urlQueryDict.ContainsKey(UrlQueryOfValue))
            {
                Value = (string)urlQueryDict[UrlQueryOfValue];
            }

            if (urlQueryDict.ContainsKey(UrlQueryOfValue2))
            {
                Value2 = (string)urlQueryDict[UrlQueryOfValue2];
            }
            #endregion

            #region << Convert to proper type = value, value2 >>
            var     tagName      = context.TagName;
            dynamic valueResult  = null;
            dynamic value2Result = null;
            var     errorList    = new List <string>();
            var     error2List   = new List <string>();
            var     fieldType    = FieldType.TextField;
            switch (context.TagName)
            {
            case "wv-filter-autonumber":
                fieldType = FieldType.AutoNumberField;
                break;

            case "wv-filter-checkbox":
                fieldType = FieldType.CheckboxField;
                break;

            case "wv-filter-currency":
                fieldType = FieldType.CurrencyField;
                break;

            case "wv-filter-date":
                fieldType = FieldType.DateField;
                break;

            case "wv-filter-datetime":
                fieldType = FieldType.DateTimeField;
                break;

            case "wv-filter-email":
                fieldType = FieldType.EmailField;
                break;

            case "wv-filter-file":
                fieldType = FieldType.FileField;
                break;

            case "wv-filter-guid":
                fieldType = FieldType.GuidField;
                break;

            case "wv-filter-html":
                fieldType = FieldType.HtmlField;
                break;

            case "wv-filter-image":
                fieldType = FieldType.ImageField;
                break;

            case "wv-filter-textarea":
                fieldType = FieldType.MultiLineTextField;
                break;

            case "wv-filter-multiselect":
                fieldType = FieldType.MultiSelectField;
                break;

            case "wv-filter-number":
                fieldType = FieldType.NumberField;
                break;

            case "wv-filter-percent":
                fieldType = FieldType.NumberField;
                break;

            case "wv-filter-phone":
                fieldType = FieldType.PhoneField;
                break;

            case "wv-filter-select":
                fieldType = FieldType.SelectField;
                break;

            case "wv-filter-url":
                fieldType = FieldType.UrlField;
                break;

            default:
                fieldType = FieldType.TextField;
                break;
            }

            DataUtils.ValidateValueToFieldType(fieldType, Value, out valueResult, out errorList);
            Value = valueResult;
            if (errorList.Count > 0)
            {
                Value = null;
            }

            DataUtils.ValidateValueToFieldType(fieldType, Value2, out value2Result, out error2List);
            Value2 = value2Result;
            if (error2List.Count > 0)
            {
                foreach (var error in error2List)
                {
                    InitErrors.Add(error);
                }
            }
            if (QueryOptions == null)
            {
                QueryOptions = new List <FilterType>();
            }

            if (QueryOptions.Count == 0)
            {
                QueryOptions = DataUtils.GetFilterTypesForFieldType(fieldType);
            }

            if (QueryType == FilterType.Undefined)
            {
                //If options has EQ selected
                if (QueryOptions.Any(x => x == FilterType.EQ))
                {
                    QueryType = FilterType.EQ;
                }
                //If not select the first in the options
                else if (QueryOptions.Any())
                {
                    QueryType = QueryOptions.First();
                }
            }

            #endregion


            #region << Render >>
            output.TagName = "div";
            output.AddCssClass("erp-field form-group erp-filter");
            output.Attributes.Add("id", $"erp-filter-{FilterId}");
            output.Attributes.Add("data-name", $"{Name}");
            output.Attributes.Add("data-prefix", $"{Prefix}");
            output.Attributes.Add("data-filter-id", $"{FilterId}");

            var labelEl = new TagBuilder("label");
            labelEl.AddCssClass("control-label");
            if (!String.IsNullOrWhiteSpace(Label))
            {
                labelEl.InnerHtml.AppendHtml(Label);
            }
            else
            {
                labelEl.InnerHtml.AppendHtml(Name);
            }
            var clearLink = new TagBuilder("a");
            clearLink.AddCssClass("clear-filter action");
            clearLink.Attributes.Add("href", "javascript:void(0)");
            clearLink.InnerHtml.Append("clear");

            if ((Value == null || Value.ToString() == "") && (Value2 == null || Value2.ToString() == ""))
            {
                clearLink.AddCssClass("d-none");
            }
            labelEl.InnerHtml.AppendHtml(clearLink);

            output.PreContent.AppendHtml(labelEl);



            #region << if Init Errors >>
            if (InitErrors.Count > 0)
            {
                var errorListEl = new TagBuilder("ul");
                errorListEl.AddCssClass("erp-error-list list-unstyled");
                foreach (var error in InitErrors)
                {
                    var errorEl = new TagBuilder("li");
                    errorEl.AddCssClass("go-red");

                    var iconEl = new TagBuilder("span");
                    iconEl.AddCssClass("fa fa-fw fa-exclamation");

                    errorEl.InnerHtml.AppendHtml(iconEl);
                    errorEl.InnerHtml.Append($"Error: {error}");

                    errorListEl.InnerHtml.AppendHtml(errorEl);
                }
                output.PostContent.AppendHtml(errorListEl);
                return(false);
            }
            #endregion

            #endregion


            #endregion

            #region << Query Type Select >>

            if (QueryOptions.Count > 1)
            {
                FilterTypeSelect = new TagBuilder("select");
                FilterTypeSelect.AddCssClass("form-control erp-filter-rule");
                FilterTypeSelect.Attributes.Add("name", $"{UrlQueryOfType}");
                foreach (var typeOption in QueryOptions)
                {
                    var optionEl = new TagBuilder("option");
                    optionEl.Attributes.Add("value", typeOption.ToString());
                    optionEl.InnerHtml.Append(typeOption.GetLabel());
                    if (QueryType == typeOption)
                    {
                        optionEl.Attributes.Add("selected", null);
                    }
                    FilterTypeSelect.InnerHtml.AppendHtml(optionEl);
                }
            }
            else
            {
                //If 1
                FilterTypeSelect = new TagBuilder("span");
                FilterTypeSelect.AddCssClass($"input-group-prepend erp-filter-rule");
                var prependText = new TagBuilder("span");
                prependText.AddCssClass("input-group-text");
                prependText.InnerHtml.AppendHtml(QueryOptions.First().GetLabel());
                FilterTypeSelect.InnerHtml.AppendHtml(prependText);

                var hiddenInput = new TagBuilder("input");
                hiddenInput.Attributes.Add("type", "hidden");
                hiddenInput.Attributes.Add("value", QueryOptions.First().ToString());
                hiddenInput.Attributes.Add("name", $"{UrlQueryOfType}");
                FilterTypeSelect.InnerHtml.AppendHtml(hiddenInput);
            }

            #endregion

            #region << ValueTextControl >>
            {
                ValueTextControl = new TagBuilder("input");
                ValueTextControl.AddCssClass("form-control value");
                if (QueryType != FilterType.BETWEEN && QueryType != FilterType.NOTBETWEEN)
                {
                    ValueTextControl.AddCssClass("rounded-right");
                }
                ValueTextControl.Attributes.Add("value", (Value ?? "").ToString());
                ValueTextControl.Attributes.Add("type", "text");
                ValueTextControl.Attributes.Add("name", UrlQueryOfValue);
            }
            #endregion

            #region << ValueNumberControl >>
            {
                ValueNumberControl = new TagBuilder("input");
                ValueNumberControl.AddCssClass("form-control value");
                if (QueryType != FilterType.BETWEEN && QueryType != FilterType.NOTBETWEEN)
                {
                    ValueNumberControl.AddCssClass("rounded-right");
                }
                ValueNumberControl.Attributes.Add("value", (Value ?? "").ToString());
                ValueNumberControl.Attributes.Add("type", "number");
                ValueNumberControl.Attributes.Add("name", UrlQueryOfValue);
            }
            #endregion

            #region << Value2NumberControl >>
            {
                Value2NumberControl = new TagBuilder("input");
                Value2NumberControl.Attributes.Add("value", (Value2 ?? "").ToString());
                Value2NumberControl.AddCssClass("form-control value2");
                Value2NumberControl.Attributes.Add("type", "number");
                if (QueryType == FilterType.BETWEEN || QueryType == FilterType.NOTBETWEEN)
                {
                    Value2NumberControl.Attributes.Add("name", UrlQueryOfValue2);
                }
                else
                {
                    Value2NumberControl.AddCssClass("d-none");
                }
            }
            #endregion

            #region << AndDivider >>
            {
                AndDivider = new TagBuilder("span");
                AndDivider.AddCssClass($"input-group-prepend input-group-append erp-filter-divider");
                if (QueryType != FilterType.BETWEEN && QueryType != FilterType.NOTBETWEEN)
                {
                    AndDivider.AddCssClass("d-none");
                }
                var prependText = new TagBuilder("span");
                prependText.AddCssClass("input-group-text divider");
                prependText.InnerHtml.Append("&");
                AndDivider.InnerHtml.AppendHtml(prependText);
            }
            #endregion

            var jsCompressor = new JavaScriptCompressor();

            #region << Init Scripts >>
            var tagHelperInitialized = false;
            if (ViewContext.HttpContext.Items.ContainsKey(typeof(WvFilterBase) + "-base"))
            {
                var tagHelperContext = (WvTagHelperContext)ViewContext.HttpContext.Items[typeof(WvFilterBase) + "-base"];
                tagHelperInitialized = tagHelperContext.Initialized;
            }
            if (!tagHelperInitialized)
            {
                var scriptContent = FileService.GetEmbeddedTextResource("base.js", "WebVella.Erp.Web.TagHelpers.WvFilterBase");
                var scriptEl      = new TagBuilder("script");
                scriptEl.Attributes.Add("type", "text/javascript");
                scriptEl.InnerHtml.AppendHtml(jsCompressor.Compress(scriptContent));
                output.PostContent.AppendHtml(scriptEl);

                ViewContext.HttpContext.Items[typeof(WvFilterBase) + "-base"] = new WvTagHelperContext()
                {
                    Initialized = true
                };
            }
            #endregion

            #region << Add Inline Init Script for this instance >>
            var initScript = new TagBuilder("script");
            initScript.Attributes.Add("type", "text/javascript");
            var scriptTemplate = @"
						$(function(){
							BaseFilterInit(""{{FilterId}}"",""{{Value2InputName}}"");
						});"                        ;
            scriptTemplate = scriptTemplate.Replace("{{FilterId}}", FilterId.ToString());
            scriptTemplate = scriptTemplate.Replace("{{Value2InputName}}", UrlQueryOfValue2.ToString());
            initScript.InnerHtml.AppendHtml(jsCompressor.Compress(scriptTemplate));

            output.PostContent.AppendHtml(initScript);
            #endregion



            return(isSuccess);
        }
Esempio n. 18
0
 public override string ToString()
 {
     return('{' + Value2.ToString() + ", " + Value.ToString() + '}');
 }