public static void DeleteWork(InfoId toDel) { using (var dbContext = new QuickToDosEntities()) { bool go = true; List <Break> results = dbContext.Breaks.Where(x => x.ToDoId == toDel.Id).ToList(); if (results != null) { foreach (Break result in results) { dbContext.Breaks.Remove(result); } } toDo job = dbContext.toDos.Find(toDel.Id); if (job == null) { go = false; } if (go) { try { job.DontShow = true; //dbContext.toDos.Remove(job); dbContext.SaveChanges(); } catch (Exception e) { } } } }
public static void DeleteImg(InfoId toDel) { using (var dbContext = new QuickToDosEntities()) { File anImage = dbContext.Files.Find(toDel.Id); if (anImage != null) { string filename = anImage.Filename; string[] items = filename.Split('/'); filename = items[items.Length - 1]; string concern = anImage.Concern; string uploadPath = ConfigurationManager.AppSettings["RootFolder"] + @"\documents\" + concern + @"\"; string UploadPathOldies = uploadPath + @"oldies\"; string sourceFile = System.IO.Path.Combine(uploadPath, filename); string destFile = System.IO.Path.Combine(UploadPathOldies, filename); if (!System.IO.Directory.Exists(UploadPathOldies)) { System.IO.Directory.CreateDirectory(UploadPathOldies); } System.IO.File.Move(sourceFile, destFile); dbContext.Files.Remove(anImage); dbContext.SaveChanges(); } } }
public void GameId_TwoGameIdWithSameKeyAreEqual() { var gameIdOne = new InfoId("test"); var gameIdTwo = new InfoId("test"); Assert.AreEqual(gameIdOne.Value, gameIdTwo.Value); Assert.AreEqual(gameIdOne, gameIdTwo); }
public void GameId_TwoGameIdWithDifferentKeyAreNotEqual() { var one = new InfoId("test1"); var two = new InfoId("test2"); Assert.AreNotEqual(one.Value, two.Value); Assert.AreNotEqual(one, two); }
public static int TogglePause(InfoId info) { int jobId = info.Id; PauseInfo pauseInfo = new PauseInfo(); pauseInfo = DoTogglePause(jobId); return(pauseInfo.Duration); }
public void GameId_SerializesAndDeserializes() { var gameId = new InfoId("test"); var json = JsonUtility.ToJson(gameId); var deserializedId = JsonUtility.FromJson <InfoId>(json); Assert.AreEqual(gameId.Value, deserializedId.Value); Assert.AreEqual(gameId, deserializedId); }
/// <summary> /// 情報メッセージを表示 /// </summary> /// <param name="id">メッセージID</param> /// <param name="words">代替文字列</param> public static void ShowInfo(Window owner, InfoId id, params string[] words) { string message = _infoMessages[id]; for (int i = 0; i < words.Length; i++) { message = message.Replace("{" + i + "}", words[i]); } ShowInfo(owner, message); }
public static void DeleteKnowledge(InfoId toDel) { using (var dbContext = new QuickToDosEntities()) { Knowledge aKnowledge = dbContext.Knowledges.Find(toDel.Id); if (aKnowledge == null) { throw new Exception("Echec mise a jour"); } dbContext.Knowledges.Remove(aKnowledge); dbContext.SaveChanges(); } }
public override int GetHashCode() { int hash = 1; if (InfoId != 0) { hash ^= InfoId.GetHashCode(); } if (InfoType != 0) { hash ^= InfoType.GetHashCode(); } if (LevelName.Length != 0) { hash ^= LevelName.GetHashCode(); } if (LevelDesc.Length != 0) { hash ^= LevelDesc.GetHashCode(); } return(hash); }
public override string ToString() { return(InfoId.ToString()); }
private void PopulateFakeData() { var id = new InfoId() { NamespaceId = "Entity", NameId = "Dear" }; var considerations = new ConsiderationInfo[] { new ConsiderationInfo() { Name = "Thirst", RefConsideration = new IdInfoIndex(0, 0), ModeCurve = 0, Invert = false, ExtraValues = new float[] { 0f, 0f, 1f, 1f }, } }; var actions = new ActionInfo[] { new ActionInfo() { Name = "Idle", RefAction = new IdInfoIndex(0, 0), }, new ActionInfo() { Name = "Drink", RefAction = new IdInfoIndex(0, 1), }, }; var options = new OptionInfo[] { new OptionInfo() { Name = "Drink", ActionInfoIndex = 1, ConsiderationInfoIndexes = new int[] { 0 }, ModeMeasure = 0, }, new OptionInfo() { Name = "Idle", ActionInfoIndex = 0, ConsiderationInfoIndexes = new int[] {}, ModeMeasure = 0, }, }; var behaviours = new BehaviourInfo[] { new BehaviourInfo() { Name = "Normal", OptionInfoIndexes = new int[] { 0, 1 }, ConsiderationInfoIndexes = new int[] { 0 }, } }; Data = new AiInfo() { Id = id, Actions = actions, Considerations = considerations, Options = options, Behaviours = behaviours, }; UnityEditor.EditorUtility.SetDirty(this); }
private void ChangeInfoid(InfoId infoId, int[] index) { infoId = language.InfoId.VTR_RESULT_CLASSIFY_OTHER; infoId += Utils.ClassifyVehicleType(index[0]) - 1; }