private void categoryProperties() { DataSources.dsQueries.QryCategoryRow Cat = (DataSources.dsQueries.QryCategoryRow)((DataRowView)tlCategory.GetDataRecordByNode(tlCategory.FocusedNode)).Row; DataSources.dsDataCenter.CategoryRow row = adpCat.GetDataByCategoryId(dsQueries.QryCategory[tlCategory.FocusedNode.Id].CategoryId)[0]; CategoryEditorDLG dlg = new CategoryEditorDLG(row); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) return; try { adpCat.Update(row); dsDataCenter.Category.AcceptChanges(); AppManager.defaultInstance.LogOperation(nsLib.Utilities.Types.LogType.Categoy, row.CategoryId, nsLib.Utilities.Types.LogOpType.Update); //load Categories CategoryDataBinding(); FocusNode(row.CategoryId); DataCenterX.LogMessage("تم تعديل المجلد", typeof(ItemBrowserFrm), nsLib.Utilities.Types.MessageType.Success, null, true); } catch (SqlException ex) { DataCenterX.LogMessage("لم يتم تعديل المجلد", typeof(ItemBrowserFrm), nsLib.Utilities.Types.MessageType.Error, ex, true); } }
private void addMainCategory() { DataSources.dsDataCenter.CategoryRow row = dsDataCenter.Category.NewCategoryRow(); row.ParentID = 0; row.active = true; CategoryEditorDLG dlg = new CategoryEditorDLG(row); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) return; try { row.CategoryId = (int)AppManager.defaultInstance.adpQry.ScalarQueryCategoryNewId(); dsDataCenter.Category.AddCategoryRow(row); adpCat.Update(row); DataManager.defaultInstance.AddDefaultCategoryAndInheritancePrivilages(row.CategoryId); AppManager.defaultInstance.LogOperation(nsLib.Utilities.Types.LogType.Categoy, row.CategoryId, nsLib.Utilities.Types.LogOpType.Inset); //load Categories CategoryDataBinding(); FocusNode(row.CategoryId); DataCenterX.LogMessage("تم اضافة مجلد رئيسي", typeof(ItemBrowserFrm), nsLib.Utilities.Types.MessageType.Success, null, true); } catch (SqlException ex) { DataCenterX.LogMessage("لم يتم اضافة مجلد رئيسي", typeof(ItemBrowserFrm), nsLib.Utilities.Types.MessageType.Error, ex, true); } }