/// <summary>
 /// 创建新的 UserInfo 对象。
 /// </summary>
 /// <param name="userId">UserId 属性的初始值。</param>
 /// <param name="userName">UserName 属性的初始值。</param>
 /// <param name="point">Point 属性的初始值。</param>
 /// <param name="dealCount">DealCount 属性的初始值。</param>
 /// <param name="uploadCount">UploadCount 属性的初始值。</param>
 /// <param name="type">Type 属性的初始值。</param>
 /// <param name="country">Country 属性的初始值。</param>
 /// <param name="province">Province 属性的初始值。</param>
 /// <param name="city">City 属性的初始值。</param>
 /// <param name="town">Town 属性的初始值。</param>
 /// <param name="street">Street 属性的初始值。</param>
 /// <param name="address">Address 属性的初始值。</param>
 /// <param name="imagePath">ImagePath 属性的初始值。</param>
 /// <param name="longitude">Longitude 属性的初始值。</param>
 /// <param name="latitude">Latitude 属性的初始值。</param>
 /// <param name="hasCustome">HasCustome 属性的初始值。</param>
 /// <param name="allRank">AllRank 属性的初始值。</param>
 /// <param name="lastAllRank">LastAllRank 属性的初始值。</param>
 /// <param name="lastCallTime">LastCallTime 属性的初始值。</param>
 /// <param name="cityRank">CityRank 属性的初始值。</param>
 /// <param name="lastCityRank">LastCityRank 属性的初始值。</param>
 public static UserInfo CreateUserInfo(global::System.String userId, global::System.String userName, global::System.Int32 point, global::System.Int32 dealCount, global::System.Int32 uploadCount, global::System.Int32 type, global::System.Int32 country, global::System.Int32 province, global::System.Int32 city, global::System.Int32 town, global::System.Int32 street, global::System.String address, global::System.String imagePath, global::System.Decimal longitude, global::System.Decimal latitude, global::System.Boolean hasCustome, global::System.Int32 allRank, global::System.Int32 lastAllRank, global::System.DateTime lastCallTime, global::System.Int32 cityRank, global::System.Int32 lastCityRank)
 {
     UserInfo userInfo = new UserInfo();
     userInfo.UserId = userId;
     userInfo.UserName = userName;
     userInfo.Point = point;
     userInfo.DealCount = dealCount;
     userInfo.UploadCount = uploadCount;
     userInfo.Type = type;
     userInfo.Country = country;
     userInfo.Province = province;
     userInfo.City = city;
     userInfo.Town = town;
     userInfo.Street = street;
     userInfo.Address = address;
     userInfo.ImagePath = imagePath;
     userInfo.Longitude = longitude;
     userInfo.Latitude = latitude;
     userInfo.HasCustome = hasCustome;
     userInfo.AllRank = allRank;
     userInfo.LastAllRank = lastAllRank;
     userInfo.LastCallTime = lastCallTime;
     userInfo.CityRank = cityRank;
     userInfo.LastCityRank = lastCityRank;
     return userInfo;
 }
 /// <summary>
 /// 用于向 UserInfos EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToUserInfos(UserInfo userInfo)
 {
     base.AddObject("UserInfos", userInfo);
 }
Esempio n. 3
0
        public bool AddUserInfo(string userId, string userName, int type)
        {
            try
            {
                int rank = db.UserInfos.Count();
                UserInfo model = new UserInfo()
                {
                    UserId = StringHelper.LimitLength(userId),
                    UserName = StringHelper.LimitLength(userName),
                    Point = 0,
                    DealCount = 0,
                    UploadCount = 0,
                    Email = string.Empty,
                    Description = string.Empty,
                    Type = (type == 1 ? 1 : 2),
                    Phone = string.Empty,
                    Country = 1,  //默认中国为1
                    Province = -1,
                    City = -1,
                    Town = -1,
                    Street = -1,
                    //-1 表示暂无意义
                    Address = string.Empty,
                    ImagePath = string.Empty,
                    Longitude = -1.0M,
                    Latitude = -1.0M,
                    HasCustome = false,
                    AllRank = rank,
                    LastAllRank = rank,
                    CityRank = -1,
                    LastCityRank = -1,
                    //-1表示没有参加排名,城市未知,不可判断
                    LastCallTime = DateTime.Now.AddMonths(-1)

                };
                db.AddToUserInfos(model);
                db.SaveChanges();
                return true;

            }
            catch
            {
                return false;
            }
        }