public void GetListTest() { TDList testList = new TDList(); testList.Load(); Assert.IsNotNull(testList.GetList(), "GetList was null."); }
public List <Priority> Priorities() { using (TDList data = new TDList()) { return(data.Priorities.ToList()); } }
public List <Category> Categories() { using (TDList data = new TDList()) { return(data.Categories.ToList()); } }
public List <Task> GetTasks(int userId) { using (TDList list = new TDList()) { return(list.Tasks.Include("Priority").Include("Category").Where(i => i.IdAccount == userId).ToList()); } }
public void RemoveTask(int id) { using (TDList list = new TDList()) { var removeTask = list.Tasks.SingleOrDefault(t => t.Id == id); list.Tasks.Remove(removeTask); list.SaveChanges(); } }
public string deleteTask(int id) { _logging.Log(this.GetType().ToString(), "Deleting task."); TDList tDList = _db.Get(id); _db.Remove(tDList); _logging.Log(this.GetType().ToString(), "Task deleted."); return("Task Deleted"); }
public void AddTest() { ToDo testToDo = new ToDo(); TDList testList = new TDList(); testToDo.Id = Guid.NewGuid(); testList.Add(testToDo); Assert.IsTrue(testList.GetList().Count == 1, "ToDo item was not added."); }
public void Registration(AccountSignUp ASU) { using (TDList list = new TDList()) { Account account = new Account { Login = ASU.Login, Password = CryptoProvider.GetMD5Hash(ASU.Password) }; list.Accounts.Add(account); list.SaveChanges(); } }
public void CompleteTest() { ToDo testToDo = new ToDo(); TDList testList = new TDList(); testToDo.Id = Guid.NewGuid(); testList.Add(testToDo); testList.Complete(testToDo.Id); Assert.IsTrue(testList.GetList().Count == 1, "ToDo item was not added."); Assert.IsTrue(testList.GetList()[testToDo.Id].Completed, "Status was not marked complete."); }
public void SaveTest() { ToDo testToDo = new ToDo(); TDList testList = new TDList(); testToDo.Id = Guid.NewGuid(); testList.Add(testToDo); testList.Save(); testList.Load(); Assert.IsNotNull(testList.GetList(), "GetList was null."); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { using (TDList list = new TDList()) { string Login = (validationContext.ObjectInstance as AccountSignUp).Login; ValidationResult VR = list.Accounts.Where( a => a.Login.Equals(Login) ).Any() == true ? new ValidationResult("Login is already exist.") : null; return(VR); } }
public void EditTest() { ToDo testToDo = new ToDo(); TDList testList = new TDList(); testToDo.Id = Guid.NewGuid(); testList.Add(testToDo); Assert.IsTrue(testList.GetList().Count == 1, "ToDo item was not added."); testToDo.Name = "test"; testToDo.Description = "test"; testList.Edit(testToDo); Assert.IsTrue(testList.GetList()[testToDo.Id].Name == "test", "Name was not edited."); Assert.IsTrue(testList.GetList()[testToDo.Id].Description == "test", "Description was not edited."); }
public string updateTask(TDList task) { _logging.Log(this.GetType().ToString(), "Updating task."); if (task != null) { _db.Update(task); _logging.Log(this.GetType().ToString(), "Task updated."); return("Task Updated"); } else { _logging.Log(this.GetType().ToString(), "Invalid task to update."); return("Invalid Task"); } }
public string addTask(TDList task) { _logging.Log(this.GetType().ToString(), "Adding task."); if (task != null) { _db.Add(task.ListId, task); _logging.Log(this.GetType().ToString(), "Task added."); return("Task Added"); } else { _logging.Log(this.GetType().ToString(), "Invalid task to add."); return("Invalid Task"); } }
public void Record(HttpRequestBase Request, ref AnalyzeTaskView AT) { using (TDList list = new TDList()) { HttpCookie cookie = Request.Cookies["UserId"]; Task task = new Task { Name = AT.Name, Objective = AT.Objective, StartDate = AT.StartDate, EndDate = AT.EndDate, IdAccount = int.Parse(cookie.Value), IdCategory = AT.selectCategoryItems, IdPriority = AT.selectPriorityItems, }; list.Tasks.Add(task); list.SaveChanges(); } }
public UpdateTask(List <string> _Fields) { list = new TDList(); Fields = _Fields; Id = Int32.Parse(Fields[0]); }
private void LoadIni() { // // スペシャルパワーアニメ // buf = GeneralLib.ReadIni("Option", "SpecialPowerAnimation"); // if (string.IsNullOrEmpty(buf)) // { // buf = GeneralLib.ReadIni("Option", "MindEffect"); // if (!string.IsNullOrEmpty(buf)) // { // SystemConfig.SetItem("Option", "SpecialPowerAnimation", buf); // } // } // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // SpecialPowerAnimation = true; // } // else // { // SpecialPowerAnimation = false; // } // } // else if (SpecialPowerAnimation) // { // SystemConfig.SetItem("Option", "SpecialPowerAnimation", "On"); // } // else // { // SystemConfig.SetItem("Option", "SpecialPowerAnimation", "Off"); // } // // 戦闘アニメ // buf = Strings.LCase(GeneralLib.ReadIni("Option", "BattleAnimation")); // if (!string.IsNullOrEmpty(buf)) // { // if (buf == "on") // { // BattleAnimation = true; // } // else // { // BattleAnimation = false; // } // } // else if (BattleAnimation) // { // SystemConfig.SetItem("Option", "BattleAnimation", "On"); // } // else // { // SystemConfig.SetItem("Option", "BattleAnimation", "Off"); // } // // 拡大戦闘アニメ // buf = Strings.LCase(GeneralLib.ReadIni("Option", "ExtendedAnimation")); // if (!string.IsNullOrEmpty(buf)) // { // if (buf == "on") // { // ExtendedAnimation = true; // } // else // { // ExtendedAnimation = false; // } // } // else // { // ExtendedAnimation = true; // SystemConfig.SetItem("Option", "ExtendedAnimation", "On"); // } // // 武器準備アニメ // buf = Strings.LCase(GeneralLib.ReadIni("Option", "WeaponAnimation")); // if (!string.IsNullOrEmpty(buf)) // { // if (buf == "on") // { // WeaponAnimation = true; // } // else // { // WeaponAnimation = false; // } // } // else // { // WeaponAnimation = true; // SystemConfig.SetItem("Option", "WeaponAnimation", "On"); // } // // 移動アニメ // buf = Strings.LCase(GeneralLib.ReadIni("Option", "MoveAnimation")); // if (!string.IsNullOrEmpty(buf)) // { // if (buf == "on") // { // MoveAnimation = true; // } // else // { // MoveAnimation = false; // } // } // else // { // MoveAnimation = true; // SystemConfig.SetItem("Option", "MoveAnimation", "On"); // } // // メッセージ速度を設定 // buf = GeneralLib.ReadIni("Option", "MessageWait"); // if (Information.IsNumeric(buf)) // { // GUI.MessageWait = Conversions.ToInteger(buf); // if (GUI.MessageWait > 10000000) // { // GUI.MessageWait = 10000000; // } // } // else // { // GUI.MessageWait = 700; // SystemConfig.SetItem("Option", "MessageWait", "700"); // } // // マス目を表示するかどうか // buf = GeneralLib.ReadIni("Option", "Square"); // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // ShowSquareLine = true; // } // else // { // ShowSquareLine = false; // } // } // else // { // ShowSquareLine = false; // SystemConfig.SetItem("Option", "Square", "Off"); // } // // 敵ターンにBGMを変更するかどうか // buf = GeneralLib.ReadIni("Option", "KeepEnemyBGM"); // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // KeepEnemyBGM = true; // } // else // { // KeepEnemyBGM = false; // } // } // else // { // KeepEnemyBGM = false; // SystemConfig.SetItem("Option", "KeepEnemyBGM", "Off"); // } // // 音源のリセットデータの種類 // MidiResetType = GeneralLib.ReadIni("Option", "MidiReset"); // // 自動反撃モード // buf = GeneralLib.ReadIni("Option", "AutoDefense"); // if (string.IsNullOrEmpty(buf)) // { // buf = GeneralLib.ReadIni("Option", "AutoDeffence"); // if (!string.IsNullOrEmpty(buf)) // { // SystemConfig.SetItem("Option", "AutoDefense", buf); // } // } // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // SystemConfig.AutoDefense = true; // } // else // { // SystemConfig.AutoDefense = false; // } // } // else // { // SystemConfig.AutoDefense = false; // SystemConfig.SetItem("Option", "AutoDefense", "Off"); // } // // カーソル自動移動 // buf = GeneralLib.ReadIni("Option", "AutoMoveCursor"); // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // AutoMoveCursor = true; // } // else // { // AutoMoveCursor = false; // } // } // else // { // AutoMoveCursor = true; // SystemConfig.SetItem("Option", "AutoMoveCursor", "On"); // } // 各ウィンドウをロード (メインウィンドウは先にロード済み) GUI.LoadForms(); // // 画像バッファの枚数 // buf = GeneralLib.ReadIni("Option", "ImageBufferNum"); // if (Information.IsNumeric(buf)) // { // ImageBufferSize = Conversions.Toint(buf); // if (ImageBufferSize < 5) // { // // 最低でも5枚のバッファを使う // ImageBufferSize = 5; // } // } // else // { // // デフォルトは64枚 // ImageBufferSize = 64; // SystemConfig.SetItem("Option", "ImageBufferNum", "64"); // } // // 画像バッファを作成 // GUI.MakePicBuf(); // // 画像バッファの最大サイズ // buf = GeneralLib.ReadIni("Option", "MaxImageBufferSize"); // if (Information.IsNumeric(buf)) // { // MaxImageBufferByteSize = (Conversions.ToDouble(buf) * 1024d * 1024d); // if (MaxImageBufferByteSize < 1 * 1024 * 1024) // { // // 最低でも1MBのバッファを使う // MaxImageBufferByteSize = 1 * 1024 * 1024; // } // } // else // { // // デフォルトは8MB // MaxImageBufferByteSize = 8 * 1024 * 1024; // SystemConfig.SetItem("Option", "MaxImageBufferSize", "8"); // } // // 拡大画像を画像バッファに保存するか // buf = GeneralLib.ReadIni("Option", "KeepStretchedImage"); // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // KeepStretchedImage = true; // } // else // { // KeepStretchedImage = false; // } // } // // UPGRADE_WARNING: オブジェクト IsBitBltFasterThanStretchBlt() の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。 // else if (Conversions.ToBoolean(IsBitBltFasterThanStretchBlt())) // { // KeepStretchedImage = true; // SystemConfig.SetItem("Option", "KeepStretchedImage", "On"); // } // else // { // KeepStretchedImage = false; // SystemConfig.SetItem("Option", "KeepStretchedImage", "Off"); // } // // 透過描画にUseTransparentBltを使用するか // if (GeneralLib.GetWinVersion() >= 500) // { // buf = GeneralLib.ReadIni("Option", "UseTransparentBlt"); // if (!string.IsNullOrEmpty(buf)) // { // if (Strings.LCase(buf) == "on") // { // UseTransparentBlt = true; // } // else // { // UseTransparentBlt = false; // } // } // else // { // UseTransparentBlt = true; // SystemConfig.SetItem("Option", "UseTransparentBlt", "On"); // } // } // // マウスボタンの利き腕設定 // if (GUI.GetSystemMetrics(GUI.SM_SWAPBUTTON) == 0) // { // // 右利き用 // GUI.RButtonID = 0x2; // GUI.LButtonID = 0x1; // } // else // { // // 左利き用 // GUI.RButtonID = 0x1; // GUI.LButtonID = 0x2; // } // GUI.ListItemComment = new string[1]; // // エリアスデータをロード // bool localFileExists1() { string argfname = AppPath + @"Data\System\alias.txt"; var ret = FileSystem.FileExists(argfname); return ret; } // if (FileSystem.FileExists(ScenarioPath + @"Data\System\alias.txt")) // { // ALDList.Load(ScenarioPath + @"Data\System\alias.txt"); // } // else if (localFileExists1()) // { // ALDList.Load(AppPath + @"Data\System\alias.txt"); // } // スペシャルパワーデータをロード var spFiles = new string[] { FileSystem.PathCombine(ScenarioPath, "Data", "System", "sp.txt"), FileSystem.PathCombine(ScenarioPath, "Data", "System", "mind.txt"), FileSystem.PathCombine(AppPath, "Data", "System", "sp.txt"), FileSystem.PathCombine(AppPath, "Data", "System", "mind.txt"), }; foreach (var spFile in spFiles) { if (FileSystem.FileExists(spFile)) { SPDList.Load(spFile); break; } } // 汎用アイテムデータをロード if (FileSystem.FileExists(ScenarioPath, @"Data\System\item.txt")) { IDList.Load(FileSystem.PathCombine(ScenarioPath, @"Data\System\item.txt")); } else if (FileSystem.FileExists(AppPath, @"Data\System\item.txt")) { IDList.Load(FileSystem.PathCombine(AppPath, @"Data\System\item.txt")); } // 地形データをロード string appTerrainPath = FileSystem.PathCombine(AppPath, "Data", "System", "terrain.txt"); if (FileSystem.FileExists(appTerrainPath)) { TDList.Load(appTerrainPath); } else { throw new TerminateException(@"地形データファイル「Data\System\terrain.txt」が見つかりません"); } string scenarioTerrainPath = FileSystem.PathCombine(ScenarioPath, "Data", "System", "terrain.txt"); if (FileSystem.FileExists(scenarioTerrainPath)) { TDList.Load(scenarioTerrainPath); } // バトルコンフィグデータをロード var bcFiles = new string[] { FileSystem.PathCombine(ScenarioPath, "Data", "System", "battle.txt"), FileSystem.PathCombine(AppPath, "Data", "System", "battle.txt"), }; foreach (var bcFile in bcFiles) { if (FileSystem.FileExists(bcFile)) { BCList.Load(bcFile); break; } } }