public void UpdateFall(int id, float NewX, float NewY)
        {
            Falls = (from fall in db.falls
                     orderby fall.date
                     select fall).ToList();
            var Fall = (from f in Falls
                        where f.id == id
                        select f).FirstOrDefault <Fall>();

            if (Fall != null)
            {
                db = new Model1();
                db.Database.ExecuteSqlCommand("begin transaction\nUPDATE" +
                                              "[dbo].[falls]\n\tSET [x] = " + NewX +
                                              "\n\t\t,[y] = " + NewY +
                                              "\n\t\t,[isGeotagged] = 1\n\t\t,[actDist] = " +
                                              calculateActDist(Fall, NewX, NewY).ToString() +
                                              "\nWHERE id = " + id + ";\ncommit;");
                Falls.Remove(Fall);
                Fall.x           = NewX;
                Fall.y           = NewY;
                Fall.isGeotagged = true;
                Fall.actDist     = calculateActDist(Fall, NewX, NewY);
            }
        }
 public RegWindow()
 {
     InitializeComponent();
     using (DAL.Model1 m = new DAL.Model1())
     {
         foreach (City c in m.Cityes.ToList())
         {
             comboBoxCityes.Items.Add(c.Name);
         }
     }
 }
        public void Remove(int oldId)
        {
            Falls = (from fall in db.falls
                     orderby fall.date
                     select fall).ToList();
            var Fall = (from f in Falls
                        where f.id == oldId
                        select f).FirstOrDefault <Fall>();

            if (Fall != null)
            {
                db = new Model1();
                db.Database.ExecuteSqlCommand("begin transaction\nDELETE FROM[dbo].[falls]\n\tWHERE id = " + oldId + ";\ncommit;");
                Falls.Remove(Fall);
            }
        }
        public static List <BookTypeInfo> bookTypeInfos()
        {
            Model1 model = new Model1();

            return(model.BookTypeInfo.ToList());
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public static List <BookInfo> BookInfoSelect()
        {
            Model1 mo = new Model1();

            return(mo.BookInfo.ToList());
        }
Example #6
0
 public Repository()
 {
     db  = new Model1();
     Set = db.Set <T>();
 }