Пример #1
0
        /// <summary>
        ///  增加一个查询参数
        /// </summary>
        /// <param name="field">数据库字段</param>
        /// <param name="dbType">字段类型</param>
        /// <param name="value">字段指定的值</param>
        /// <param name="size">字段长度</param>
        /// <param name="specificType">指定类型,通常枚举类型时需提供该参数的值</param>
        /// <returns></returns>
        public QueryContext <T> AddParameter(string field, NpgsqlDbType dbType, object value, int size, Type specificType)
        {
            NpgsqlParameter p = this.ParamList.FirstOrDefault(f => f.ParameterName == field);

            if (p != null)
            {
                this.ParamList.Remove(p);
            }
            if ((dbType == NpgsqlDbType.Json || dbType == NpgsqlDbType.Jsonb) && value != null)
            {
                JToken token = value as JToken;
                if (!token.HasValues)
                {
                    value = null;
                }
            }

            p = new NpgsqlParameter(field, dbType);
            if (specificType != null)
            {
                p.SpecificType = specificType;
            }
            if (size != -1)
            {
                p.Size = size;
            }

            p.Value = value;
            ParamList.Add(p);
            return(this);
        }
Пример #2
0
        /// <summary>
        ///  增加一个查询参数
        /// </summary>
        /// <param name="field">数据库字段</param>
        /// <param name="value">字段指定的值</param>
        /// <returns></returns>
        public QueryContext <T> AddParameter(string field, object value)
        {
            NpgsqlParameter p = new NpgsqlParameter(field, value);

            ParamList.Add(p);
            return(this);
        }
Пример #3
0
        /// <summary>
        /// 增加一个查询参数
        /// </summary>
        /// <param name="parameters">输入参数</param>
        /// <returns></returns>
        public QueryContext <T> AddParameter(NpgsqlParameter parameter)
        {
            CheckNotNull.NotNull(parameter, nameof(parameter));

            ParamList.Add(parameter);
            return(this);
        }
Пример #4
0
        /// <summary>
        /// Given a long URL, returns a Bitlink.
        /// </summary>
        /// <param name="accessToken">Access token of the user, obtained via <see cref="AuthorizeAsync"/> or <see cref="GetAccessTokenAsync(string)"/></param>
        /// <param name="url">Long url</param>
        /// <returns>The bitlink url as <see cref="string"/></returns>
        public async Task <string> ShortenUrlAsync(string accessToken, string url)
        {
            string    escapedUrl = Uri.EscapeUriString(url);
            ParamList pList      = new ParamList();

            pList.Add("access_token", accessToken);
            pList.Add("url", escapedUrl);
            pList.Add("format", "txt");

            Uri apiUrl   = new Uri(Constants.HOST + Constants.LINK_SHORT_URL + pList.ToString());
            var response = await client.GetAsync(apiUrl);

            response.EnsureSuccessStatusCode();

            string shortUrl = await response.Content.ReadAsStringAsync();

            return(shortUrl);
        }
Пример #5
0
        private void LoadParam(List <ParamModel> list, int id)
        {
            var rootElement = list.Where(c => c.ParamID == id);

            foreach (var root in rootElement)
            {
                ParamList.Add(new ParamViewModel(root));
            }
        }
Пример #6
0
        /// <summary>
        /// 增加一个查询参数
        /// </summary>
        /// <param name="parameters">输入参数</param>
        /// <returns></returns>
        public QueryContext <T> AddParameter(NpgsqlParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentException("参数不能为空", "parameter");
            }

            ParamList.Add(parameter);
            return(this);
        }
Пример #7
0
        public DelegateMethodCall(Delegate f, params object[] Params)
        {
            if (f.Method.GetParameters().Length < Params.Length)
            {
                throw new ArgumentException("Too many parameters specified for delegate", "f");
            }

            _f = f;
            ParamList.Add(new OrderParameterSetter(Params));
        }
Пример #8
0
        /// <summary>
        ///     将属性变量的右边值,转换成T-SQL的字段值
        /// </summary>
        protected override Expression VisitConstant(ConstantExpression cexp)
        {
            if (cexp == null)
            {
                return(null);
            }

            //  查找组中是否存在已有的参数,有则直接取出
            CurrentDbParameter = DbProvider.CreateDbParam(ParamList.Count + "_" + CurrentFieldName, cexp.Value, cexp.Type);
            ParamList.Add(CurrentDbParameter);
            CurrentFieldName = null;
            return(cexp);
        }
Пример #9
0
        private void SaveSettings()
        {
            ParamList botParams = new ParamList();

            for (int i = 0; i < botList.Count; i++)
            {
                var bot = botList[i];
                botParams.Add(bot.Username, bot.Password, bot.Proxy, bot.Address, bot.Cookie);
            }

            settings.botParams = botParams;
            settings.Save();
        }
Пример #10
0
        public Node ParamList()
        {
            var result = new ParamList();

            if (CurrentToken == TokenCategory.IDENTIFIER)
            {
                result.Add(new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.IDENTIFIER)
                });

                while (CurrentToken == TokenCategory.LIST_ELEMENT)
                {
                    Expect(TokenCategory.LIST_ELEMENT);
                    result.Add(new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.IDENTIFIER)
                    });
                }
            }

            return(result);
        }
Пример #11
0
        /// <summary>
        /// This is used to query for a Bitlink shortened by the authenticated user based on a long URL or a Bitlink. <paramref name="longUrls"/> and <paramref name="shortUrls"/> cannot be set both at the same time
        /// </summary>
        /// <param name="accessToken">Access token of the user, obtained via <see cref="AuthorizeAsync"/> or <see cref="GetAccessTokenAsync(string)"/></param>
        /// <param name="longUrls">Extended urls</param>
        /// <param name="shortUrls">Bitlink urls</param>
        /// <returns>Return a <see cref="UserLinkLookupInfo"/> object, see the <see cref="UserLinkLookupInfo.JsonString"/> for the json string</returns>
        public async Task <UserLinkLookupInfo> LookupUserLinkAsync(string accessToken, string[] longUrls = null, string[] shortUrls = null)
        {
            if ((longUrls == null) && (shortUrls == null))
            {
                throw new ArgumentException("Either longUrls or shortUrls must be set");
            }
            else if ((longUrls != null) && (shortUrls != null))
            {
                throw new ArgumentException("longUrls and shortUrls cannot be different from null at the same time, LookupUserLinkAsync operate either on longUrls or shortUrls");
            }
            else
            {
                List <string> escapedUrls = (longUrls != null) ? EscapeUrls(longUrls) : EscapeUrls(shortUrls);

                ParamList pList = new ParamList();
                pList.Add("access_token", accessToken);

                foreach (string escapedUrl in escapedUrls)
                {
                    pList.Add("url", escapedUrl);
                }

                Uri url      = new Uri(Constants.HOST + Constants.USER_LINK_LOOKUP_URL + pList.ToString());
                var response = await client.GetAsync(url);

                response.EnsureSuccessStatusCode();
                string json = await response.Content.ReadAsStringAsync();

                UserLinkLookupInfo info = JsonConvert.DeserializeObject <UserLinkLookupInfo>(json, new JsonSerializerSettings()
                {
                    MissingMemberHandling = MissingMemberHandling.Ignore
                });
                info.JsonString = json;

                return(info);
            }
        }
Пример #12
0
        /// <summary>
        ///     Contains方法解析
        /// </summary>
        /// <param name="fieldType"></param>
        /// <param name="fieldName"></param>
        /// <param name="paramType"></param>
        /// <param name="paramName"></param>
        protected virtual void VisitMethodContains(MethodCallExpression m, Type fieldType, string fieldName, Type paramType, string paramName)
        {
            // 非List<>形式
            if (paramType != null && !IsGenericOrArray(paramType))
            {
                #region 搜索值串的处理
                var param = ParamList.Find(o => o.ParameterName == paramName);
                if (param != null && Regex.IsMatch(param.Value.ToString(), @"[\d]+") && (Type.GetTypeCode(fieldType) == TypeCode.Int16 || Type.GetTypeCode(fieldType) == TypeCode.Int32 || Type.GetTypeCode(fieldType) == TypeCode.Decimal || Type.GetTypeCode(fieldType) == TypeCode.Double || Type.GetTypeCode(fieldType) == TypeCode.Int64 || Type.GetTypeCode(fieldType) == TypeCode.UInt16 || Type.GetTypeCode(fieldType) == TypeCode.UInt32 || Type.GetTypeCode(fieldType) == TypeCode.UInt64))
                {
                    param.Value  = "," + param.Value + ",";
                    param.DbType = DbType.String;
                    if (DbProvider.KeywordAegis("").Length > 0)
                    {
                        fieldName = "','+" + fieldName.Substring(1, fieldName.Length - 2) + "+','";
                    }
                    else
                    {
                        fieldName = "','+" + fieldName + "+','";
                    }
                }
                #endregion

                // 判断是不是字段调用Contains
                var isFieldCall = m.Object != null && m.Object.NodeType == ExpressionType.MemberAccess && ((MemberExpression)m.Object).Expression != null && ((MemberExpression)m.Object).Expression.NodeType == ExpressionType.Parameter;
                SqlList.Push(isFieldCall ? FunctionProvider.CharIndex(fieldName, paramName, IsNot) : FunctionProvider.CharIndex(paramName, fieldName, IsNot));
            }
            else
            {
                // 删除参数化,后面需要改成多参数
                var paramValue = CurrentDbParameter.Value.ToString();
                ParamList.RemoveAt(ParamList.Count - 1);

                // 参数类型,转换成多参数
                var lstParamName = new List <string>();
                var index        = 0;
                foreach (var val in paramValue.Split(','))
                {
                    var param = DbProvider.CreateDbParam(CurrentDbParameter.ParameterName.Substring(1) + "_" + index++, val, fieldType);
                    lstParamName.Add(param.ParameterName);
                    ParamList.Add(param);
                }

                SqlList.Push(FunctionProvider.In(fieldName, lstParamName, IsNot));
            }
        }
Пример #13
0
        /// <summary>
        /// Get the user's links history
        /// </summary>
        /// <param name="accessToken">Access token of the athenticated user</param>
        /// <param name="link">Bitlink to return metadata for</param>
        /// <param name="limit">Integer in the range 1 to 100, specifying the max number of results to return</param>
        /// <param name="offset">Integer specifying the numbered result at which to start</param>
        /// <param name="createdBefore">Get all the links created before this date</param>
        /// <param name="createdAfter">Get all the links created after this date</param>
        /// <param name="modifiedAfter">Get all the links modified after this date</param>
        /// <returns></returns>
        public async Task <UserLinkHistory> GetUserLinkHistoryAsync(string accessToken, string link = null, int limit = 50, int offset = 0, DateTime?createdBefore = null, DateTime?createdAfter = null, DateTime?modifiedAfter = null)
        {
            ParamList list = new ParamList();

            list.Add("access_token", accessToken);
            if (link != null)
            {
                list.Add("link", Uri.EscapeUriString(link));
            }
            if (createdBefore != null)
            {
                list.Add("created_before", GetEpochFromDateTime(createdBefore).ToString());
            }
            if (createdAfter != null)
            {
                list.Add("created_after", GetEpochFromDateTime(createdAfter).ToString());
            }
            if (modifiedAfter != null)
            {
                list.Add("created_after", GetEpochFromDateTime(modifiedAfter).ToString());
            }

            if (limit < 1 || limit > 100)
            {
                throw new ArgumentException("The limit parameter must be between 1 and 100");
            }

            list.Add("limit", limit.ToString());
            list.Add("offset", offset.ToString());

            Uri url      = new Uri(Constants.HOST + Constants.USER_LINK_HISTORY + list.ToString());
            var response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();

            string json = await response.Content.ReadAsStringAsync();

            UserLinkHistory linkhistory = JsonConvert.DeserializeObject <UserLinkHistory>(json, new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });

            linkhistory.JsonString = json;

            return(linkhistory);
        }
Пример #14
0
        /// <summary>
        /// Retorna parametros por id, id padre, y filtra x vigentes o no vigentes La cultura puede se String.Empty
        /// en cuyo caso no la tendra en cuenta para el filtro
        /// </summary>
        /// <param name="parentId">Relacion con otro param</param>
        /// <param name="enabled">Vigentes o no</param>
        /// <param name="culture">Cultura que se desea consultar: th-TH, en-US, es-AR etc etc</param>
        /// <param name="cnnStringName">Cadena de coneccion</param>
        /// <returns></returns>
        public static ParamList RetriveByParams(int?parentId, bool?enabled, string culture, string cnnStringName)
        {
            ParamList wParamList = new ParamList();
            ParamBE   wParamBE   = null;

            try
            {
                using (Fwk.ConfigData.FwkDatacontext dc = new Fwk.ConfigData.FwkDatacontext(System.Configuration.ConfigurationManager.ConnectionStrings[cnnStringName].ConnectionString))
                {
                    var rulesinCat = from s in dc.fwk_Params where


                                     (!parentId.HasValue || s.ParentId.Equals(parentId))
                                     &&
                                     (!enabled.HasValue || s.Enabled.Equals(enabled)
                                      &&
                                      (string.IsNullOrEmpty(culture) || s.Culture.Equals(culture)))
                                     select s;


                    foreach (Fwk.ConfigData.fwk_Param param_db in rulesinCat.ToList <Fwk.ConfigData.fwk_Param>())
                    {
                        wParamBE             = new ParamBE();
                        wParamBE.ParamId     = param_db.ParamId;
                        wParamBE.ParentId    = param_db.ParentId;
                        wParamBE.Name        = param_db.Name;
                        wParamBE.Description = param_db.Description;
                        wParamBE.Enabled     = param_db.Enabled;
                        wParamBE.Culture     = param_db.Culture;
                        wParamBE.Id          = param_db.Id;

                        wParamList.Add(wParamBE);
                    }
                }


                return(wParamList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static query Delete(string assemblyName, string typeName, string JSON, string TPHType)
        {
            Assembly  asm     = utils.GetAssemblyByName(assemblyName);
            Type      t       = asm.GetType(typeName);
            object    o       = GenerateObject(asm, t, JSON);
            ParamList pl      = new ParamList();
            string    idField = "id";
            int       idVal   = (int)t.GetProperties().ToList().Find(x => x.Name == idField).GetValue(o);

            string table = TPHType == "" ? t.Name : TPHType;

            t.GetProperties().ToList().FindAll(x => x.Name == idField).ForEach(prop => {
                pl.Add(prop.Name, prop.GetValue(o));
            });

            return(new query()
            {
                paramList = pl,
                sql = $"DELETE FROM [{table}] WHERE [{idField}]=@{idField}"
            });
        }
Пример #16
0
        /// <summary>
        ///  Esegue una richiesta HFS con parametri liberi
        ///  </summary>
        ///  <param name="args"></param>
        ///  <returns></returns>
        public byte[] SendParamRequest(params string[] args)
        {
            if (args == null || args.Length == 0 || ((args.Length % 2) != 0))
            {
                throw new ArgumentException("Il metodo accetta solo coppie di tipo chiave/valore");
            }

            ParamList oParams = new ParamList();

            string sKey = string.Empty;

            foreach (string arg in args)
            {
                if (string.IsNullOrEmpty(sKey))
                {
                    sKey = arg;
                }
                else
                {
                    oParams.Add(sKey, arg);
                    sKey = string.Empty;
                }
            }

            // Imposta user e pass se non presenti
            if (!string.IsNullOrEmpty(this.mUser))
            {
                if (!oParams.ContainsKey(FS.PARAM_USER))
                {
                    oParams[FS.PARAM_USER] = this.mUser;
                }
                if (!oParams.ContainsKey(FS.PARAM_PASS))
                {
                    oParams[FS.PARAM_PASS] = this.mPass;
                }
            }

            return(this.sendRequest(oParams));
        }
        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);
            var nodes = treeNode.GetMappedChildNodes();

            Name = AddChild("Name: ", nodes[0]);
            var paramsNodes = nodes[1].GetMappedChildNodes();
            int i           = 0;

            foreach (var param in paramsNodes)
            {
                ParamList.Add(AddChild("Param: " + i, param));
                i++;
            }
            var stmtNodes = nodes[2].GetMappedChildNodes();

            i = 0;
            foreach (var stmt in stmtNodes)
            {
                Stmts.Add(AddChild("Stmt: " + i, stmt));
                i++;
            }
        }
Пример #18
0
        /// <summary>
        /// Saves a long URL as a Bitlink in a user's history, with optional pre-set metadata. (Also returns a short URL for that link.)
        /// </summary>
        /// <param name="accessToken">Access token of the user, obtained via <see cref="AuthorizeAsync"/> or <see cref="GetAccessTokenAsync(string)"/></param>
        /// <param name="longUrl">Long url</param>
        /// <param name="title">Title of the url</param>
        /// <param name="note">Notes for the url</param>
        /// <param name="privat">Set true if private, false if public</param>
        /// <param name="userTimeStamp">Timestamp</param>
        /// <returns></returns>
        public async Task <UserLinkSavedInfo> SaveLinkAsync(string accessToken, string longUrl, string title = null, string note = null, bool?privat = null, DateTime?userTimeStamp = null)
        {
            string escapedUrl = Uri.EscapeUriString(longUrl);

            ParamList pList = new ParamList();

            pList.Add("access_token", accessToken);
            pList.Add("longUrl", longUrl);

            if (title != null)
            {
                pList.Add("title", Uri.EscapeDataString(title));
            }
            if (note != null)
            {
                pList.Add("note", Uri.EscapeDataString(note));
            }
            if (privat != null)
            {
                pList.Add("private", privat.Value.ToString().ToLower());
            }
            if (userTimeStamp != null)
            {
                DateTime?epoch   = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                double   user_ts = Math.Ceiling((userTimeStamp - epoch).Value.TotalSeconds);
                pList.Add("user_ts", user_ts.ToString());
            }

            Uri url      = new Uri(Constants.HOST + Constants.USER_LINK_SAVE_URL + pList.ToString());
            var response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();

            string json = await response.Content.ReadAsStringAsync();

            UserLinkSavedInfo info = JsonConvert.DeserializeObject <UserLinkSavedInfo>(json, new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });

            info.JsonString = json;

            return(info);
        }
Пример #19
0
        /// <summary>
        ///     将属性变量的右边值,转换成T-SQL的字段值
        /// </summary>
        protected override Expression VisitConstant(ConstantExpression cexp)
        {
            base.VisitConstant(cexp);
            if (cexp == null)
            {
                return(null);
            }

            //  查找组中是否存在已有的参数,有则直接取出
            if (CurrentFieldName != null && CurrentField.Value != null && CurrentField.Value.Field.DbType != DbType.Object)
            {
                // 手动指定字段类型
                CurrentDbParameter = DbProvider.CreateDbParam($"p{ParamList.Count}_{CurrentField.Key.Name}", cexp.Value, CurrentField.Value.Field.DbType, false, CurrentField.Value.Field.DbSize);
            }
            else
            {
                CurrentDbParameter = DbProvider.CreateDbParam($"p{ParamList.Count}_{ (CurrentField.Key != null ? CurrentField.Key.Name : CurrentFieldName)}", cexp.Value, cexp.Type, false, CurrentField.Value?.Field.DbSize ?? 0);
            }

            ParamList.Add(CurrentDbParameter);
            SqlList.Push(CurrentDbParameter.ParameterName);
            CurrentFieldName = null;
            return(cexp);
        }
Пример #20
0
 public DynamicMethodCall(object obj, MethodInfo method, IParameterSetter setter)
 {
     _obj    = obj;
     _method = method;
     ParamList.Add(setter);
 }
Пример #21
0
 public DelegateMethodCall(Delegate f, IParameterSetter Params)
 {
     _f = f;
     ParamList.Add(Params);
 }
Пример #22
0
        public ExpressionTree BulidTree(ExpressionTree expressionTree_2, string string_0)
        {
            int            num2;
            int            num3;
            ExpressionTree tree2;
            ExpressionTree tree5;
            string         str2;
            int            num = 0;

            if (!IsFuction(string_0, out num))
            {
                if (string_0[0] != '(')
                {
                    ExpressionTree tree7;
                    int            startIndex = 0;
                    num3 = 0;
                    while (num3 < string_0.Length)
                    {
                        ExpressionTree tree6;
                        if (method_0(string_0[num3]))
                        {
                            tree6 = new ExpressionTree
                            {
                                Tag = string.Format("{0}", string_0[num3])
                            };
                            if (num3 == 0)
                            {
                                str2 = null;
                            }
                            else
                            {
                                str2 = string_0.Substring(startIndex, num3 - startIndex);
                            }
                            tree7 = new ExpressionTree
                            {
                                Tag = str2
                            };
                            foreach (string str3 in str2.Split(new char[] { ',' }))
                            {
                                if (method_3(str3) && !ParamList.ContainsKey(str3))
                                {
                                    ParamList.Add(str3, null);
                                }
                            }
                            if (expressionTree_2 == null)
                            {
                                tree6.LeftTree   = tree7;
                                expressionTree_2 = tree6;
                            }
                            else if (method_2(tree6.Tag, expressionTree_2.Tag) == 1)
                            {
                                expressionTree_2.RightTree = tree6;
                                tree6.LeftTree             = tree7;
                                expressionTree_2           = tree6;
                            }
                            else
                            {
                                expressionTree_2.RightTree = tree7;
                                if (expressionTree_2.Parent != null)
                                {
                                    expressionTree_2.Parent.RightTree = tree6;
                                }
                                tree6.LeftTree   = expressionTree_2;
                                expressionTree_2 = tree6;
                            }
                            break;
                        }
                        if (method_1(string_0[num3]))
                        {
                            char   ch   = string_0[num3];
                            string str4 = ch.ToString();
                            if (method_1(string_0[num3 + 1]))
                            {
                                ch   = string_0[num3 + 1];
                                str4 = str4 + ch.ToString();
                                num3++;
                            }
                            tree6 = new ExpressionTree
                            {
                                Tag = str4
                            };
                            if (num3 == 0)
                            {
                                str2 = "0";
                            }
                            else
                            {
                                str2 = string_0.Substring(startIndex, num3 - startIndex);
                            }
                            tree7 = new ExpressionTree
                            {
                                Tag = str2
                            };
                            foreach (string str3 in str2.Split(new char[] { ',' }))
                            {
                                if (method_3(str3) && !ParamList.ContainsKey(str3))
                                {
                                    ParamList.Add(str3, null);
                                }
                            }
                            if (expressionTree_2 == null)
                            {
                                tree6.LeftTree   = tree7;
                                expressionTree_2 = tree6;
                            }
                            else if (method_2(tree6.Tag, expressionTree_2.Tag) == 1)
                            {
                                expressionTree_2.RightTree = tree6;
                                tree6.LeftTree             = tree7;
                                expressionTree_2           = tree6;
                            }
                            else
                            {
                                expressionTree_2.RightTree = tree7;
                                if (expressionTree_2.Parent != null)
                                {
                                    expressionTree_2.Parent.RightTree = tree6;
                                }
                                tree6.LeftTree   = expressionTree_2;
                                expressionTree_2 = tree6;
                            }
                            break;
                        }
                        num3++;
                    }
                    if (num3 == string_0.Length)
                    {
                        tree7 = new ExpressionTree
                        {
                            Tag = string_0
                        };
                        if (expressionTree_2 == null)
                        {
                            expressionTree_2 = tree7;
                        }
                        else
                        {
                            expressionTree_2.RightTree = tree7;
                        }
                        foreach (string str3 in string_0.Split(new char[] { ',' }))
                        {
                            if (method_3(str3) && !ParamList.ContainsKey(str3))
                            {
                                ParamList.Add(str3, null);
                            }
                        }
                        return(FindRootTree(expressionTree_2));
                    }
                    string str5 = string_0.Substring(num3 + 1);
                    BulidTree(expressionTree_2, str5);
                    goto Label_0695;
                }
                num2  = 1;
                num3  = 0;
                tree2 = null;
                for (num3 = 1; num3 < string_0.Length; num3++)
                {
                    if (string_0[num3] == ')')
                    {
                        num2--;
                        if (num2 != 0)
                        {
                            continue;
                        }
                        string str = string_0.Substring(1, num3 - num - 1);
                        tree2 = BulidTree(null, str);
                        break;
                    }
                    if (string_0[num3] == '(')
                    {
                        num2++;
                    }
                }
            }
            else
            {
                ExpressionTree tree = new ExpressionTree
                {
                    Tag = string_0.Substring(0, num)
                };
                num2 = 1;
                num3 = 0;
                num3 = num + 1;
                while (num3 < string_0.Length)
                {
                    if (string_0[num3] == ')')
                    {
                        num2--;
                        if (num2 != 0)
                        {
                            goto Label_0064;
                        }
                        string[] strArray = string_0.Substring(num + 1, num3 - num - 1).Split(new char[] { ',' });
                        tree2          = BulidTree(null, strArray[0]);
                        tree.RightTree = tree2;
                        if (strArray.Length == 2)
                        {
                            ExpressionTree tree3 = BulidTree(null, strArray[1]);
                            tree.SecondTree = tree3;
                        }
                        break;
                    }
                    if (string_0[num3] == '(')
                    {
                        num2++;
                    }
Label_0064:
                    num3++;
                }
                if (num3 == string_0.Length - 1)
                {
                    if (expressionTree_2 != null)
                    {
                        expressionTree_2.RightTree = tree;
                    }
                    else
                    {
                        expressionTree_2 = tree;
                    }
                    return(FindRootTree(expressionTree_2));
                }
                tree5     = new ExpressionTree();
                tree5.Tag = string_0[num3 + 1].ToString();
                if (expressionTree_2 != null)
                {
                    if (method_2(tree5.Tag, expressionTree_2.Tag) == 1)
                    {
                        expressionTree_2.RightTree = tree5;
                        tree5.LeftTree             = tree;
                        expressionTree_2           = tree5;
                    }
                    else
                    {
                        expressionTree_2.RightTree = tree;
                        if (expressionTree_2.Parent != null)
                        {
                            expressionTree_2.Parent.RightTree = tree5;
                        }
                        tree5.LeftTree   = expressionTree_2;
                        expressionTree_2 = tree5;
                    }
                }
                else
                {
                    tree5.LeftTree   = tree;
                    expressionTree_2 = tree5;
                }
                str2 = string_0.Substring(num3 + 2);
                BulidTree(expressionTree_2, str2);
                goto Label_0695;
            }
            if (num3 == string_0.Length - 1)
            {
                if (expressionTree_2 != null)
                {
                    expressionTree_2.RightTree = tree2;
                }
                else
                {
                    expressionTree_2 = tree2;
                }
                return(FindRootTree(expressionTree_2));
            }
            tree5     = new ExpressionTree();
            tree5.Tag = string_0[num3 + 1].ToString();
            if (expressionTree_2 != null)
            {
                if (method_2(tree5.Tag, expressionTree_2.Tag) == 1)
                {
                    expressionTree_2.RightTree = tree5;
                    tree5.LeftTree             = tree2;
                    expressionTree_2           = tree5;
                }
                else
                {
                    expressionTree_2.RightTree = tree2;
                    if (expressionTree_2.Parent != null)
                    {
                        expressionTree_2.Parent.RightTree = tree5;
                    }
                    tree5.LeftTree   = expressionTree_2;
                    expressionTree_2 = tree5;
                }
            }
            else
            {
                tree5.LeftTree   = tree2;
                expressionTree_2 = tree5;
            }
            str2 = string_0.Substring(num3 + 2);
            BulidTree(expressionTree_2, str2);
Label_0695:
            return(FindRootTree(expressionTree_2));
        }
Пример #23
0
        /// <summary>
        /// Edit information about a link
        /// </summary>
        /// <param name="accessToken">Access token of the user, obtained via <see cref="AuthorizeAsync"/> or <see cref="GetAccessTokenAsync(string)"/></param>
        /// <param name="link">Short Url (Bitlink) to edit</param>
        /// <param name="title">The title of your bitlink</param>
        /// <param name="note">Notes</param>
        /// <param name="privat"><code>true</code> if you want the bitlink to be private or <code>false</code> to be public</param>
        /// <param name="userTimeStamp">Change the timestamp</param>
        /// <param name="archived"><code>true</code> if you want the bitlink to be archived false otherwise</param>
        /// <returns></returns>
        public async Task <LinkEditResponseInfo> EditLinkAsync(string accessToken, string link, string title = null, string note = null, bool?privat = null, DateTime?userTimeStamp = null, bool?archived = null)
        {
            string escapedLink = Uri.EscapeUriString(link);

            ParamList pList = new ParamList();

            pList.Add("access_token", accessToken);
            pList.Add("link", escapedLink);
            StringBuilder edit = new StringBuilder();

            if (title != null)
            {
                pList.Add("title", Uri.EscapeDataString(title));
                edit.Append("title,");
            }
            if (note != null)
            {
                pList.Add("note", Uri.EscapeDataString(note));
                edit.Append("note,");
            }

            if (privat != null)
            {
                pList.Add("private", privat.Value.ToString().ToLower());
                edit.Append("private,");
            }

            if (userTimeStamp != null)
            {
                DateTime?epoch   = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                double   user_ts = Math.Ceiling((userTimeStamp - epoch).Value.TotalSeconds);
                pList.Add("user_ts", user_ts.ToString());
                edit.Append("user_ts,");
            }

            if (archived != null)
            {
                pList.Add("archived", archived.Value.ToString().ToLower());
                edit.Append("archived,");
            }

            if (edit.Length != 0)
            {
                edit.Length--;
                pList.Add("edit", edit.ToString());
            }

            Uri url      = new Uri(Constants.HOST + Constants.USER_LINK_EDIT_URL + pList.ToString());
            var response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();

            string json = await response.Content.ReadAsStringAsync();

            LinkEditResponseInfo info = JsonConvert.DeserializeObject <LinkEditResponseInfo>(json, new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });

            info.JsonString = json;

            return(info);
        }
Пример #24
0
 public void AddParam(DataFilterParam param)
 {
     ParamList.Add(param);
 }
Пример #25
0
        /// <summary>
        /// Retorna parametros por id, id padre, y filtra x vigentes o no vigentes La cultura puede se String.Empty
        /// en cuyo caso no la tendra en cuenta para el filtro
        /// </summary>
        /// <param name="parentId">Relacion con otro param</param>
        /// <param name="enabled">Vigentes o no</param>
        /// <param name="culture">Cultura que se desea consultar: th-TH, en-US, es-AR etc etc</param>
        /// <param name="cnnStringName">Cadena de coneccion</param>
        /// <returns></returns>
        public static ParamList RetriveByParams(int? parentId, bool? enabled,string culture, string cnnStringName)
        {


            ParamList wParamList = new ParamList();
            ParamBE wParamBE = null;
            try
            {
                using (Fwk.ConfigData.FwkDatacontext dc = new Fwk.ConfigData.FwkDatacontext(System.Configuration.ConfigurationManager.ConnectionStrings[cnnStringName].ConnectionString))
                {
                    var rulesinCat = from s in dc.fwk_Params where 
                                        
                                        
                                           (!parentId.HasValue || s.ParentId.Equals(parentId))
                                        &&
                                           (!enabled.HasValue || s.Enabled.Equals(enabled)
                                             &&
                                           (string.IsNullOrEmpty(culture) || s.Culture.Equals(culture)))
                                     select s;


                    foreach (Fwk.ConfigData.fwk_Param param_db in rulesinCat.ToList<Fwk.ConfigData.fwk_Param>())
                    {
                        wParamBE = new ParamBE();
                        wParamBE.ParamId = param_db.ParamId;
                        wParamBE.ParentId = param_db.ParentId;
                        wParamBE.Name = param_db.Name;
                        wParamBE.Description = param_db.Description;
                        wParamBE.Enabled = param_db.Enabled;
                        wParamBE.Culture = param_db.Culture;
                        wParamBE.Id = param_db.Id;

                        wParamList.Add(wParamBE);
                    }
                }


                return wParamList;


            }
            catch (Exception ex)
            {
                throw ex;
            }

           
        }
Пример #26
0
 public void AddParameter(FunctionParameter param)
 {
     ParamList.Add(param);
 }