/// <summary> /// 作業内容登録コールバック /// </summary> private void RegisterWorkContent() { // 作業内容の登録 WorkContent.UserId = WorkerMaster.Id; // 選択されている日時を取得 if (false == WorkContent.RegisterDbRecord()) { MessageBox.Show("入力情報に不備があります"); return; } int workContentId = DataBaseManager.DBManager.GetWorkCotentLastId(); // 農薬内容の登録 foreach (PesticideContent pc in WorkContent.PesticideContents) { pc.WorkContentId = workContentId; pc.RegisterDbRecord(); } // 直前の登録時間を開始・終了に設定する WorkContent tmpWc = new WorkContent(); tmpWc.SetDateTime(WorkContent.EndWorkTime); WorkContent = new WorkContent(tmpWc); WorkContents = new ObservableCollection <WorkContent>(DataBaseManager.DBManager.GetWorkContents()); foreach (WorkContent wc in WorkContents) { wc.PesticideContents = new ObservableCollection <PesticideContent>(DataBaseManager.DBManager.GetPesticideContents(wc.Id)); } }
public Worker(string n, WorkContent wk) { this.name = n; Thread t = new Thread(new ThreadStart(wk)); workerList.Add(this); threadList.Add(t); t.Start(); }
/// <summary> /// 作業内容削除コールバック /// </summary> private void DeleteWorkContent() { if (false == WorkContent.DeleteDbRecord()) { MessageBox.Show("IDに不備があります"); return; } WorkContents = new ObservableCollection <WorkContent>(DataBaseManager.DBManager.GetWorkContents()); WorkContent = new WorkContent(); }
protected virtual IOnlineClient CreateClientForCurrentConnection() { return(new OnlineClient(Context.ConnectionId, WorkContent.GetCurrentUser().Result.Id)); }
/// <summary> /// コンストラクタ /// </summary> public MainWindowViewModel() { DataBaseManager.ConnectDB("WorkTaskApp.db"); WorkContents = new ObservableCollection <WorkContent>(DataBaseManager.DBManager.GetWorkContents()); PesticideMasters = new ObservableCollection <PesticideMaster>(DataBaseManager.DBManager.GetPesticideMasters()); WorkerMasters = new ObservableCollection <WorkerMaster>(DataBaseManager.DBManager.GetWorkerMasters()); WorkContent = new WorkContent(); PesticideContent = new PesticideContent(); WorkerMaster = new WorkerMaster(); RegisterPesticide = new PesticideMaster(); RegisterWorker = new WorkerMaster(); // 農薬内容登録コマンド登録 RegisterPesticideContentClicked = new DelegateCommand( () => RegisterPesticideContent()); // 農薬内容更新コマンド登録 UpdatePesticideContentClicked = new DelegateCommand( () => UpdatePesticideContent()); // 農薬内容削除コマンド登録 DeletePesticideContentClicked = new DelegateCommand( () => DeletePesticideContent()); // 農薬内容読み込みコマンド登録(クリックで取得したインスタンスで登録用インスタンスを上書き) PesticideContentsClicked = new DelegateCommand <Object>( (readPesticideContent) => { if (readPesticideContent is PesticideContent) { // インデックスを取得 selectedPesticideContentIndex = PesticideContentIndex; // リスト内の要素が選択されている場合のみ、インスタンスを上書きする PesticideContent = new PesticideContent((PesticideContent)readPesticideContent); PesticideMasterIndex = PesticideMasters.ToList().FindIndex(master => PesticideContent.PestcideMaster.Id == master.Id); } }); // 作業内容登録コマンド登録 RegisterWorkContentClicked = new DelegateCommand( () => RegisterWorkContent()); // 作業内容更新コマンド登録 UpdateWorkContentClicked = new DelegateCommand( () => UpdateWorkContent()); // 作業内容削除コマンド登録 DeleteWorkContentClicked = new DelegateCommand( () => DeleteWorkContent()); // 作業内容読み込みコマンド登録(クリックで取得したインスタンスで登録用インスタンスを上書き) WorkContentsClicked = new DelegateCommand <Object>( (readWorkContent) => { if (readWorkContent is WorkContent) { // リスト内の要素が選択されている場合のみ、インスタンスを上書きする WorkContent = new WorkContent((WorkContent)readWorkContent); WorkerMasterIndex = WorkerMasters.ToList().FindIndex(master => WorkContent.UserId == master.Id); } }); // 農薬マスタ登録コマンド登録 RegisterPesticideClicked = new DelegateCommand( () => RegisterPesticideMaster()); // 農薬マスタ更新コマンド登録 UpdatePesticideClicked = new DelegateCommand( () => UpdatePesticideMaster()); // 農薬マスタ削除コマンド登録 DeletePesticideClicked = new DelegateCommand( () => DeletePesticideMaster()); // 農薬マスタ読み込みコマンド登録(クリックで取得したインスタンスで登録用インスタンスを上書き) PesticideMasterClicked = new DelegateCommand <Object>( (readPesticide) => { if (readPesticide is PesticideMaster) { // リスト内の要素が選択されている場合のみ、インスタンスを上書きする RegisterPesticide = new PesticideMaster((PesticideMaster)readPesticide); } }); // 作業者マスタ登録コマンド登録 RegisterWorkerClicked = new DelegateCommand( () => RegisterWorkerMaster()); // 作業者マスタ更新コマンド登録 UpdateWorkerClicked = new DelegateCommand( () => UpdateWorkerMaster()); // 作業者マスタ削除コマンド登録 DeleteWorkerClicked = new DelegateCommand( () => DeleteWorkerMaster()); // 作業者マスタ読み込みコマンド登録(クリックで取得したインスタンスで登録用インスタンスを上書き) WorkerMasterClicked = new DelegateCommand <Object>( (readWorker) => { if (readWorker is WorkerMaster) { // リスト内の要素が選択されている場合のみ、インスタンスを上書きする RegisterWorker = new WorkerMaster((WorkerMaster)readWorker); } }); }