Example #1
0
        /// <summary>
        /// Get user details based on ownerid being passed.
        /// </summary>
        /// <param name="salesForceResponse"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task <UserFields> GetUserAsync(SalesForceResponse salesForceResponse, string userId) //UserID = OwnerID
        {
            LoggerService.Debug("Entered GetUserAsync()", "INFO");
            string query    = "Select usr.Email,usr.Username, usr.Name From User usr where usr.Id = '" + userId + "'";
            string queryURL = salesForceResponse.instance_url + "/services/data/v24.0/query/?q=" + query;


            UserFields userFields = new UserFields();

            using (HttpClient httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Add("Authorization", "OAuth " + salesForceResponse.access_token);
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                httpResponseMessage = await httpClient.GetAsync(queryURL);
            }

            if (httpResponseMessage != null && httpResponseMessage.IsSuccessStatusCode)
            {
                var AccContent = await httpResponseMessage.Content.ReadAsStringAsync();

                usr.UserDetails accResult = (usr.UserDetails)javaScriptSerializer.Deserialize(AccContent, typeof(usr.UserDetails));
                if (accResult != null && accResult.records.Count > 0)
                {
                    userFields.Name     = accResult.records[0].Name;
                    userFields.Username = accResult.records[0].Username;
                    userFields.Email    = accResult.records[0].Email;
                }
            }
            LoggerService.Debug("Leaving GetUserAsync()", "INFO");
            return(userFields);
        }
Example #2
0
        static DocumentFactory()
        {
            addTextField(nameof(KeywordDefinitions.Keywords), nameof(Card.Text));

            addTextField(nameof(Card.Number));

            addTextField(nameof(Card.NameEn), nameof(Card.Name));
            addTextField(nameof(Card.TypeEn), nameof(Card.Type));
            addTextField(nameof(Card.TextEn), nameof(Card.Text));
            addTextField(nameof(Card.FlavorEn), nameof(Card.Flavor));

            addTextField(nameof(Card.Color));

            addTextField(nameof(Card.SetName));
            addTextField(nameof(Card.SetCode));
            addTextField(nameof(Card.Artist));

            addTextField(nameof(Card.OriginalText), nameof(Card.Text));
            addTextField(nameof(Card.OriginalType), nameof(Card.Type));

            addTextField(nameof(Card.Supertypes), nameof(Card.Type));
            addTextField(nameof(Card.Types), nameof(Card.Type));
            addTextField(nameof(Card.Subtypes), nameof(Card.Type));

            addTextField(nameof(Card.LegalIn), nameof(Card.Rulings));
            addTextField(nameof(Card.RestrictedIn), nameof(Card.Rulings));
            addTextField(nameof(Card.BannedIn), nameof(Card.Rulings));

            addTextField(nameof(Card.Power));
            addTextField(nameof(Card.Toughness));
            addTextField(nameof(Card.Loyalty));
            addTextField(nameof(Card.ReleaseDate));
            addTextField(nameof(Card.Layout));

            addTextField(nameof(Card.GeneratedMana), nameof(Card.Text));
            addTextField(nameof(Card.ManaCost));
            addTextField(nameof(Card.Rarity));

            addFloatField(nameof(Card.PowerNum), nameof(Card.Power));
            addFloatField(nameof(Card.ToughnessNum), nameof(Card.Toughness));
            addIntField(nameof(Card.LoyaltyNum), nameof(Card.Loyalty));

            addIntField(nameof(Card.Hand));
            addIntField(nameof(Card.Life));

            addFloatField(nameof(Card.Cmc));
            addFloatField(nameof(Card.PricingLow));
            addFloatField(nameof(Card.PricingMid));
            addFloatField(nameof(Card.PricingHigh));

            foreach (var lang in Languages)
            {
                addSpecificTextField(nameof(Card.Name), lang);
                addSpecificTextField(nameof(Card.Type), lang);
                addSpecificTextField(nameof(Card.Text), lang);
                addSpecificTextField(nameof(Card.Flavor), lang);
            }

            UserFields.Add(CardQueryParser.Like);
        }
        public ActionResult EditForm(UserFields uf)
        {
            var reg = new System.Text.RegularExpressions.Regex(@"[\u4e00-\u9fa5]");

            if (reg.IsMatch(uf.UfName) && uf.UfName != null)
            {
                int a = userFieldsBll.Update(uf);

                new LogMessage().Save("ID:" + uf.UfId + "。");

                if (a > 0)
                {
                    return(JavaScript("editFormSucceed();"));
                }
                else
                {
                    ModelState.AddModelError("", "修改失败");
                    return(JavaScript("editFormError();"));
                }
            }
            else
            {
                ModelState.AddModelError("", "修改失败");
                return(JavaScript("editFormError('用户字段只能输入汉字类型且不能为空');"));
            }
        }
        public ActionResult FieldForm(UserFields uf)
        {
            UserInfo user = new UserInfo();

            user      = (UserInfo)Session["LoginUser"];
            uf.DeptId = user.EnterId;
            uf.UfId   = System.Guid.NewGuid().ToString();
            var reg = new System.Text.RegularExpressions.Regex(@"[\u4e00-\u9fa5]");

            if (reg.IsMatch(uf.UfName) && uf.UfName != null)
            {
                int k = userFieldsBll.Insert(uf);

                new LogMessage().Save("ID:" + uf.UfId + ",添加成功。");

                if (k == 0)
                {
                    ModelState.AddModelError("", "添加成功");
                    return(JavaScript("submitFormSucceed();"));
                }
                else
                {
                    ModelState.AddModelError("", "添加失败");
                    return(JavaScript("editFormError();"));
                }
            }
            else
            {
                ModelState.AddModelError("", "添加失败");
                return(JavaScript("editFormError('用户字段只能输入汉字类型且不能为空');"));
            }
        }
Example #5
0
    public static string UserFieldModel(User user)
    {
        UserFields fields = new UserFields
        {
            email = new Email {
                stringValue = user.email
            },
            local_id = new LocalId {
                stringValue = user.local_id
            },
            phone_no = new PhoneNo {
                stringValue = user.local_id
            },
            username = new Username {
                stringValue = user.username
            },
            wallet_balance = new WalletBalance {
                doubleValue = user.wallet_balance
            }
        };

        UserRootObject rootObject = new UserRootObject
        {
            fields = fields
        };

        fsData data;

        serializer.TrySerialize(typeof(UserRootObject), rootObject, out data).AssertSuccessWithoutWarnings();

        string post_data = data.ToString();

        return(post_data);
    }
Example #6
0
        public int Update(UserFields entity)
        {
            int n = _iUserFieldsDao.Update(entity);

            this.UpdateCache(entity.DeptId);

            return(n);
        }
Example #7
0
        /// <summary>
        /// Gets friends for the specified user.
        /// </summary>
        /// <param name="userId">User id to get friends for.</param>
        /// <param name="fields">Bitmask of fields to get.</param>
        /// <returns>List of users.</returns>
        public List <User> GetFriends(uint userId, UserFields fields)
        {
            var request = new Request("friends.get");

            request.Parameters.Add("uid", userId.ToString());
            request.Parameters.Add("fields", GetFields(fields));
            return(Api.Call <UserListResponse>(request).Users);
        }
Example #8
0
        /// <summary>
        /// Gets list of users.
        /// </summary>
        /// <param name="userIds">Identificator of user.</param>
        /// <param name="fields">Bitmask of fields to get.</param>
        /// <returns>User object.</returns>
        public List <User> GetList(uint[] userIds, UserFields fields)
        {
            var request = new Request("getProfiles");

            request.Parameters.Add("uids", string.Join(",", userIds));
            request.Parameters.Add("fields", GetFields(fields));
            return(Api.Call <UserListResponse>(request).Users);
        }
Example #9
0
        /// <summary>
        /// Gets user by id.
        /// </summary>
        /// <param name="userId">Identificator of user.</param>
        /// <param name="fields">Bitmask of fields to get.</param>
        /// <returns>User object.</returns>
        public User GetSingle(uint userId, UserFields fields)
        {
            var request = new Request("getProfiles");

            request.Parameters.Add("uids", userId.ToString());
            request.Parameters.Add("fields", GetFields(fields));
            return(Api.Call <User>(request));
        }
Example #10
0
        //public IList<UserFields> GetUserFieldsList(object o)
        //{
        //return _iUserFieldsDao.GetUserFieldsList(o);
        //}

        public int Insert(UserFields entity)
        {
            int n = Convert.ToInt32(_iUserFieldsDao.Insert(entity));

            this.UpdateCache(entity.DeptId);

            return(n);
        }
Example #11
0
        private static void addTextField(string userField, string displayField = null)
        {
            _textFields.Add(userField);
            UserFields.Add(userField);

            if (displayField != null)
            {
                DisplayFieldByIndexField.Add(userField, displayField);
            }
        }
Example #12
0
        private static void addIntField(string userField, string displayFieldName = null)
        {
            UserFields.Add(userField);
            IntFields.Add(userField);

            if (displayFieldName != null)
            {
                DisplayFieldByIndexField.Add(userField, displayFieldName);
            }
        }
Example #13
0
        public static string[] GetUserFields(UserFields fields)
        {
            var s = Enum.GetValues(typeof(UserFields))
                    .OfType <UserFields>()
                    .Where(a => a != UserFields.Everything && a != UserFields.None)
                    .Where(a => (fields & a) == a)
                    .Select(a => a.ToNCString().ToSnake())
                    .ToArray();

            return(s);
        }
Example #14
0
        public async Task LoadUsers(int start, int end, int threads,
                                    string downloadDir, UserFields fields, int volumeSize = 1000,
                                    Action <long> showCount       = null, Action <long> showTraffic = null,
                                    Func <bool> cancellationToken = null)
        {
            bool sCe = showCount != null, sTe = showTraffic != null, cTe = cancellationToken != null;
            long trafficUsed = 0, usersLoaded = 0;
            var  current   = start;
            var  semaphore = new SemaphoreSlim(threads);

            Func <int, Task> getChunk = async i =>
            {
                try {
                    var users = Enumerable.Range(i, Math.Min(volumeSize, end - i)).Select(a => (uint)a).ToArray();
                    if (cTe && cancellationToken())
                    {
                        return;
                    }
                    var outfile = Path.Combine(downloadDir, String.Format("{0}_{1}.xml", users.First(), users.Length));
                    if (!File.Exists(outfile))
                    {
                        var resp = await _api.UsersGetAsync(fields, NameCase.Nom, users);

                        if (resp == null)
                        {
                            return;
                        }
                        File.WriteAllText(outfile, resp);
                        usersLoaded += volumeSize;
                        trafficUsed += _textEncoding.GetByteCount(resp);
                        if (sTe)
                        {
                            showTraffic(trafficUsed);
                        }
                        if (sCe)
                        {
                            showCount(usersLoaded);
                        }
                    }
                }
                catch {}
                finally {
                    semaphore.Release();
                }
            };

            while (current < end)
            {
                await semaphore.WaitAsync();

                getChunk(current);
                current += volumeSize;
            }
        }
        public ActionResult AddCar(string Businessdivisionid)
        {
            UserFields uf   = new UserFields();
            UserInfo   user = new UserInfo();

            user           = (UserInfo)Session["LoginUser"];
            uf.DeptId      = user.EnterId;
            ViewBag.DeptId = Businessdivisionid;
            IList <UserFields> iuf = userFieldsBll.GetUserFieldsPage(uf);

            return(View(iuf));
        }
Example #16
0
        public string ExpFieldBuilder(UserFields field)
        {
            switch (field)
            {
            case UserFields.Forename:
            case UserFields.Surname:
                return("[" + field.ToString() + " (0)]");

            default:
                return("[" + field.ToString() + "]");
            }
        }
        public ActionResult CarInfoIndex()
        {
            new LogMessage().Save("加载车辆信息列表;");

            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            UserFields uf = new UserFields();

            uf.DeptId = user.EnterId;

            IList <UserFields> iuf = userFieldsBll.GetUserFieldsPage(uf);

            ArrayList arr = new ArrayList();

            for (int i = 0; i < iuf.Count; i++)
            {
                arr.Add(iuf[i].UfName.ToUpper());
            }

            IList <MenuInfo> imi = (IList <MenuInfo>)Session["Right"];

            ViewBag.AddCar  = "false";
            ViewBag.EditCar = "false";
            ViewBag.DelCar  = "false";
            ViewBag.XSZ     = "false";
            ViewBag.DeptId  = user.EnterId;
            for (int i = 0; i < imi.Count; i++)
            {
                switch (imi[i].MenuName)
                {
                case "添加车辆":
                    ViewBag.AddCar = "true";
                    break;

                case "删除车辆":
                    ViewBag.DelCar = "true";
                    break;

                case "修改车辆":
                    ViewBag.EditCar = "true";
                    break;

                case "添加行驶证信息":
                    ViewBag.XSZ = "true";
                    break;
                }
            }

            return(View(arr));
        }
        public override void Format(TextWriter writer, LoggingEvent loggingEvent)
        {
            using (var jw = new JsonTextWriter(writer))
            {
                jw.WriteStartObject();
                jw.WritePropertyName("@version");
                jw.WriteValue(1);
                jw.WritePropertyName("@timestamp");
                jw.WriteValue(loggingEvent.TimeStamp.ToUniversalTime().ToString("o"));

                jw.WritePropertyName("source_host");
                jw.WriteValue(System.Environment.MachineName);

                jw.WritePropertyName("message");
                jw.WriteValue(loggingEvent.RenderedMessage);

                jw.WritePropertyName("logger_name");
                jw.WriteValue(loggingEvent.LoggerName);

                jw.WritePropertyName("level");
                jw.WriteValue(loggingEvent.Level.ToString());

                jw.WritePropertyName("thread_name");
                jw.WriteValue(loggingEvent.ThreadName);

                if (!String.IsNullOrWhiteSpace(UserFields))
                {
                    var fields = UserFields.Split(',');
                    foreach (var field in fields)
                    {
                        var keyVal = field.Split(':');
                        if (keyVal.Length == 2)
                        {
                            jw.WritePropertyName(keyVal[0].Trim());
                            jw.WriteValue(keyVal[1].Trim());
                        }
                    }
                }

                if (AddSequence)
                {
                    System.Threading.Interlocked.CompareExchange(ref _sequence, 0, int.MaxValue);

                    jw.WritePropertyName("sequence");
                    jw.WriteValue(System.Threading.Interlocked.Increment(ref _sequence));
                }


                jw.WriteEndObject();
            }
        }
        public string GetFields(UserFields uf, int rows, int page)
        {
            UserInfo user = new UserInfo();

            user         = (UserInfo)Session["LoginUser"];
            uf.DeptId    = user.EnterId;
            uf.StartData = (page - 1) * rows + 1;
            uf.EndData   = uf.StartData + rows;
            IList <UserFields> iuf = userFieldsBll.GetUserFieldsPage(uf);
            int    a    = userFieldsBll.GetUserFieldsCount(uf);
            string json = ConvertToJson(iuf, a);

            return(json);
        }
Example #20
0
        public DataTable GetFiledsInfo(string CarId, string TerNo, string InfoType)
        {
            UserInfo  user = new UserInfo();
            DataTable dt   = new DataTable();

            user = (UserInfo)Session["LoginUser"];
            if (user != null)
            {
                StringBuilder sb = new StringBuilder();
                UserFields    uf = new UserFields();
                uf.DeptId   = user.EnterId;
                uf.InfoType = InfoType;
                IList <UserFields> iuf = userFieldsBll.GetUserFieldsPage(uf);
                if (iuf.Count > 0)
                {
                    sb.Append("select ");
                    for (int i = 0; i < iuf.Count; i++)
                    {
                        if (i < (iuf.Count - 1))
                        {
                            sb.Append("tt." + iuf[i].UfName + ",");
                        }
                        else
                        {
                            sb.Append("tt." + iuf[i].UfName);
                        }
                    }
                    sb.Append(" from Car_Info ci join dept_info di on ci.businessdivisionid=di.businessdivisionid left join terminal_info ti on ci.car_id=ti.car_id left join");
                    sb.Append(" (SELECT CAR_ID,");
                    for (int i = 0; i < iuf.Count; i++)
                    {
                        if (i < (iuf.Count - 1))
                        {
                            sb.Append(string.Format("max(CASE UF_ID WHEN '{0}' THEN FIELD_VALUE ELSE '' END) as {1},", iuf[i].UfId, iuf[i].UfName));
                        }
                        else
                        {
                            sb.Append(string.Format("max(CASE UF_ID WHEN '{0}' THEN FIELD_VALUE ELSE '' END) as {1} ", iuf[i].UfId, iuf[i].UfName));
                        }
                    }
                    sb.Append(" FROM field_values GROUP BY CAR_ID) tt on ci.car_id=tt.car_id where 1=1");
                    sb.Append(string.Format(" and ci.car_id='{0}'", CarId));
                    sb.Append(string.Format(" and ti.TER_NO='{0}'", TerNo));

                    DataSet ds = c.GetColligateQuery("ColligateQuery.ProteanQuery", sb.ToString());
                    dt = ds.Tables[0];
                }
            }
            return(dt);
        }
        public void Sort(UserFields sortField, bool isAscending)
        {
            switch (sortField)
            {
            case UserFields.Name:
                base.Sort(new NameComparer());
                break;

            case UserFields.RoleName:
                base.Sort(new RoleNameComparer());
                break;
            }
            if (!isAscending)
            {
                base.Reverse();
            }
        }
Example #22
0
        public ActionResult BindIndex()
        {
            UserInfo user = new UserInfo();

            user = (UserInfo)Session["LoginUser"];
            UserFields uf = new UserFields();

            uf.DeptId = user.EnterId;
            IList <UserFields> iuf = userFieldsBll.GetUserFieldsPage(uf);
            ArrayList          arr = new ArrayList();

            for (int i = 0; i < iuf.Count; i++)
            {
                arr.Add(iuf[i].UfName.ToUpper());
            }
            return(View(arr));
        }
Example #23
0
        private static void addSpecificTextField(string userField, string language)
        {
            if (language == null)
            {
                throw new ArgumentNullException(nameof(language));
            }

            UserFields.Add(userField);
            LocalizedFields.Add(userField);

            userField = userField.ToLowerInvariant();

            var localized = GetLocalizedField(userField, language);

            _textFields.Add(localized);

            DisplayFieldByIndexField.Add(localized, userField);
        }
        /// <summary>
        /// appends parameters for Tweet request
        /// </summary>
        /// <param name="parameters">list of parameters from expression tree</param>
        /// <param name="url">base url</param>
        /// <returns>base url + parameters</returns>
        void BuildUrlParameters(Dictionary <string, string> parameters, IList <QueryParameter> urlParams)
        {
            if (parameters.ContainsKey(nameof(Expansions)))
            {
                Expansions = parameters[nameof(Expansions)];
                urlParams.Add(new QueryParameter("expansions", Expansions.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(MediaFields)))
            {
                MediaFields = parameters[nameof(MediaFields)];
                urlParams.Add(new QueryParameter("media.fields", MediaFields.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(PlaceFields)))
            {
                PlaceFields = parameters[nameof(PlaceFields)];
                urlParams.Add(new QueryParameter("place.fields", PlaceFields.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(PollFields)))
            {
                PollFields = parameters[nameof(PollFields)];
                urlParams.Add(new QueryParameter("poll.fields", PollFields.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(TweetFields)))
            {
                TweetFields = parameters[nameof(TweetFields)];
                urlParams.Add(new QueryParameter("tweet.fields", TweetFields.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(UserFields)))
            {
                UserFields = parameters[nameof(UserFields)];
                urlParams.Add(new QueryParameter("user.fields", UserFields.Replace(" ", "")));
            }

            if (parameters.ContainsKey(nameof(Ids)))
            {
                Ids = parameters[nameof(Ids)];
                urlParams.Add(new QueryParameter("ids", Ids.Replace(" ", "")));
            }
        }
Example #25
0
        public int GetLength(UserFields field)
        {
            int    len            = 0;
            string defaultItem    = ExpFieldBuilder(field);
            string fieldStartName = defaultItem.Substring(0, defaultItem.Length - 3);

            int noStart    = defaultItem.Length - 3;
            int fieldStart = _expression.IndexOf(fieldStartName, 0);

            if (fieldStart < 0)
            {
                return(len);
            }

            string lenStr = _expression.Substring((fieldStart + noStart), 1);

            Int32.TryParse(lenStr, out len);

            return(len);
        }
        public void Sort(UserFields sortField, bool isAscending)
        {
            switch (sortField)
            {
            case UserFields.Username:
                InnerList.Sort(new UsernameComparer());
                break;

            case UserFields.DisplayName:
                InnerList.Sort(new DisplayNameComparer());
                break;

            case UserFields.RoleName:
                InnerList.Sort(new RoleNameComparer());
                break;
            }
            if (!isAscending)
            {
                InnerList.Reverse();
            }
        }
Example #27
0
        private IList <UserFields> UpdateCache(string DeptId)
        {
            List <UserFields> uf_list = new List <UserFields>();

            string sql = @" select f.uf_id, f.dept_id, f.uf_name, f.uf_desc, f.field_type, f.info_type
                              from dept_info d, user_fields f
                             where f.dept_id = d.businessdivisionid
                               and f.dept_id = '" + DeptId + @"'
                             order by f.uf_name
                            ";

            System.Data.DataSet ds = query.GetColligateQuery("ColligateQuery.ProteanQuery", sql);

            if (ds != null &&
                ds.Tables.Count > 0 &&
                ds.Tables[0].Rows.Count > 0)
            {
                foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
                {
                    UserFields tmp = new UserFields();

                    tmp.DeptId   = dr["dept_id"].ToString();
                    tmp.InfoType = dr["info_type"].ToString();
                    tmp.UfDesc   = dr["uf_desc"].ToString();
                    tmp.UfId     = dr["uf_id"].ToString();
                    tmp.UfName   = dr["uf_name"].ToString();

                    tmp.FieldType = dr["field_type"].ToString();

                    uf_list.Add(tmp);
                }
            }

            string cache_name = "CurUserFieldsList_" + DeptId;

            CacheHelper.Remove(cache_name);
            CacheHelper.Insert(cache_name, uf_list, 365 * 24 * 60);

            return(uf_list);
        }
Example #28
0
 public UsersSearchParams(string query      = "", SearchSortOrder sort  = SearchSortOrder.ByRating,
                          ushort?offset     = null, ushort?count        = null, UserFields fields = UserFields.None,
                          uint?cityId       = null, uint?countryId      = null, string hometown   = "", uint?universityCountryId = null,
                          uint?universityId = null, uint?universityYear = null, Sex?sex           = null, Relation?relation      = null,
                          byte?ageFrom      = null, byte?ageTo    = null, byte?birthDay           = null, byte?birthMonth        = null,
                          ushort?birthYear  = null, bool?online   = null, bool?hasPhoto           = null, uint?schoolCountryId   = null,
                          uint?schoolCityId = null, uint?schoolId = null, uint?schoolYear         = null, string religion        = "",
                          string interests  = "", string company  = "", string position           = "", uint?groupId             = null)
 {
     Query               = query;
     Sort                = sort;
     Offset              = offset;
     Count               = count;
     Fields              = fields;
     CityId              = cityId;
     CountryId           = countryId;
     Hometown            = hometown;
     UniversityCountryId = universityCountryId;
     UniversityId        = universityId;
     UniversityYear      = universityYear;
     Sex             = sex;
     Relation        = relation;
     AgeFrom         = ageFrom;
     AgeTo           = ageTo;
     BirthDay        = birthDay;
     BirthMonth      = birthMonth;
     BirthYear       = birthYear;
     Online          = online;
     HasPhoto        = hasPhoto;
     SchoolCountryId = schoolCountryId;
     SchoolCityId    = schoolCityId;
     SchoolId        = schoolId;
     SchoolYear      = schoolYear;
     Religion        = religion;
     Interests       = interests;
     Company         = company;
     Position        = position;
     GroupId         = groupId;
 }
Example #29
0
 public UsersSearchParams( string query = "", SearchSortOrder sort = SearchSortOrder.ByRating,
                           ushort? offset = null, ushort? count = null, UserFields fields = UserFields.None,
                           uint? cityId = null, uint? countryId = null, string hometown = "", uint? universityCountryId = null,
                           uint? universityId = null, uint? universityYear = null, Sex? sex = null, Relation? relation = null,
                           byte? ageFrom = null, byte? ageTo = null, byte? birthDay = null, byte? birthMonth = null,
                           ushort? birthYear = null, bool? online = null, bool? hasPhoto = null, uint? schoolCountryId = null,
                           uint? schoolCityId = null, uint? schoolId = null, uint? schoolYear = null, string religion = "",
                           string interests = "", string company = "", string position = "", uint? groupId = null ) {
     Query = query;
     Sort = sort;
     Offset = offset;
     Count = count;
     Fields = fields;
     CityId = cityId;
     CountryId = countryId;
     Hometown = hometown;
     UniversityCountryId = universityCountryId;
     UniversityId = universityId;
     UniversityYear = universityYear;
     Sex = sex;
     Relation = relation;
     AgeFrom = ageFrom;
     AgeTo = ageTo;
     BirthDay = birthDay;
     BirthMonth = birthMonth;
     BirthYear = birthYear;
     Online = online;
     HasPhoto = hasPhoto;
     SchoolCountryId = schoolCountryId;
     SchoolCityId = schoolCityId;
     SchoolId = schoolId;
     SchoolYear = schoolYear;
     Religion = religion;
     Interests = interests;
     Company = company;
     Position = position;
     GroupId = groupId;
 }
Example #30
0
        /// <summary>
        /// This example will show you how to add a new account with custom fields attached.
        /// </summary>
        /// <param name="orgCode">The organization code of the account you wish to add.</param>
        /// <param name="newAccountName">This is the the name of the new account.</param>
        /// <param name="issueClass">This is the code that represents the Issue Class of the custom fields.</param>
        /// <param name="issueType">This is the code that represents the Issue Type of the custom fields</param>
        /// <param name="newTxt01Value">In this example, we are changing Text_01.  Enter a new value here to set this.</param>
        public AllAccountsModel AddWithUserFields(string orgCode, string newAccountName, string issueClass, string issueType, string newTxt01Value)
        {
            var myAccount = new AllAccountsModel
            {
                Organization         = orgCode,
                Name                 = newAccountName,
                EventSalesStatus     = "A",                                  //Use your configured Status codes to set the account designation status property
                Class                = USISDKConstants.AccountClass.Account, //The class determines if this is an Account or a Contact
                AccountUserFieldSets = new List <UserFields>()
            };

            //Here's how to add a user field set with values to a new account
            var myUserField = new UserFields
            {
                Header     = USISDKConstants.UserFieldHeaders.OrganizationAccountUserFields, //Designate if this is an organization account user field set, an individual account user field set, or a membership user field set
                Class      = issueClass,                                                     //Set the designation of the user field.  You can use the USISDKConstants.AccountDesignations class to set this.
                Type       = issueType,                                                      //Use the Opportunity Type code from your user field.  This matches the value stored in Ungerboeck table column CR073_ISSUE_TYPE.
                UserText01 = newTxt01Value                                                   //Set the value in the user field property
            };

            myAccount.AccountUserFieldSets.Add(myUserField); //Then add it back into the AllAccountsModel object.  You can add multiple user field sets to the same account object before saving.

            return(APIUtil.AddAccount(USISDKClient, myAccount));
        }
Example #31
0
		public VKRequest<User> UsersGet(
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			params uint[] userIds 
			){
			var req = new VKRequest<User>{
				MethodName = "users.get",
				Parameters = new Dictionary<string, string> {
					{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "name_case", nameCase.ToNClString() },
			{ "user_ids", (userIds??new uint[]{}).ToNCStringA() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
Example #32
0
 public async Task <EntityList<User>> GetSuggestions(
     FriendSuggestionFilters filters = FriendSuggestionFilters.Everything, UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Friends.GetSuggestions(
                 filters,fields,nameCase,offset, count
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #33
0
 public User[] GetByPhonesSync(
     UserFields fields = UserFields.None, params ulong[] phones 
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Friends.GetByPhones(
                 fields,phones
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #34
0
		public async Task<EntityList<User>> UsersGetFollowersAsync(
			 uint? userId = null,
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			return (await Executor.ExecAsync(
				_reqapi.UsersGetFollowers(
											userId,
											fields,
											nameCase,
											offset,
											count
									)
			)).Data.FirstOrDefault();
		}
Example #35
0
 public EntityList<User> GetSuggestionsSync(
     FriendSuggestionFilters filters = FriendSuggestionFilters.Everything, UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Friends.GetSuggestions(
                 filters,fields,nameCase,offset, count
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #36
0
 /// <summary>
 /// Gets User object for current user.
 /// </summary>
 /// <param name="fields">Bitmask of fields to get.</param>
 /// <returns>User object.</returns>
 public User GetCurrent(UserFields fields)
 {
     return this.GetSingle(this.Api.UserId, fields);
 }
Example #37
0
		public VKRequest<User> FriendsGetByPhones(
			 UserFields fields = UserFields.None,
			 ulong[] phones = null
			){
			var req = new VKRequest<User>{
				MethodName = "friends.getByPhones",
				Parameters = new Dictionary<string, string> {
					{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "phones", String.Join( ",", phones.Select( a => "+" + a ) ) }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
Example #38
0
 /// <summary>
 /// Gets friends for the specified user.
 /// </summary>
 /// <param name="userId">User id to get friends for.</param>
 /// <param name="fields">Bitmask of fields to get.</param>
 /// <returns>List of users.</returns>
 public List<User> GetFriends(uint userId, UserFields fields)
 {
     var request = new Request("friends.get");
     request.Parameters.Add("uid", userId.ToString());
     request.Parameters.Add("fields", GetFields(fields));
     return Api.Call<UserListResponse>(request).Users;
 }
Example #39
0
 /// <summary>
 /// Gets list of users.
 /// </summary>
 /// <param name="userIds">Identificator of user.</param>
 /// <param name="fields">Bitmask of fields to get.</param>
 /// <returns>User object.</returns>
 public List<User> GetList(uint[] userIds, UserFields fields)
 {
     var request = new Request("getProfiles");
     request.Parameters.Add("uids", string.Join(",", userIds));
     request.Parameters.Add("fields", GetFields(fields));
     return Api.Call<UserListResponse>(request).Users;
 }
Example #40
0
     ///<summary>
     ///        Возвращает список пользователей в соответствии с заданным критерием поиска
     ///      
     ///</summary>
     ///<param name="q">строка поискового запроса</param>
     ///<param name="sort">порядок сортировки</param>
     ///<param name="fields">список дополнительных полей профилей, которые необходимо вернуть</param>
     ///<param name="city">идентификатор города</param>
     ///<param name="country">идентификатор страны</param>
     ///<param name="hometown">название города строкой</param>
     ///<param name="universityCountry">идентификатор страны, в которой пользователи закончили ВУЗ</param>
     ///<param name="university">идентификатор ВУЗа</param>
     ///<param name="universityYear">год окончания ВУЗа</param>
     ///<param name="universityFaculty">идентификатор факультета</param>
     ///<param name="universityChair">идентификатор кафедры</param>
     ///<param name="sex">пол</param>
     ///<param name="status">семейное положение</param>
     ///<param name="ageFrom">начиная с какого возраста</param>
     ///<param name="ageTo">до какого возраста</param>
     ///<param name="birthDay">день рождения</param>
     ///<param name="birthMonth">месяц рождения</param>
     ///<param name="birthYear">год рождения</param>
     ///<param name="online">только в сети</param>
     ///<param name="hasPhoto">только с фотографией</param>
     ///<param name="schoolCountry">идентификатор страны, в которой пользователи закончили школу</param>
     ///<param name="schoolCity">идентификатор города, в котором пользователи закончили школу</param>
     ///<param name="schoolClass"></param>
     ///<param name="school">идентификатор школы, которую закончили пользователи</param>
     ///<param name="schoolYear">год окончания школы</param>
     ///<param name="religion">религиозные взгляды</param>
     ///<param name="interests">интересы</param>
     ///<param name="company">название компании, в которой работают пользователи</param>
     ///<param name="position">название должности</param>
     ///<param name="groupId">идентификатор группы, среди пользователей которой необходимо проводить поиск</param>
     ///<param name="fromList">Разделы среди которых нужно осуществить поиск</param>
 ///<param name="offset">Оффсет для возврата результатов</param>
 ///<param name="count">Количество записей, которые необходимо вернуть</param>
     public EntityList<User> SearchSync(
         string q = "", SearchSortOrder sort = SearchSortOrder.ByRating, UserFields fields = UserFields.None, int? city = null, int? country = null, string hometown = "", int? universityCountry = null, int? university = null, int? universityYear = null, int? universityFaculty = null, int? universityChair = null, Sex? sex = null, Relation? status = null, byte? ageFrom = null, byte? ageTo = null, byte? birthDay = null, byte? birthMonth = null, ushort? birthYear = null, bool? online = null, bool? hasPhoto = null, int? schoolCountry = null, int? schoolCity = null, int? schoolClass = null, int? school = null, int? schoolYear = null, string religion = "", string interests = "", string company = "", string position = "", int? groupId = null,  FriendshipType? fromList = null, int? offset = null, int? count = 100
     ) {
         var task = _parent.Executor.ExecAsync(
                 _parent._reqapi.Users.Search(
                     q,sort,fields,city,country,hometown,universityCountry,university,universityYear,universityFaculty,universityChair,sex,status,ageFrom,ageTo,birthDay,birthMonth,birthYear,online,hasPhoto,schoolCountry,schoolCity,schoolClass,school,schoolYear,religion,interests,company,position,groupId,fromList,offset, count
                 )
             );
         task.Wait();
         return task.Result.Response;
     }
Example #41
0
 public EntityList<User> GetNearbySync(
     double latitude , double longitude , int? accuracy = null, int? timeout = null, byte? radius = null, UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Users.GetNearby(
                 latitude,longitude,accuracy,timeout,radius,fields,nameCase,offset, count
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #42
0
 public async Task <EntityList<User>> GetNearby(
     double latitude , double longitude , int? accuracy = null, int? timeout = null, byte? radius = null, UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Users.GetNearby(
                 latitude,longitude,accuracy,timeout,radius,fields,nameCase,offset, count
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #43
0
		public VKRequest<EntityList<User>> FriendsGet(
			 uint? userId = null,
			 uint? listId = null,
			 UserFields fields = UserFields.None,
			 UserSortOrder order = UserSortOrder.ById,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<User>>{
				MethodName = "friends.get",
				Parameters = new Dictionary<string, string> {
					{ "user_id", MiscTools.NullableString(userId) },
			{ "list_id", MiscTools.NullableString(listId) },
			{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "order", order.ToNClString() },
			{ "name_case", nameCase.ToNClString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
 public ActionResult addField(UserFields uf)
 {
     return(View());
 }
Example #45
0
		public VKRequest<EntityList<User>> FriendsGetSuggestions(
			 FriendSuggestionFilters filters = FriendSuggestionFilters.Everything,
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<User>>{
				MethodName = "friends.getSuggestions",
				Parameters = new Dictionary<string, string> {
					{ "filters", String.Join( ",", MiscTools.GetFilterFields( filters ) ) },
			{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "name_case", nameCase.ToNClString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #46
0
 public async Task <EntityList<User>> GetMembers(
     int groupId , UserFields fields = UserFields.Anything, GroupMembersFilter? filter = null,  MembersSortOrder? sort = null, int? offset = null, int? count = 100
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Groups.GetMembers(
                 groupId,fields,filter,sort,offset, count
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #47
0
 public EntityList<User> GetMembersSync(
     int groupId , UserFields fields = UserFields.Anything, GroupMembersFilter? filter = null,  MembersSortOrder? sort = null, int? offset = null, int? count = 100
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Groups.GetMembers(
                 groupId,fields,filter,sort,offset, count
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #48
0
		public async Task<EntityList<User>> FriendsGetSuggestionsAsync(
			 FriendSuggestionFilters filters = FriendSuggestionFilters.Everything,
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			return (await Executor.ExecAsync(
				_reqapi.FriendsGetSuggestions(
											filters,
											fields,
											nameCase,
											offset,
											count
									)
			)).Data.FirstOrDefault();
		}
Example #49
0
 /// <summary>
 /// Gets user by id.
 /// </summary>
 /// <param name="userId">Identificator of user.</param>
 /// <param name="fields">Bitmask of fields to get.</param>
 /// <returns>User object.</returns>
 public User GetSingle(uint userId, UserFields fields)
 {
     var request = new Request("getProfiles");
     request.Parameters.Add("uids", userId.ToString());
     request.Parameters.Add("fields", GetFields(fields));
     return Api.Call<User>(request);
 }
Example #50
0
 public async Task <NewsfeedBannedExtended> GetBannedExtended(
     UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Newsfeed.GetBannedExtended(
                 fields,nameCase
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #51
0
 /// <summary>
 /// Gets friends for the current user.
 /// </summary>
 /// <param name="fields">Bitmask of fields to get.</param>
 /// <returns>List of users.</returns>
 public List<User> GetFriends(UserFields fields)
 {
     return this.GetFriends(this.Api.UserId, fields);
 }
Example #52
0
 public NewsfeedBannedExtended GetBannedExtendedSync(
     UserFields fields = UserFields.None,  NameCase nameCase = NameCase.Nom
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Newsfeed.GetBannedExtended(
                 fields,nameCase
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #53
0
        /// <summary>
        /// Gets fields string to pass in the Api call from the bit mask.
        /// </summary>
        /// <param name="fields">Fields bit mask.</param>
        /// <returns>Fields string.</returns>
        private static string GetFields(UserFields fields)
        {
            var fieldsParam = new StringBuilder();
            if ((fields & UserFields.Default) == UserFields.Default)
                return "first_name,last_name";
            if ((fields & UserFields.BirthDate) == UserFields.BirthDate)
                fieldsParam.Append("bdate,");
            if ((fields & UserFields.CanPost) == UserFields.CanPost)
                fieldsParam.Append("can_post,");
            if ((fields & UserFields.CanWriteMessages) == UserFields.CanWriteMessages)
                fieldsParam.Append("can_write_private_message,");
            if ((fields & UserFields.City) == UserFields.City)
                fieldsParam.Append("city,");
            if ((fields & UserFields.Contacts) == UserFields.Contacts)
                fieldsParam.Append("contacts,");
            if ((fields & UserFields.Counters) == UserFields.Counters)
                fieldsParam.Append("counters,");
            if ((fields & UserFields.Country) == UserFields.Country)
                fieldsParam.Append("country,");
            if ((fields & UserFields.Domain) == UserFields.Domain)
                fieldsParam.Append("domain,");
            if ((fields & UserFields.Education) == UserFields.Education)
                fieldsParam.Append("education,");
            if ((fields & UserFields.HasMobile) == UserFields.HasMobile)
                fieldsParam.Append("has_mobile,");
            if ((fields & UserFields.Lists) == UserFields.Lists)
                fieldsParam.Append("lists,");
            if ((fields & UserFields.Nickname) == UserFields.Nickname)
                fieldsParam.Append("nickname,");
            if ((fields & UserFields.OnlineStatus) == UserFields.OnlineStatus)
                fieldsParam.Append("online,");
            if ((fields & UserFields.Photo) == UserFields.Photo)
                fieldsParam.Append("photo,");
            if ((fields & UserFields.PhotoBig) == UserFields.PhotoBig)
                fieldsParam.Append("photo_big,");
            if ((fields & UserFields.PhotoMedium) == UserFields.PhotoMedium)
                fieldsParam.Append("photo_medium,");
            if ((fields & UserFields.PhotoMediumRec) == UserFields.PhotoMediumRec)
                fieldsParam.Append("photo_medium_rec,");
            if ((fields & UserFields.PhotoRec) == UserFields.PhotoRec)
                fieldsParam.Append("photo_rec,");
            if ((fields & UserFields.Rate) == UserFields.Rate)
                fieldsParam.Append("rate,");
            if ((fields & UserFields.Sex) == UserFields.Sex)
                fieldsParam.Append("sex,");

            return fieldsParam.ToString().TrimEnd(',');
        }
Example #54
0
 public async Task <User[]> Get(
     UserFields fields = UserFields.None, NameCase nameCase = NameCase.Nom, params string[] userIds 
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Users.Get(
                 fields,nameCase,userIds
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #55
0
		public async Task<User[]> UsersGetAsync(
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			params uint[] userIds 
			){
			return (await Executor.ExecAsync(
				_reqapi.UsersGet(
											fields,
											nameCase,
											userIds
									)
			)).Data;
		}
Example #56
0
 public User[] GetSync(
     UserFields fields = UserFields.None, NameCase nameCase = NameCase.Nom, params string[] userIds 
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Users.Get(
                 fields,nameCase,userIds
             )
         );
     task.Wait();
     return task.Result.Response;
 }
Example #57
0
		public async Task<EntityList<User>> FriendsGetAsync(
			 uint? userId = null,
			 uint? listId = null,
			 UserFields fields = UserFields.None,
			 UserSortOrder order = UserSortOrder.ById,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			return (await Executor.ExecAsync(
				_reqapi.FriendsGet(
											userId,
											listId,
											fields,
											order,
											nameCase,
											offset,
											count
									)
			)).Data.FirstOrDefault();
		}
Example #58
0
 public async Task <EntityList<User>> GetFollowers(
     int? userId = null, UserFields fields = UserFields.Anything,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     return (
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Users.GetFollowers(
                 userId,fields,nameCase,offset, count
             )
         ).ConfigureAwait(false)
     ).Response;
 }
Example #59
0
		public async Task<User[]> FriendsGetByPhonesAsync(
			 UserFields fields = UserFields.None,
			 ulong[] phones = null
			){
			return (await Executor.ExecAsync(
				_reqapi.FriendsGetByPhones(
											fields,
											phones
									)
			)).Data;
		}
Example #60
0
 public EntityList<User> GetFollowersSync(
     int? userId = null, UserFields fields = UserFields.Anything,  NameCase nameCase = NameCase.Nom, int? offset = null, int? count = 100
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Users.GetFollowers(
                 userId,fields,nameCase,offset, count
             )
         );
     task.Wait();
     return task.Result.Response;
 }