예제 #1
0
        private void PopulateTree()
        {
            this.Nodes.Clear();

            nodeList = FCCBDMDTaskCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);
            taskList = FCCBDMDTask.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);
        }
        public IList <BDMDTaskCategoryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <BDMDTaskCategoryEntity> bDMDTaskCategoryEntityList = new List <BDMDTaskCategoryEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = BDMDTaskCategoryEntity.FLD_NAME_TaskCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                bDMDTaskCategoryEntityList = FCCBDMDTaskCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(bDMDTaskCategoryEntityList ?? new List <BDMDTaskCategoryEntity>());
        }
        ////[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 = FCCBDMDTaskCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            TreeNode rootNode = new TreeNode();

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

            LoadCategories(rootNode, null);

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

            try
            {
                bDMDTaskCategoryEntityList = FCCBDMDTaskCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(bDMDTaskCategoryEntityList ?? new List <BDMDTaskCategoryEntity>());
        }
        private void DeleteTaskCategory()
        {
            Int64 taskCategoryID;

            Int64.TryParse(treeTaskCategory.SelectedValue, out taskCategoryID);

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

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskCategoryEntity.FLD_NAME_TaskCategoryID, taskCategoryID.ToString(), SQLMatchType.Equal);

                    BDMDTaskCategoryEntity bDMDTaskCategoryEntity = new BDMDTaskCategoryEntity();

                    result = FCCBDMDTaskCategory.GetFacadeCreate().Delete(bDMDTaskCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _TaskCategoryID         = 0;
                        _BDMDTaskCategoryEntity = new BDMDTaskCategoryEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Task Category has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Task Category.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        private void SaveBDMDTaskCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDMDTaskCategoryEntity bDMDTaskCategoryEntity = BuildBDMDTaskCategoryEntity();

                    Int64 result = -1;

                    if (bDMDTaskCategoryEntity.IsNew)
                    {
                        if (treeTaskCategory.SelectedNode != null)
                        {
                            if (treeTaskCategory.SelectedValue == "0")
                            {
                                bDMDTaskCategoryEntity.ParentTaskCategoryID = null;
                            }
                            else
                            {
                                bDMDTaskCategoryEntity.ParentTaskCategoryID = Int64.Parse(treeTaskCategory.SelectedValue);
                            }
                        }

                        result = FCCBDMDTaskCategory.GetFacadeCreate().Add(bDMDTaskCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskCategoryEntity.FLD_NAME_TaskCategoryID, bDMDTaskCategoryEntity.TaskCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCBDMDTaskCategory.GetFacadeCreate().Update(bDMDTaskCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _TaskCategoryID         = 0;
                        _BDMDTaskCategoryEntity = new BDMDTaskCategoryEntity();
                        PrepareInitialView();
                        LoadTreeView();

                        if (bDMDTaskCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Task Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Task Category Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (bDMDTaskCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Task Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Task Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }