private void FillValue()
        {
            if (this.Helper?.FormAction == HtmlElementHelperModel.e_FormAction.Onload ||
                this.Helper?.FormAction == HtmlElementHelperModel.e_FormAction.Preview)
            {
                this.Value = StringCipher.EncryptFormValues(this.Helper.DataManageHelper.GetValueByBinding(this.Fill).ToStringObj(), base.Helper.ApiSessionId, base.Helper.IsEncrypted);

                //Set TextOfSelectedValue
                if (string.IsNullOrWhiteSpace(this.Value.ToStringObj()))
                {
                    this.TextOfSelectedValue = string.Empty;
                }
                else
                {
                    string varName = this.FillList.Split(',').FirstOrDefault();
                    this.TextOfSelectedValue = this.Helper.DataManageHelper.GetEntityWithKeyValue(varName, new Dictionary <string, object>()
                    {
                        { this.Key, this.Value }
                    })?[this.Text].ToStringObj();
                }
            }
            else
            if (this.Helper?.FormAction != HtmlElementHelperModel.e_FormAction.FillMode)
            {
                this.Value = this.Helper?.ListFormQueryModel?.FirstOrDefault(c => c.Key == this.Id)?.Value.ToStringObj() ?? "";
            }
        }
Example #2
0
 public override void BindDataSource(object value)
 {
     foreach (DataModel item in ((value is DataTable ? ((VariableModel)(DataTable)value) : ((VariableModel)value))?.Items ?? new List <DataModel>()))
     {
         this.Options.Add(new OptionHtml()
         {
             Label    = item[this.Text].ToStringObj(),
             Value    = StringCipher.EncryptFormValues(item[this.Key].ToStringObj(), base.Helper.ApiSessionId, base.Helper.IsEncrypted),
             Selected = this.Value.ToStringObj() == item[this.Key].ToStringObj()
         });
     }
 }
 public override void FillData(List <QueryModel> listFormQueryModel = null)
 {
     this.Options = this.Options ?? new List <OptionHtml>();
     foreach (DataModel item in this.Helper.DataManageHelper.GetEntityByBinding(this.FillList, listFormQueryModel, null, $"select * from ({{0}}) as _bpmstd where {this.Text} like N'%'+@query+'%' ").Items)
     {
         this.Options.Add(new OptionHtml()
         {
             Label = item[this.Text].ToStringObj(),
             Value = StringCipher.EncryptFormValues(item[this.Key].ToStringObj(), base.Helper.ApiSessionId, base.Helper.IsEncrypted),
         });
     }
 }
Example #4
0
 public override void FillData(List <QueryModel> listFormQueryModel = null)
 {
     this.Helper?.DataManageHelper?.ClearVariable(this.FillList);
     foreach (DataModel item in this.Helper.DataManageHelper.GetEntityByBinding(this.FillList, listFormQueryModel).Items)
     {
         this.Options.Add(new OptionHtml()
         {
             Label    = item[this.Text].ToStringObj(),
             Value    = StringCipher.EncryptFormValues(item[this.Key].ToStringObj(), base.Helper.ApiSessionId, base.Helper.IsEncrypted),
             Selected = this.Value.ToStringObj().Split(',').Contains(item[this.Key].ToStringObj())
         });
     }
 }
        private string GetParameter(string parameters, DataModel item)
        {
            string paramValue = string.Empty;

            foreach (string param in parameters.Split(','))
            {
                if (!string.IsNullOrWhiteSpace(parameters))
                {
                    string value    = string.Empty;
                    string setValue = param.Split(':')[2];
                    switch (param.Split(':')[1])
                    {
                    case "1":    //field
                        if (item != null)
                        {
                            value = StringCipher.EncryptFormValues(item[(setValue.Trim())].ToStringObj(), Helper.ApiSessionId, Helper.IsEncrypted);
                        }
                        break;

                    case "2":    //variable
                        value = StringCipher.EncryptFormValues(Helper.DataManageHelper.GetValueByBinding(setValue).ToStringObj(), Helper.ApiSessionId, Helper.IsEncrypted);
                        break;

                    case "3":    //static
                        value = StringCipher.EncryptFormValues(setValue, Helper.ApiSessionId, Helper.IsEncrypted);
                        break;

                    case "4":    //control : in js files it can use [textbox] to get control value.
                        value = $"[{setValue}]";
                        break;
                    }
                    paramValue += $",{param.Split(':')[0]}={value}";
                }
            }
            paramValue = paramValue.Trim(',');
            return(paramValue);
        }