/// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="paraTb_Supermaket"></param>
 /// <returns>true:删除成功,false:不存在该记录</returns>
 public bool deleteMode(tb_SuperMaket paraTb_Supermaket)
 {
     if(paraTb_Supermaket == null)
         throw new ArgumentNullException("paraTb_Supermaket");
     try
     {
         var query = from p in _context.tb_SuperMaket
             where p.SuperMarketId == paraTb_Supermaket.SuperMarketId
             select p;
         if (query.ToList().Count<1)
         {
             return false;
         }
         else
         {
             foreach(var model in query.ToList())
             {
                 if(!_context.IsAttached(model))
                     _context.tb_SuperMaket.Attach(model);
                 _context.tb_SuperMaket.DeleteObject(model);
                 _context.SaveChanges();
             }
             return true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="paraTb_Supermaket"></param>
 /// <returns>true:插入成功,false:已存在该记录</returns>
 public bool addMode(tb_SuperMaket paraTb_Supermaket)
 {
     if(paraTb_Supermaket == null)
         throw new ArgumentNullException("paraTb_Supermaket");
     try
     {
         var query = from p in _context.tb_SuperMaket
             where p.SuperMarketId == paraTb_Supermaket.SuperMarketId
             select p;
         if (query.ToList().Count() > 0)
         {
             return false;
         }
         else
         {
             _context.tb_SuperMaket.AddObject(paraTb_Supermaket);
             _context.SaveChanges();
             return true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 用于向 tb_SuperMaket EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTotb_SuperMaket(tb_SuperMaket tb_SuperMaket)
 {
     base.AddObject("tb_SuperMaket", tb_SuperMaket);
 }
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="paraTb_Supermaket"></param>
 /// <returns>true:更新成功,false:更新数据失败,不存在该记录!</returns>
 public bool updateMode(tb_SuperMaket paraTb_Supermaket)
 {
     if(paraTb_Supermaket == null)
         throw new ArgumentNullException("paraTb_Supermaket");
     try
     {
         var oldEntity = (from p in _context.tb_SuperMaket
             where p.SuperMarketId == paraTb_Supermaket.SuperMarketId
             select p).FirstOrDefault();
         if (oldEntity == null)
         {
             return false;
         }
         else
         {
             _context.ApplyCurrentValues(oldEntity.GetType().Name, paraTb_Supermaket);
             _context.SaveChanges();
             return true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 创建新的 tb_SuperMaket 对象。
 /// </summary>
 /// <param name="superMarketId">SuperMarketId 属性的初始值。</param>
 /// <param name="superMarketName">superMarketName 属性的初始值。</param>
 public static tb_SuperMaket Createtb_SuperMaket(global::System.Int32 superMarketId, global::System.String superMarketName)
 {
     tb_SuperMaket tb_SuperMaket = new tb_SuperMaket();
     tb_SuperMaket.SuperMarketId = superMarketId;
     tb_SuperMaket.superMarketName = superMarketName;
     return tb_SuperMaket;
 }