public IList <MDProjectDocumentCategoryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDProjectDocumentCategoryEntity> mDProjectDocumentCategoryEntityList = new List <MDProjectDocumentCategoryEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDProjectDocumentCategoryEntity.FLD_NAME_ProjectDocumentCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                mDProjectDocumentCategoryEntityList = FCCMDProjectDocumentCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (mDProjectDocumentCategoryEntityList != null && mDProjectDocumentCategoryEntityList.Count > 0)
                {
                    totalRowCount = mDProjectDocumentCategoryEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(mDProjectDocumentCategoryEntityList ?? new List <MDProjectDocumentCategoryEntity>());
        }
Exemplo n.º 2
0
        private void PopulateTree()
        {
            this.Nodes.Clear();

            nodeList     = FCCMDProjectDocumentCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);
            documentList = FCCMDProjectDocument.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);
            if (ProjectID > 0)
            {
                String fe_Project_Document = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentInfoEntity.FLD_NAME_ProjectID, ProjectID.ToString(), SQLMatchType.Equal);
                projectDocumentList = FCCBDProjectCollectedDocumentInfo.GetFacadeCreate().GetIL(null, null, String.Empty, fe_Project_Document, DatabaseOperationType.LoadWithFilterExpression);
            }

            TreeNode rootNode = new TreeNode();

            BayTreeNodeValue rootNodeValue = new BayTreeNodeValue();

            rootNodeValue.Value = "0";
            rootNodeValue.Attributes["NodeType"] = CustomControlConstants.DocumentNodeType.RootNode;

            rootNode.Text         = RootNodeText;
            rootNode.Value        = rootNodeValue.GetValueString();
            rootNode.SelectAction = TreeNodeSelectAction.Expand;
            rootNode.Expanded     = true;
            LoadCategories(rootNode, null);

            this.Nodes.Add(rootNode);
        }
        ////[Bindable(true)]
        //[Category("Appearance")]
        //[DefaultValue(false)]
        //[Localizable(true)]
        //public Boolean ShowCheckBoxesInAllNodes
        //{
        //    get
        //    {
        //        return (Boolean)ViewState["BayItemCategoryTree_PROP_ShowCheckBoxesInAllNodes"];
        //    }

        //    set
        //    {
        //        ViewState["BayItemCategoryTree_PROP_ShowCheckBoxesInAllNodes"] = value;
        //    }
        //}

        #endregion

        #region Methods

        private void BuildTree()
        {
            this.Nodes.Clear();

            nodeList = FCCMDProjectDocumentCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Project Document Categories";
            rootNode.Value        = "0";
            rootNode.SelectAction = TreeNodeSelectAction.SelectExpand;
            rootNode.Expanded     = true;

            LoadCategories(rootNode, null);

            this.Nodes.Add(rootNode);
        }
        public IList <MDProjectDocumentCategoryEntity> GetData()
        {
            IList <MDProjectDocumentCategoryEntity> mDProjectDocumentCategoryEntityList = new List <MDProjectDocumentCategoryEntity>();

            try
            {
                mDProjectDocumentCategoryEntityList = FCCMDProjectDocumentCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (mDProjectDocumentCategoryEntityList != null && mDProjectDocumentCategoryEntityList.Count > 0)
                {
                    totalRowCount = mDProjectDocumentCategoryEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(mDProjectDocumentCategoryEntityList ?? new List <MDProjectDocumentCategoryEntity>());
        }
        private void DeleteDocumentCategory()
        {
            Int64 ProjectDocumentCategoryID;

            Int64.TryParse(treeProjectDocumentCategory.SelectedValue, out ProjectDocumentCategoryID);

            if (ProjectDocumentCategoryID > 0)
            {
                try
                {
                    Int64 result = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentCategoryEntity.FLD_NAME_ProjectDocumentCategoryID, ProjectDocumentCategoryID.ToString(), SQLMatchType.Equal);

                    MDProjectDocumentCategoryEntity mDProjectDocumentCategoryEntity = new MDProjectDocumentCategoryEntity();


                    result = FCCMDProjectDocumentCategory.GetFacadeCreate().Delete(mDProjectDocumentCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _ProjectDocumentCategoryID       = 0;
                        _MDProjectDocumentCategoryEntity = new MDProjectDocumentCategoryEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Project Document Category has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Document Category.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        private void SaveMDProjectDocumentCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDProjectDocumentCategoryEntity mDProjectDocumentCategoryEntity = BuildMDProjectDocumentCategoryEntity();

                    Int64 result = -1;

                    if (mDProjectDocumentCategoryEntity.IsNew)
                    {
                        if (treeProjectDocumentCategory.SelectedNode != null)
                        {
                            if (treeProjectDocumentCategory.SelectedValue == "0")
                            {
                                mDProjectDocumentCategoryEntity.ParentProjectDocumentCategoryID = null;
                            }
                            else
                            {
                                mDProjectDocumentCategoryEntity.ParentProjectDocumentCategoryID = Int64.Parse(treeProjectDocumentCategory.SelectedValue);
                            }
                        }

                        result = FCCMDProjectDocumentCategory.GetFacadeCreate().Add(mDProjectDocumentCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentCategoryEntity.FLD_NAME_ProjectDocumentCategoryID, mDProjectDocumentCategoryEntity.ProjectDocumentCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDProjectDocumentCategory.GetFacadeCreate().Update(mDProjectDocumentCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ProjectDocumentCategoryID       = 0;
                        _MDProjectDocumentCategoryEntity = new MDProjectDocumentCategoryEntity();
                        PrepareInitialView();

                        if (mDProjectDocumentCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Document Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Document Category Information has been updated successfully.", false);
                        }

                        LoadTreeView();
                    }
                    else
                    {
                        if (mDProjectDocumentCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Project Document Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Project Document Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }