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);
        }
示例#2
0
 public static string EncryptFormValues(string plainText, string apiSessionId, bool isEncrypted)
 {
     return(isEncrypted ? StringCipher.Encrypt(plainText, apiSessionId + "_adsk256") : plainText);
 }