/// <summary>
 /// 创建新的 Location 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="address">Address 属性的初始值。</param>
 /// <param name="latitude">Latitude 属性的初始值。</param>
 /// <param name="longitude">Longitude 属性的初始值。</param>
 /// <param name="callCount">CallCount 属性的初始值。</param>
 /// <param name="confirmCount">ConfirmCount 属性的初始值。</param>
 /// <param name="unConfirmCount">UnConfirmCount 属性的初始值。</param>
 /// <param name="callRecycleCount">CallRecycleCount 属性的初始值。</param>
 /// <param name="amount">Amount 属性的初始值。</param>
 public static Location CreateLocation(global::System.Guid id, global::System.String address, global::System.Decimal latitude, global::System.Decimal longitude, global::System.Int32 callCount, global::System.Int32 confirmCount, global::System.Int32 unConfirmCount, global::System.Int32 callRecycleCount, global::System.Decimal amount)
 {
     Location location = new Location();
     location.Id = id;
     location.Address = address;
     location.Latitude = latitude;
     location.Longitude = longitude;
     location.CallCount = callCount;
     location.ConfirmCount = confirmCount;
     location.UnConfirmCount = unConfirmCount;
     location.CallRecycleCount = callRecycleCount;
     location.Amount = amount;
     return location;
 }
 /// <summary>
 /// 用于向 Locations EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToLocations(Location location)
 {
     base.AddObject("Locations", location);
 }
Example #3
0
       public  void AddLocation(string address, decimal longitude, decimal latitude, decimal amount)
        {
            try
            {
                Location addModel = new Location()
                {
                    Id = Guid.NewGuid(),
                    Address = StringHelper.LimitLength(address, 100),
                    Longitude = longitude,
                    Latitude = latitude,
                    //callCount是一个暂定的数据,不知道有什么用
                    CallCount = -1,
                    ConfirmCount = 0,
                    UnConfirmCount = 0,
                    CallRecycleCount = 0,
                    Amount = amount,
                    LastAddTime = DateTime.Now

                };
                db.AddToLocations(addModel);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }