public void AddClothes(clothes c) { using (SzafaModel dbconn = new SzafaModel()) { if (!CheckDatabaseExistence(dbconn)) { throw new DbUpdateException(); } dbconn.clothes.Add(c); dbconn.SaveChanges(); } }
public void DeletePieceOfClothing(PieceOfClothing c) { try { clothes cl = c.Toclothes(); dbConnection.DeletePieceOfClothing(cl); } catch (Exception e) { eventAggregator.GetEvent <DatabaseConnectionErrorOccuredEvent>().Publish(e.ToString()); return; } }
public void DeletePieceOfClothing(clothes c) { using (SzafaModel dbconn = new SzafaModel()) { if (!CheckDatabaseExistence(dbconn)) { throw new DbUpdateException(); } clothes cloth = dbconn.clothes.Find(c.id); dbconn.clothes.Remove(cloth); dbconn.SaveChanges(); } }
public PieceOfClothing(clothes c) { Id = c.id; Description = c.description; InUse = c.in_use; InUseFrom = c.in_use_from; LastTimeOn = c.last_time_on; Name = c.name; PicturePath = c.picture_path; TimesOn = c.times_on; TypeId = c.type_id; if (c.types != null) { Type = new ClothingType(c.types); } }
public void UpdatePieceOfClothing(PieceOfClothing c) { try { clothes cl = c.Toclothes(); ImageService imageService = new ImageService(); string generatedName = imageService.SaveImage(c.PicturePath, c.Id); if (generatedName != null) { cl.picture_path = generatedName; } dbConnection.UpdateClothes(cl); } catch (Exception e) { eventAggregator.GetEvent <DatabaseConnectionErrorOccuredEvent>().Publish(e.ToString()); } }
public void UpdateClothes(clothes c) { using (SzafaModel dbconn = new SzafaModel()) { if (!CheckDatabaseExistence(dbconn)) { throw new DbUpdateException(); } clothes cloth = dbconn.clothes.Find(c.id); cloth.description = c.description; cloth.name = c.name; cloth.in_use = c.in_use; cloth.in_use_from = c.in_use_from; cloth.last_time_on = c.last_time_on; cloth.picture_path = c.picture_path; cloth.times_on = c.times_on; cloth.type_id = c.type_id; dbconn.SaveChanges(); } }
public PieceOfClothing(clothes c, BitmapImage i) : this(c) { Image = i; }
public int update_score(GameObject npc, clothes cloth) { int ret_value = 0; switch (npc.name) { case "Jenni": switch (cloth) { case clothes.BLOUSE: ret_value = 4; break; case clothes.DRESS: ret_value = 4; break; case clothes.JACKET: ret_value = 5; break; case clothes.MINISKIRT: ret_value = 2; break; case clothes.PANTS: ret_value = 5; break; case clothes.SHORTS: ret_value = 2; break; case clothes.TANKTOP: ret_value = 3; break; case clothes.TSHIRT: ret_value = 3; break; case clothes.UNLOCKBOOTS: ret_value = 5; break; case clothes.UNLOCKVEST: ret_value = 5; break; default: ret_value = 1; break; } break; case "Andrew": switch (cloth) { case clothes.BLOUSE: ret_value = 5; break; case clothes.DRESS: ret_value = 5; break; case clothes.JACKET: ret_value = 3; break; case clothes.MINISKIRT: ret_value = 4; break; case clothes.PANTS: ret_value = 3; break; case clothes.SHORTS: ret_value = 4; break; case clothes.TANKTOP: ret_value = 2; break; case clothes.TSHIRT: ret_value = 2; break; case clothes.UNLOCKBOOTS: ret_value = 5; break; case clothes.UNLOCKVEST: ret_value = 5; break; default: ret_value = 1; break; } break; case "Melissa": switch (cloth) { case clothes.BLOUSE: ret_value = 2; break; case clothes.DRESS: ret_value = 2; break; case clothes.JACKET: ret_value = 3; break; case clothes.MINISKIRT: ret_value = 5; break; case clothes.PANTS: ret_value = 3; break; case clothes.SHORTS: ret_value = 4; break; case clothes.TANKTOP: ret_value = 5; break; case clothes.TSHIRT: ret_value = 4; break; case clothes.UNLOCKBOOTS: ret_value = 5; break; case clothes.UNLOCKVEST: ret_value = 5; break; default: ret_value = 1; break; } break; case "Julian": switch (cloth) { case clothes.BLOUSE: ret_value = 2; break; case clothes.DRESS: ret_value = 2; break; case clothes.JACKET: ret_value = 3; break; case clothes.MINISKIRT: ret_value = 5; break; case clothes.PANTS: ret_value = 3; break; case clothes.SHORTS: ret_value = 4; break; case clothes.TANKTOP: ret_value = 5; break; case clothes.TSHIRT: ret_value = 4; break; case clothes.UNLOCKBOOTS: ret_value = 5; break; case clothes.UNLOCKVEST: ret_value = 5; break; default: ret_value = 1; break; } break; } player_score += ret_value; return ret_value; }