Exemple #1
0
        public IList <BDMDTaskEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <BDMDTaskEntity> bDMDTaskEntityList = new List <BDMDTaskEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = BDMDTaskEntity.FLD_NAME_TaskID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                bDMDTaskEntityList = FCCBDMDTask.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(bDMDTaskEntityList ?? new List <BDMDTaskEntity>());
        }
        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);
        }
Exemple #3
0
        public IList <BDMDTaskEntity> GetData()
        {
            IList <BDMDTaskEntity> bDMDTaskEntityList = new List <BDMDTaskEntity>();

            try
            {
                bDMDTaskEntityList = FCCBDMDTask.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(bDMDTaskEntityList ?? new List <BDMDTaskEntity>());
        }
        private void DeleteTask()
        {
            Int64 taskID;

            Int64.TryParse(BayTreeNodeValue.GetValue(treeTask.SelectedValue), out taskID);

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

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskEntity.FLD_NAME_TaskID, taskID.ToString(), SQLMatchType.Equal);

                    BDMDTaskEntity bdMDTaskEntity = new BDMDTaskEntity();


                    result = FCCBDMDTask.GetFacadeCreate().Delete(bdMDTaskEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _TaskID         = 0;
                        _BDMDTaskEntity = new BDMDTaskEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Task has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Task.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        private void SaveBDMDTaskEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDMDTaskEntity bDMDTaskEntity = BuildBDMDTaskEntity();

                    Int64 result = -1;

                    Boolean insertValidation = true;

                    if (bDMDTaskEntity.IsNew)
                    {
                        if (ValidateInput())
                        {
                            if (treeTask.SelectedNode != null)
                            {
                                bDMDTaskEntity.TaskCategoryID = Int64.Parse(BayTreeNodeValue.GetValue(treeTask.SelectedValue));
                            }

                            result = FCCBDMDTask.GetFacadeCreate().Add(bDMDTaskEntity, DatabaseOperationType.Add, TransactionRequired.No);

                            if (result > 0 && chkIsRepeat.Checked == true)
                            {
                                BDMDTaskRepeatEntity bDMDTaskRepeatEntity = BuildBDMDTaskRepeatEntity();
                                bDMDTaskRepeatEntity.TaskID = result;

                                Int64 resultC = -1;

                                resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Add(bDMDTaskRepeatEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }
                        }
                        else
                        {
                            insertValidation = false;
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskEntity.FLD_NAME_TaskID, bDMDTaskEntity.TaskID.ToString(), SQLMatchType.Equal);
                        result = FCCBDMDTask.GetFacadeCreate().Update(bDMDTaskEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);

                        if (result > 0)
                        {
                            String fe = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskID, result.ToString(), SQLMatchType.Equal);
                            IList <BDMDTaskRepeatEntity> lst = FCCBDMDTaskRepeat.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            Int64 resultC = -1;

                            BDMDTaskRepeatEntity bDMDTaskRepeatEntity = BuildBDMDTaskRepeatEntity();
                            bDMDTaskRepeatEntity.TaskID = result;

                            if (chkIsRepeat.Checked == true)
                            {
                                if (lst != null && lst.Count > 0)
                                {
                                    String filterExpression_taskRepeat = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskRepeatID, bDMDTaskRepeatEntity.TaskRepeatID.ToString(), SQLMatchType.Equal);
                                    resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Update(bDMDTaskRepeatEntity, filterExpression_taskRepeat, DatabaseOperationType.Update, TransactionRequired.No);
                                }
                                else
                                {
                                    resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Add(bDMDTaskRepeatEntity, DatabaseOperationType.Add, TransactionRequired.No);
                                }
                            }

                            else if (chkIsRepeat.Checked == false)
                            {
                                if (lst != null && lst.Count > 0)
                                {
                                    String filterExpression_taskRepeat = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskRepeatID, bDMDTaskRepeatEntity.TaskRepeatID.ToString(), SQLMatchType.Equal);
                                    resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Delete(bDMDTaskRepeatEntity, filterExpression_taskRepeat, DatabaseOperationType.Delete, TransactionRequired.No);
                                }
                            }
                        }
                    }

                    if (insertValidation)
                    {
                        if (result > 0)
                        {
                            _TaskID         = 0;
                            _BDMDTaskEntity = new BDMDTaskEntity();
                            PrepareInitialView();
                            BindBDMDTaskList();
                            _TaskRepeatID         = 0;
                            _BDMDTaskRepeatEntity = new BDMDTaskRepeatEntity();
                            PrepareInitialViewRepeat();

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