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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDProjectDocumentEntity.FLD_NAME_ProjectDocumentID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDProjectDocumentEntityList = FCCMDProjectDocument.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDProjectDocumentEntityList ?? new List <MDProjectDocumentEntity>());
        }
Пример #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);
        }
        public IList <MDProjectDocumentEntity> GetData()
        {
            IList <MDProjectDocumentEntity> mDProjectDocumentEntityList = new List <MDProjectDocumentEntity>();

            try
            {
                mDProjectDocumentEntityList = FCCMDProjectDocument.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDProjectDocumentEntityList ?? new List <MDProjectDocumentEntity>());
        }
        private void DeleteDocument()
        {
            Int64 ProjectDocumentID;

            Int64.TryParse(BayTreeNodeValue.GetValue(treeProjectDocument.SelectedValue), out ProjectDocumentID);

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

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentEntity.FLD_NAME_ProjectDocumentID, ProjectDocumentID.ToString(), SQLMatchType.Equal);

                    MDProjectDocumentEntity mDProjectDocumentEntity = new MDProjectDocumentEntity();


                    result = FCCMDProjectDocument.GetFacadeCreate().Delete(mDProjectDocumentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _ProjectDocumentID       = 0;
                        _MDProjectDocumentEntity = new MDProjectDocumentEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Project Document has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Document.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        private void SaveMDProjectDocumentEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDProjectDocumentEntity mDProjectDocumentEntity = BuildMDProjectDocumentEntity();

                    Int64 result = -1;

                    Boolean insertValidation = true;

                    if (mDProjectDocumentEntity.IsNew)
                    {
                        if (ValidateInput())
                        {
                            if (treeProjectDocument.SelectedNode != null)
                            {
                                mDProjectDocumentEntity.ProjectDocumentCategoryID = Int64.Parse(BayTreeNodeValue.GetValue(treeProjectDocument.SelectedValue));
                            }

                            result = FCCMDProjectDocument.GetFacadeCreate().Add(mDProjectDocumentEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            insertValidation = false;
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentEntity.FLD_NAME_ProjectDocumentID, mDProjectDocumentEntity.ProjectDocumentID.ToString(), SQLMatchType.Equal);
                        result = FCCMDProjectDocument.GetFacadeCreate().Update(mDProjectDocumentEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (insertValidation)
                    {
                        if (result > 0)
                        {
                            _ProjectDocumentID       = 0;
                            _MDProjectDocumentEntity = new MDProjectDocumentEntity();
                            PrepareInitialViewForm();

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

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