private void OnResourceDeleted(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnResourceDeleted, model); return; } String textBoxText = resource_display.Text; if (model.Display == 'd') { if (textBoxText.ToLower().Contains(model.Resource.Title.ToLower())) { controller.ChangeToListMode(); } } else if (model.Display == 'e') { if (post_title.Text.ToLower().Equals(model.Resource.Title.ToLower())) { controller.ChangeToListMode(); } } }
private void OnResourceVoteChecked(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnResourceVoteChecked, model); return; } if (model.Display == 'd') { if (model.My_Votes.ContainsKey(model.Resource.Id)) { det_res_vote.Rating = model.My_Votes[model.Resource.Id]; } } foreach (RatingControl key in resourceVoteWidgets.Keys) { ResourceData res = resourceVoteWidgets[key]; if (model.My_Votes.ContainsKey(res.Id)) { key.Rating = model.My_Votes[res.Id]; } } }
private void OnResourceEdited(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnResourceEdited, model); return; } if (model.Display == 'e') { if (notification_label.Text.Equals("Edit request sent")) { DeactivateEditMode(); back_to_list_button.Visible = true; back_to_resource_button.Visible = true; notification_label.Visible = true; notification_label.Text = "Resource successfully edited"; } } else { OnDisplayModeChanged(model); } }
private void OnUserDomainValidationChecked(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnUserDomainValidationChecked, model); return; } Boolean found = false; foreach (DomainData dom in model.User_Domains) { if (model.Domain.ID == dom.ID) { found = true; break; } } if (found == false) { // deactivate post post_button.Enabled = false; } else { // activate post post_button.Enabled = true; } }
public ActionResult AddShelf(ShelfModel shelf) { try { if (ModelState.IsValid) { ShelfRepository ShelfRepo = new ShelfRepository(); ShelfRepo.AddShelf(shelf); var profileData = this.Session["UserProfile"] as UserSession; LogModel logModel = new LogModel() { UserId = profileData.UserID, TableName = "Shelf", Activity = "Added Shelf", LogDate = DateTime.Now }; logRepository logRepository = new logRepository(); logRepository.AddLog(logModel); } return(RedirectToAction("GetAllShelfDetails")); } catch { return(RedirectToAction("GetAllShelfDetails")); } }
/// <summary>メニュー クリックイベント</summary> /// <param name="sender">発生元オブジェクト</param> /// <param name="e">イベントデータ</param> private void SyncBaseFolderMenuItem_Click(object sender, EventArgs e) { // ベースフォルダのチェック var workFolders = new List <string> { Path.GetDirectoryName(this.shelf.FilePath) }; // ベースフォルダの確認 var failedBaseFolders = workFolders.Where(b => Directory.Exists(b) == false); if (failedBaseFolders.Count() > 0) { string message = string.Join(Environment.NewLine, failedBaseFolders); string.Format(Resources.ErrorBookListBaseFolderNotFound, message); MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } // 同期直前のデータ保存 this.shelf.Columns = this.DetailList.GetColumns(); this.shelf.WriteJson(); this.shelf = null; this.DialogResult = DialogResult.Retry; this.Close(); using (var form = new SyncForm()) { form.Owner = this; this.Enabled = false; form.Show(workFolders[0]); this.Enabled = true; } }
/// <summary> /// フォームをモーダルダイアログとして表示します。 /// </summary> /// <param name="filePath">ファイルパス</param> /// <returns>結果</returns> public DialogResult ShowDialog(string filePath) { this.shelf = new ShelfModel().ReadJson(filePath); this.shelf.FilePath = filePath; return(this.ShowDialog()); }
/// <summary>選択されたファイルによって、フォームを表示する</summary> private void ShowShelf() { this.shelfDictionary.Clear(); foreach (string filePath in Settings.Default.Shelfs) { string title = string.Empty; try { var targetShelf = new ShelfModel(); targetShelf = targetShelf.ReadJson(filePath); title = String.IsNullOrEmpty(targetShelf.Title) ? filePath : targetShelf.Title; this.shelfDictionary.Add(filePath, title); } catch (Exception) { } this.ShelfListBox.Items.Clear(); foreach (var k in this.shelfDictionary.Values) { this.ShelfListBox.Items.Add(k); } } }
/// <summary>「本棚ファイルリストビュー」ダブルクリックイベント</summary> /// <param name="sender">発生元オブジェクト</param> /// <param name="e">イベント情報</param> private void SelectListView_DoubleClick(object sender, EventArgs e) { if (this.SelectListView.SelectedItems.Count != 0) { var shelf = new ShelfModel().ReadJson(this.SelectListView.SelectedItems[0].SubItems[1].Text); this.ShelfPath = shelf.FilePath; this.DialogResult = DialogResult.OK; this.Hide(); } }
private void OnDisplayModeChanged(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnDisplayModeChanged, model); return; } switch (model.Display) { case 'l': DeactivateDetailedMode(); DeactivateEditMode(); DeactivatePostMode(); ActivateListMode(); break; case 'd': DeactivateListMode(); DeactivateEditMode(); DeactivatePostMode(); ActivateDetailedMode(model.Resource, model.Resource_Owner); break; case 'p': DeactivateListMode(); DeactivateDetailedMode(); DeactivateEditMode(); ActivatePostMode(); break; case 'e': DeactivateListMode(); DeactivateDetailedMode(); DeactivatePostMode(); ActivateEditMode(); post_title.Text = model.Resource.Title; post_description.Text = model.Resource.Description; post_links.Text = model.Resource.Links; break; } }
private void OnSearchListUpdated(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnSearchListUpdated, model); return; } ShowResources(model); }
public ActionResult Index() { var model = new ShelfModel(); using (var db = StorageService.Instance.DbFactory.OpenDbConnection()) { model.Books = db.Select <Book>(); } if (Request.Headers["X-PJAX"] == "true") { Response.Headers["X-PJAX-URL"] = "/Shelf"; return(PartialView("Index", model)); } return(View(model)); }
private void ShelfListBox_SelectedIndexChanged(object sender, EventArgs e) { string filePath = Settings.Default.Shelfs[this.ShelfListBox.SelectedIndex]; if (!Directory.Exists(filePath)) { return; } this.distShelf = new ShelfModel(); this.distShelf = this.distShelf.ReadJson(filePath); var dirs = Directory.GetDirectories(filePath); this.FolderListBox.Items.Clear(); this.FolderListBox.Items.Add(Path.GetDirectoryName(filePath)); this.FolderListBox.Items.AddRange(dirs); this.FolderListBox.Enabled = true; }
public void UpdateShelf(string ArticleID, int SL) { try { DataTable dt = TextUtils.GetDataTableFromSP("spLoadSLShelf", new string[] { "@ArticleID" }, new object[] { ArticleID }); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { ShelfModel shelfModel = new ShelfModel(); shelfModel = (ShelfModel)ShelfBO.Instance.FindByAttribute("ShelfCode", TextUtils.ToString(dt.Rows[i]["Shelf"]).Trim())[0]; shelfModel.ShelfNumber = shelfModel.ShelfNumber - TextUtils.ToInt(dt.Rows[i]["SL"]); ShelfBO.Instance.Update(shelfModel); } } } catch (Exception) { } }
//To Add public bool AddShelf(ShelfModel obj) { Connection(); SqlCommand com = new SqlCommand("AddNewShelf", _connect); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@RackNo", obj.RackNo); _connect.Open(); var i = com.ExecuteNonQuery(); _connect.Close(); if (i >= 1) { return(true); } else { return(false); } }
public async Task <IActionResult> PutShelf(Guid id, [FromBody] ShelfModel model) { var shelf = new ShelfModel() { Id = id, Name = model.Name, SideId = model.SideId, }; try { _context.Entry(shelf).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok(shelf)); } catch (Exception ex) { throw ex; } }
private void OnResourcePosted(ShelfModel model) { while (!this.IsHandleCreated) { ; } if (this.InvokeRequired) { this.Invoke((ShelfController.ExternalEventHandler) OnResourcePosted, model); return; } if (model.Display == 'p' && notification_label.Text.Equals("Request sent")) { DeactivatePostMode(); back_to_list_button.Visible = true; notification_label.Visible = true; notification_label.Text = "Resource sucessfully posted"; } }
//POST : /api/Warehouse/shelf/post public async Task <Object> PostShelf(ShelfModel model) { var shelf = new ShelfModel() { Id = Guid.NewGuid(), Name = model.Name, SideId = model.SideId, }; try { var result = await _context.Shelf.AddAsync(shelf); await _context.SaveChangesAsync(); return(Ok(shelf)); } catch (Exception ex) { throw ex; } }
/// <summary>ベースフォルダが指定されている場合、ベースフォルダを検索し、登録されていないデータを新たに登録します</summary> /// <param name="baseFolderPath">ベースフォルダリスト</param> /// <exception cref="DirectoryNotFoundException">ベースフォルダが存在しない。または指定されていない</exception> public static void SyncBaseFolder(string baseFolderPath) { shelf = shelf.ReadJson(baseFolderPath); Array.ForEach(shelf.Books.ToArray(), b => b.Status = AnalyzeResult.NotRunning); foreach (var b in shelf.Books.Where(b => sortedbooks.ContainsKey(b.Hash))) { sortedbooks.Add(b.Hash, b); } // ファイルの検索と除外処理 var syncPaths = new HashSet <string>(shelf.Books.Select(b => b.FilePath.ToLower()).OrderBy(v => v)); IEnumerable <string> files = GetAllFiles(baseFolderPath, "*").AsParallel(); files = files.Where(f => extensions.Contains(Path.GetExtension(f).ToLower())); var count = files.Count(); files = files.Where(f => !syncPaths.Contains(f.ToLower())); Console.WriteLine($"ファイル>書籍ファイル総数:{count},新規・変更数:{files.Count()}"); foreach (var filePath in files) { var book = new BookModel(filePath); book = CheckHash(book); Console.WriteLine($"{LabelAttributeUtils.GetLabelName(book.Status)}>{book.FilePath}"); } var books = shelf.Books.Where(b => b.Status == AnalyzeResult.NotRunning); foreach (var book in books) { if (!book.FileExists()) { book.Status = AnalyzeResult.FileNotFound; Console.WriteLine($"{LabelAttributeUtils.GetLabelName(book.Status)}>{book.FilePath}"); } } shelf.WriteJson(); }
/// <summary>ラベル編集完了イベント</summary> /// <param name="sender">発生元オブジェクト</param> /// <param name="e">イベント情報</param> private void SelectListView_AfterLabelEdit(object sender, LabelEditEventArgs e) { if (string.IsNullOrWhiteSpace(e.Label)) { e.CancelEdit = true; return; } try { var target = (ListView)sender; var filePath = target.Items[e.Item].SubItems[1].Text; var shelf = new ShelfModel().ReadJson(filePath); shelf.Title = e.Label; shelf.WriteJson(); this.ShowBooksList(); } catch { MessageBox.Show(this, "変更できませんでした。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); e.CancelEdit = true; } }
protected ShelfFacade(ShelfModel model) : base(model) { }
private void ShowResources(ShelfModel model) { List <ResourceData> resList = new List <ResourceData>(); resList.AddRange(model.Resources); resList = sortListItems(resList); resourceLabels.Clear(); resourceVoteWidgets.Clear(); panel1.Controls.Clear(); panel1.SuspendLayout(); panel2.Controls.Clear(); panel2.SuspendLayout(); int index1 = 0; int index2 = 0; foreach (ResourceData res in resList) { RatingControl voteWidget = new RatingControl(); if (res.Category == 0) { voteWidget.Location = new Point(0, 2 * (index1) * lineHeight); } else { voteWidget.Location = new Point(0, 2 * (index2) * lineHeight); } voteWidget.AutoSize = false; voteWidget.Scale(new SizeF((float)0.45, (float)0.5)); voteWidget.Fixed = false; voteWidget.SelectRating += new Rating.RatingControl.SelectRatingHandler(this.onVoteWidgetClick); if (model.My_Votes.ContainsKey(res.Id)) { voteWidget.Rating = model.My_Votes[res.Id]; } else { controller.CheckResourceVote(res); } resourceVoteWidgets.Add(voteWidget, res); if (res.Category == 0) { panel1.Controls.Add(voteWidget); } else { panel2.Controls.Add(voteWidget); } Label resourceLabel = new Label(); resourceLabel.Font = new Font("Courier New", 8, FontStyle.Bold); resourceLabel.Text = res.ToString(); if (res.Category == 0) { resourceLabel.Location = new Point(70, (index1++) * lineHeight); } else { resourceLabel.Location = new Point(70, (index2++) * lineHeight); } resourceLabel.AutoSize = false; resourceLabel.Size = new Size(panel1.Width - 72, lineHeight); resourceLabel.Click += new System.EventHandler(this.OnResourceClick); resourceLabel.MouseEnter += new System.EventHandler(this.ColorResourceLabel); resourceLabel.MouseLeave += new System.EventHandler(this.UncolorResourceLabel); resourceLabels.Add(resourceLabel, res); if (res.Category == 0) { panel1.Controls.Add(resourceLabel); } else { panel2.Controls.Add(resourceLabel); } } panel1.ResumeLayout(); panel2.ResumeLayout(); }
public async Task <bool> AddShelf(ShelfModel Shelf) { await Task.Delay(1000); return(true); }
/// <summary>コンストラクタ</summary> /// <param name="bl">マネージャ</param> public SettingForm(ShelfModel bl) { this.InitializeComponent(); this.Shelf = bl; }