public IList <MDAssetCateogryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <MDAssetCateogryEntity> mDAssetCateogryEntityList = new List <MDAssetCateogryEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = MDAssetCateogryEntity.FLD_NAME_AssetCateogryID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; mDAssetCateogryEntityList = FCCMDAssetCateogry.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (mDAssetCateogryEntityList != null && mDAssetCateogryEntityList.Count > 0) { totalRowCount = mDAssetCateogryEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDAssetCateogryEntityList ?? new List <MDAssetCateogryEntity>()); }
private void LoadSubCategories(TreeNode parentCategory) { Int64 assetCategoryID = Int64.Parse(parentCategory.Value); String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetCateogryEntity.FLD_NAME_ParentAssetCateogryID, assetCategoryID.ToString(), SQLMatchType.Equal); IList <MDAssetCateogryEntity> childItemCategoryList = FCCMDAssetCateogry.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (childItemCategoryList != null && childItemCategoryList.Count > 0) { foreach (MDAssetCateogryEntity ent in childItemCategoryList) { TreeNode childItemCategory = new TreeNode(); childItemCategory.Text = ent.CategoryName; childItemCategory.Value = ent.AssetCateogryID.ToString(); childItemCategory.SelectAction = TreeNodeSelectAction.SelectExpand; if (ShowCheckBoxesInAllNodes == true) { // childItemCategory.ShowCheckBox = true; } parentCategory.ChildNodes.Add(childItemCategory); } } }
protected void lvMDAssetCateogry_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 AssetCateogryID; Int64.TryParse(e.CommandArgument.ToString(), out AssetCateogryID); if (AssetCateogryID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _AssetCateogryID = AssetCateogryID; PrepareEditView(); } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetCateogryEntity.FLD_NAME_AssetCateogryID, AssetCateogryID.ToString(), SQLMatchType.Equal); MDAssetCateogryEntity mDAssetCateogryEntity = new MDAssetCateogryEntity(); result = FCCMDAssetCateogry.GetFacadeCreate().Delete(mDAssetCateogryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _AssetCateogryID = 0; _MDAssetCateogryEntity = new MDAssetCateogryEntity(); PrepareInitialView(); BindMDAssetCateogryList(); MiscUtil.ShowMessage(lblMessage, "Asset Cateogry has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Asset Cateogry.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private void BuildTree() { this.Nodes.Clear(); assetCategoryList = FCCMDAssetCateogry.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); TreeNode rootNode = new TreeNode(); rootNode.Text = "Asset Categories"; rootNode.Value = "0"; rootNode.SelectAction = TreeNodeSelectAction.Select; rootNode.Expanded = true; LoadCategories(rootNode); this.Nodes.Add(rootNode); }
public IList <MDAssetCateogryEntity> GetData() { IList <MDAssetCateogryEntity> mDAssetCateogryEntityList = new List <MDAssetCateogryEntity>(); try { mDAssetCateogryEntityList = FCCMDAssetCateogry.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (mDAssetCateogryEntityList != null && mDAssetCateogryEntityList.Count > 0) { totalRowCount = mDAssetCateogryEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDAssetCateogryEntityList ?? new List <MDAssetCateogryEntity>()); }
private void DeleteItemCategory() { Int64 AssetCategoryID; Int64.TryParse(treeAssetCategory.SelectedValue, out AssetCategoryID); if (AssetCategoryID > 0) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetCateogryEntity.FLD_NAME_AssetCateogryID, AssetCategoryID.ToString(), SQLMatchType.Equal); MDAssetCateogryEntity mDAssetCateogryEntity = new MDAssetCateogryEntity(); result = FCCMDAssetCateogry.GetFacadeCreate().Delete(mDAssetCateogryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _AssetCateogryID = 0; _MDAssetCateogryEntity = new MDAssetCateogryEntity(); PrepareInitialView(); LoadTreeView(); MiscUtil.ShowMessage(lblMessage, "Asset Category has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Asset Category.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void BuildTree() { this.Nodes.Clear(); assetCategoryList = FCCMDAssetCateogry.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); #region Load Main Categories if (assetCategoryList != null && assetCategoryList.Count > 0) { rootAssetCategoryList = (from a in assetCategoryList where a.ParentAssetCateogryID == null select a).ToList(); if (rootAssetCategoryList != null && rootAssetCategoryList.Count > 0) { foreach (MDAssetCateogryEntity ent in rootAssetCategoryList) { TreeNode parentCategory = new TreeNode(); parentCategory.Text = ent.CategoryName; parentCategory.Value = ent.AssetCateogryID.ToString(); parentCategory.SelectAction = TreeNodeSelectAction.Expand; parentCategory.Expanded = false; if (ShowCheckBoxesInAllNodes == true) { // parentCategory.ShowCheckBox = true; } LoadSubCategories(parentCategory); this.Nodes.Add(parentCategory); } } } #endregion }
private void SaveMDAssetCateogryEntity() { if (IsValid) { try { MDAssetCateogryEntity mDAssetCateogryEntity = BuildMDAssetCateogryEntity(); Int64 result = -1; if (mDAssetCateogryEntity.IsNew) { if (treeAssetCategory.SelectedNode != null) { if (treeAssetCategory.SelectedValue == "0") { mDAssetCateogryEntity.ParentAssetCateogryID = null; } else { mDAssetCateogryEntity.ParentAssetCateogryID = Int64.Parse(treeAssetCategory.SelectedValue); } } result = FCCMDAssetCateogry.GetFacadeCreate().Add(mDAssetCateogryEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDAssetCateogryEntity.FLD_NAME_AssetCateogryID, mDAssetCateogryEntity.AssetCateogryID.ToString(), SQLMatchType.Equal); result = FCCMDAssetCateogry.GetFacadeCreate().Update(mDAssetCateogryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _AssetCateogryID = 0; _MDAssetCateogryEntity = new MDAssetCateogryEntity(); PrepareInitialView(); LoadTreeView(); if (mDAssetCateogryEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Asset Cateogry Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Asset Cateogry Information has been updated successfully.", false); } } else { if (mDAssetCateogryEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Asset Cateogry Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Asset Cateogry Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }