コード例 #1
0
 public Boolean DeleteTable(Int32 id) {
     Table query = new Table();
     try {
         using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
             query = db.Tables.FirstOrDefault(m => m.id == id);
             if (query != default(Table)) {
                 query.Status = (Int32)Common.Status.NotActive;
                 db.SubmitChanges();
             }
         }
     }
     catch (Exception ex) {
         return false;
     }
     return true;
 }
コード例 #2
0
        public Boolean SaveTables(List<Table> tables, Int32 floorId) {
            Table table;
            IEnumerable<Table> tablesToDelete;
            try {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    tablesToDelete = db.Tables.Where(m => m.FloorId == floorId && !tables.Contains(m));
                    if (tablesToDelete.Any()) {
                        db.Tables.DeleteAllOnSubmit(tablesToDelete);
                        db.SubmitChanges();
                    }
                    if (tables.Any()) {
                        foreach (Table t in tables) {
                            table = new Table();
                            if (t.id != 0) {
                                table = db.Tables.FirstOrDefault(m => m.id == t.id);
                            }

                            table.Top = t.Top;
                            table.FloorId = floorId;
                            table.Name = t.Name;
                            table.Left = t.Left;
                            table.Status = (Int32)Common.Status.Active;
                            table.Type = t.Type;
                            table.Width = t.Width;
                            table.Height = t.Height;
                            if (t.id == 0) {
                                db.Tables.InsertOnSubmit(table);
                            }
                            db.SubmitChanges();
                        }
                    }
                }
            }
            catch (Exception ex) {
                return false;
            }
            return true;
        }
コード例 #3
0
 partial void DeleteTable(Table instance);
コード例 #4
0
 partial void UpdateTable(Table instance);
コード例 #5
0
 partial void InsertTable(Table instance);
コード例 #6
0
		private void detach_Tables(Table entity)
		{
			this.SendPropertyChanging();
			entity.Floor = null;
		}
コード例 #7
0
		private void attach_Tables(Table entity)
		{
			this.SendPropertyChanging();
			entity.Floor = this;
		}