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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDDepartmentEntity.FLD_NAME_Name + " " + SQLConstants.SORT_ORDER_ASCENDING;
                }

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

                mDDepartmentEntityList = FCCMDDepartment.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDDepartmentEntityList ?? new List <MDDepartmentEntity>());
        }
        private void LoadSubDepartments(TreeNode parentDepartment)
        {
            Int64 departmentID = Int64.Parse(parentDepartment.Value);

            IList <MDDepartmentEntity> childDepartmentList = FCCMDDepartment.GetFacadeCreate().GetByParentDepartmentILFC(departmentID);

            if (childDepartmentList != null && childDepartmentList.Count > 0)
            {
                foreach (MDDepartmentEntity ent in childDepartmentList)
                {
                    TreeNode childDepartment = new TreeNode();

                    childDepartment.Text         = ent.Name;
                    childDepartment.Value        = ent.DepartmentID.ToString();
                    childDepartment.SelectAction = TreeNodeSelectAction.Select;
                    childDepartment.ImageUrl     = "~/Images/department-16.png";

                    if (ShowCheckBoxesInAllNodes == true)
                    {
                        childDepartment.ShowCheckBox = true;
                    }

                    LoadSubDepartments(childDepartment);

                    LoadDesignations(childDepartment);

                    parentDepartment.ChildNodes.Add(childDepartment);
                }
            }
        }
        private void BuildTree()
        {
            this.Nodes.Clear();

            departmentList  = FCCMDDepartment.GetFacadeCreate().GetILFC();
            designationList = FCCMDDesignation.GetFacadeCreate().GetILFC();

            BayTreeNodeValue rootNodeValue = new BayTreeNodeValue();

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

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Designation Tree";
            rootNode.Value        = rootNodeValue.GetValueString();
            rootNode.SelectAction = TreeNodeSelectAction.None;
            rootNode.Expanded     = true;



            LoadDepartments(rootNode);

            this.Nodes.Add(rootNode);
        }
        private void LoadSubDepartments(TreeNode parentDepartment)
        {
            Int64 departmentID = Int64.Parse(BayTreeNodeValue.GetValue(parentDepartment.Value));

            IList <MDDepartmentEntity> childDepartmentList = FCCMDDepartment.GetFacadeCreate().GetByParentDepartmentILFC(departmentID);

            if (childDepartmentList != null && childDepartmentList.Count > 0)
            {
                foreach (MDDepartmentEntity ent in childDepartmentList)
                {
                    BayTreeNodeValue childDepartmentNodeValue = new BayTreeNodeValue();
                    childDepartmentNodeValue.Value = ent.DepartmentID.ToString();
                    childDepartmentNodeValue.Attributes["NodeType"] = CustomControlConstants.HRNodeType.Department;

                    TreeNode childDepartment = new TreeNode();

                    childDepartment.Text         = ent.Name;
                    childDepartment.Value        = childDepartmentNodeValue.GetValueString();
                    childDepartment.SelectAction = TreeNodeSelectAction.Select;
                    childDepartment.ImageUrl     = "~/Images/department-16.png";
                    childDepartment.Expanded     = false;

                    if (ShowCheckBoxesInAllNodes == true)
                    {
                        childDepartment.ShowCheckBox = true;
                    }

                    LoadSubDepartments(childDepartment);

                    LoadDesignations(childDepartment);

                    parentDepartment.ChildNodes.Add(childDepartment);
                }
            }
        }
        private void SaveMDDepartmentEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDDepartmentEntity mDDepartmentEntity = BuildMDDepartmentEntity();

                    Int64 result = -1;

                    if (mDDepartmentEntity.IsNew)
                    {
                        result = FCCMDDepartment.GetFacadeCreate().Add(mDDepartmentEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDDepartmentEntity.FLD_NAME_DepartmentID, mDDepartmentEntity.DepartmentID.ToString(), SQLMatchType.Equal);
                        result = FCCMDDepartment.GetFacadeCreate().Update(mDDepartmentEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _DepartmentID       = 0;
                        _MDDepartmentEntity = new MDDepartmentEntity();
                        PrepareInitialView();
                        BindMDDepartmentList();

                        if (mDDepartmentEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Department Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Department Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDDepartmentEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Department Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Department Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDDepartment_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 DepartmentID;

            Int64.TryParse(e.CommandArgument.ToString(), out DepartmentID);

            if (DepartmentID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _DepartmentID = DepartmentID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDepartmentEntity.FLD_NAME_DepartmentID, DepartmentID.ToString(), SQLMatchType.Equal);

                        MDDepartmentEntity mDDepartmentEntity = new MDDepartmentEntity();


                        result = FCCMDDepartment.GetFacadeCreate().Delete(mDDepartmentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _DepartmentID       = 0;
                            _MDDepartmentEntity = new MDDepartmentEntity();
                            PrepareInitialView();
                            BindMDDepartmentList();

                            MiscUtil.ShowMessage(lblMessage, "Department has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Department.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private void BuildTree()
        {
            this.Nodes.Clear();

            departmentList = FCCMDDepartment.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Employee Tree";
            rootNode.Value        = "0";
            rootNode.SelectAction = TreeNodeSelectAction.Select;
            rootNode.Expanded     = true;

            LoadCategories(rootNode);

            this.Nodes.Add(rootNode);
        }
Example #8
0
        private void BuildTree()
        {
            this.Nodes.Clear();

            departmentList = FCCMDDepartment.GetFacadeCreate().GetILFC();

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Department Tree";
            rootNode.Value        = "0";
            rootNode.SelectAction = TreeNodeSelectAction.Select;
            rootNode.Expanded     = true;

            LoadDepartments(rootNode);

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

            try
            {
                mDDepartmentEntityList = FCCMDDepartment.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDDepartmentEntityList ?? new List <MDDepartmentEntity>());
        }
        private void BuildTree()
        {
            this.Nodes.Clear();

            departmentList  = FCCMDDepartment.GetFacadeCreate().GetILFC();
            designationList = FCCMDDesignation.GetFacadeCreate().GetILFC();

            employeeList = FCCResourceEmployee_Custom.GetFacadeCreate().GetIL(1000000, 1, String.Empty, String.Empty);

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Employee Tree";
            rootNode.Value        = "0";
            rootNode.SelectAction = TreeNodeSelectAction.Select;
            rootNode.Expanded     = true;

            LoadDepartments(rootNode);

            this.Nodes.Add(rootNode);
        }