/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CategoryList_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DragItem)) { int index = GetCurrentIndex(e.GetPosition); if (-1 == index) { return; } var category = this._categoryList[index]; var item = e.Data.GetData(DragItem) as ItemModel; item.CategoryId = category.Id; using (var table = new ItemsTable(this._profileDatabase)) { item.RowOrder = table.SelectMaxRowOrderByCategoryId(item.CategoryId); int count = table.UpdateById(item); if (count <= 0) { AppCommon.ShowErrorMsg(string.Format(ErrorMsg.FailToUpdate, "item")); return; } this._itemList.Remove(item); } } }