Exemple #1
0
        private void CreateTreeView(TreeList fld_trlstUserGroup, List <ADUserGroupsInfo> lstNodeName, TreeListNode ParentNode)
        {
            fld_trlstUserGroup.BeginUnboundLoad();
            TreeListNode treeListNode;

            treeListNode = fld_trlstUserGroup.AppendNode(new object[] { "Nhóm người dùng", 0 }, ParentNode);
            for (int i = 0; i < lstNodeName.Count; i++)
            {
                treeListNode             = fld_trlstUserGroup.AppendNode(new object[] { lstNodeName[i].ADUserGroupName, 1 }, 0);
                treeListNode.Tag         = lstNodeName[i].ADUserGroupID;
                treeListNode.HasChildren = HasChild(lstNodeName[i].ADUserGroupID);

                if (treeListNode.HasChildren)
                {
                    ADUserGroupSectionsController objUserGroupSectionsController = new ADUserGroupSectionsController();
                    DataSet dsUserGroupChild = objUserGroupSectionsController.GetUserGroupSectionByUserGroupID(lstNodeName[i].ADUserGroupID);
                    if (dsUserGroupChild != null)
                    {
                        foreach (DataRow row in dsUserGroupChild.Tables[0].Rows)
                        {
                            ADUserGroupSectionsInfo objADUserGroupSectionsInfo = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectFromDataRow(row);
                            if (objADUserGroupSectionsInfo != null)
                            {
                                TreeListNode treeListChildNode = fld_trlstUserGroup.AppendNode(new object[] { objADUserGroupSectionsInfo.ADUserGroupSectionName, treeListNode.Level + 1 }, treeListNode);
                                treeListChildNode.Tag = objADUserGroupSectionsInfo.ADUserGroupSectionID;
                                AddModuleNode(fld_trlstUserGroup, objADUserGroupSectionsInfo.ADUserGroupSectionID, treeListChildNode);
                            }
                        }
                    }
                }
            }
            fld_trlstUserGroup.EndUnboundLoad();
        }
Exemple #2
0
        public void InitializeModuleSection()
        {
            TreeListNode node = treeList.FocusedNode;

            if (node != null)
            {
                ADUserGroupSectionsController objUserGroupSectionsController = new ADUserGroupSectionsController();
                ADUserGroupSectionsInfo       objADUserGroupSectionsInfo     = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectByID(Convert.ToInt32(node.Tag));
                if (objADUserGroupSectionsInfo != null)
                {
                    STModuleToUserGroupSectionsController objModuleToUserGroupSectionsController = new STModuleToUserGroupSectionsController();
                    DataSet ds = objModuleToUserGroupSectionsController.GetAllModuleToUserGroupSectionByUserGroupSectionID(objADUserGroupSectionsInfo.ADUserGroupSectionID);
                    if (ds != null)
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            STModuleToUserGroupSectionsInfo objSTModuleToUserGroupSectionsInfo = (STModuleToUserGroupSectionsInfo) new STModuleToUserGroupSectionsController().GetObjectFromDataRow(row);
                            if (objADUserGroupSectionsInfo != null)
                            {
                                STModulesInfo objSTModulesInfo = (STModulesInfo) new STModulesController().GetObjectByID(objSTModuleToUserGroupSectionsInfo.FK_STModuleID);
                                if (objSTModulesInfo != null)
                                {
                                    lstModule.Add(objSTModulesInfo);
                                }
                            }
                        }
                    }
                }
            }
            fld_dgcModuleActivesGridControl.DataSource = lstModule;
            fld_dgcModuleActivesGridControl.RefreshDataSource();
        }
Exemple #3
0
        private void fld_btnAddSection_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(fld_txtSection.Text))
            {
                MessageBox.Show("Tên nhóm module không được để trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ADUserGroupSectionsController objUserGroupSectionsController = new ADUserGroupSectionsController();

            if (Mode == AddSectionMode.Add)
            {
                ADUserGroupSectionsInfo objADUserGroupSectionsInfo = new ADUserGroupSectionsInfo();
                objADUserGroupSectionsInfo.FK_ADUserGroupID       = Convert.ToInt32(TreeList.FocusedNode.Tag);
                objADUserGroupSectionsInfo.ADUserGroupSectionName = fld_txtSection.Text;
                objADUserGroupSectionsInfo.ADUserGroupSectionDesc = objADUserGroupSectionsInfo.ADUserGroupSectionName;
                int maxOrder = objUserGroupSectionsController.GetMaxSortOrderSectionByUserGroupID(objADUserGroupSectionsInfo.FK_ADUserGroupID);
                objADUserGroupSectionsInfo.ADUserGroupSectionSortOrder = maxOrder + 1;
                objUserGroupSectionsController.CreateObject(objADUserGroupSectionsInfo);
            }
            else if (Mode == AddSectionMode.Edit)
            {
                ADUserGroupSectionsInfo objADUserGroupSectionsInfo = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectByID(Convert.ToInt32(TreeList.FocusedNode.Tag));
                objADUserGroupSectionsInfo.ADUserGroupSectionName = fld_txtSection.Text;
                objADUserGroupSectionsInfo.ADUserGroupSectionDesc = fld_txtSection.Text;
                objUserGroupSectionsController.UpdateObject(objADUserGroupSectionsInfo);
            }
            ((UserManagementModule)this.Module).InitializeTreeList(TreeList);
            this.Close();
        }
Exemple #4
0
        private void fld_trlstUserGroup_DragDrop(object sender, DragEventArgs e)
        {
            TreeListHitInfo hitInfo    = fld_treeUserGroup.CalcHitInfo(fld_treeUserGroup.PointToClient(new Point(e.X, e.Y)));
            TreeListNode    targetNode = hitInfo.Node;
            TreeListNode    sourceNode = downHitInfo.Node;

            if (targetNode != null)
            {
                if (targetNode.Level == 3 && sourceNode.Level == 3 && targetNode.ParentNode == sourceNode.ParentNode)
                {
                    STModuleToUserGroupSectionsController objSTModuleToUserGroupSectionController = new STModuleToUserGroupSectionsController();
                    STModuleToUserGroupSectionsInfo       objModuleToUserGroupSectionsInfoSource  = (STModuleToUserGroupSectionsInfo)objSTModuleToUserGroupSectionController.GetModuleToUserGroupSectionByUserGroupSectionIDAndModuleID((int)sourceNode.ParentNode.Tag, (int)sourceNode.Tag);
                    STModuleToUserGroupSectionsInfo       objModuleToUserGroupSectionsInfoTarget  = (STModuleToUserGroupSectionsInfo)objSTModuleToUserGroupSectionController.GetModuleToUserGroupSectionByUserGroupSectionIDAndModuleID((int)targetNode.ParentNode.Tag, (int)targetNode.Tag);

                    int sortOrderSrc = objModuleToUserGroupSectionsInfoSource.STModuleToUserGroupSectionSortOrder;
                    objModuleToUserGroupSectionsInfoSource.STModuleToUserGroupSectionSortOrder = objModuleToUserGroupSectionsInfoTarget.STModuleToUserGroupSectionSortOrder;
                    objModuleToUserGroupSectionsInfoTarget.STModuleToUserGroupSectionSortOrder = sortOrderSrc;

                    //Update
                    objSTModuleToUserGroupSectionController.UpdateObject(objModuleToUserGroupSectionsInfoSource);
                    objSTModuleToUserGroupSectionController.UpdateObject(objModuleToUserGroupSectionsInfoTarget);
                    ((UserManagementModule)Module).InitializeTreeList(fld_treeUserGroup);
                }
                else if (targetNode.Level == 2 && sourceNode.Level == 2 && targetNode.ParentNode == sourceNode.ParentNode)
                {
                    ADUserGroupSectionsController objUserGroupSectionsController = new ADUserGroupSectionsController();
                    ADUserGroupSectionsInfo       objUserGroupSectionsInfoSource = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectByID((int)sourceNode.Tag);
                    ADUserGroupSectionsInfo       objUserGroupSectionsInfoTarget = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectByID((int)targetNode.Tag);

                    int sortOrderSrc = objUserGroupSectionsInfoSource.ADUserGroupSectionSortOrder;
                    objUserGroupSectionsInfoSource.ADUserGroupSectionSortOrder = objUserGroupSectionsInfoTarget.ADUserGroupSectionSortOrder;
                    objUserGroupSectionsInfoTarget.ADUserGroupSectionSortOrder = sortOrderSrc;

                    //Update
                    objUserGroupSectionsController.UpdateObject(objUserGroupSectionsInfoSource);
                    objUserGroupSectionsController.UpdateObject(objUserGroupSectionsInfoTarget);
                    ((UserManagementModule)Module).InitializeTreeList(fld_treeUserGroup);
                }
                else
                {
                    return;
                }
            }
        }
Exemple #5
0
 private void fld_btnSaveMUGSection_Click(object sender, EventArgs e)
 {
     using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
     {
         try
         {
             TreeListNode node = treeList.FocusedNode;
             if (node != null)
             {
                 ADUserGroupSectionsInfo objADUserGroupSectionsInfo = (ADUserGroupSectionsInfo) new ADUserGroupSectionsController().GetObjectByID(Convert.ToInt32(node.Tag));
                 if (objADUserGroupSectionsInfo != null)
                 {
                     //delete all
                     new STModuleToUserGroupSectionsController().DeleteAllModuleToUserGroupSectionByUserGroupSectionID(objADUserGroupSectionsInfo.ADUserGroupSectionID);
                     int iSortOrder = 0;
                     foreach (STModulesInfo objSTModulesInfo in lstModule)
                     {
                         iSortOrder++;
                         STModuleToUserGroupSectionsInfo objSTModuleToUserGroupSectionsInfo = new STModuleToUserGroupSectionsInfo();
                         objSTModuleToUserGroupSectionsInfo.FK_STModuleID        = objSTModulesInfo.STModuleID;
                         objSTModuleToUserGroupSectionsInfo.STUserGroupSectionID = objADUserGroupSectionsInfo.ADUserGroupSectionID;
                         objSTModuleToUserGroupSectionsInfo.STModuleToUserGroupSectionSortOrder = iSortOrder;
                         new STModuleToUserGroupSectionsController().CreateObject(objSTModuleToUserGroupSectionsInfo);
                     }
                 }
             }
             scope.Complete();
         }
         catch (Exception ex)
         {
             scope.Dispose();
         }
     }
     ((UserManagementModule)this.Module).InitializeTreeList(treeList);
     this.Close();
 }