Пример #1
0
 protected void ChangeOrganizationUnitBtn_Click(object sender, EventArgs e)
 {
     if (this.OrganizationTreeView.CheckedNodes.Count == 1)
     {
         TreeNode  newParentNode   = this.OrganizationTreeView.CheckedNodes[0];
         NodeValue parentNodeValue = NodeValue.Parse(newParentNode.Value);
         if (parentNodeValue.OType == NodeValue.ValueType.OU)
         {
             if (parentNodeValue.IsActive)
             {
                 TreeNode  childNode      = this.OrganizationTreeView.SelectedNode;
                 NodeValue childNodeValue = NodeValue.Parse(childNode.Value);
                 this.AuthBLL.SetPositionParentOU(childNodeValue.ObjectId, parentNodeValue.ObjectId);
                 childNode.Parent.ChildNodes.Remove(childNode);
                 newParentNode.ChildNodes.Add(childNode);
                 this.OrganizationTreeView_SelectedNodeChanged(null, null);
             }
             else
             {
                 PageUtility.ShowModelDlg(this, "目标组织机构处于非激活状态,不能迁移");
                 return;
             }
         }
         else
         {
             PageUtility.ShowModelDlg(this, "请先选择目标组织机构");
             return;
         }
     }
     else
     {
         PageUtility.ShowModelDlg(this, "请选择唯一目标组织机构");
         return;
     }
 }
Пример #2
0
 protected void UpdatePositionBtn_Click(object sender, EventArgs e)
 {
     try {
         NodeValue  nodeValue       = NodeValue.Parse(this.OrganizationTreeView.SelectedNode.Value);
         List <int> positionTypeIds = new List <int>();
         foreach (ListItem li in this.PositionTypeCtl.Items)
         {
             if (li.Selected)
             {
                 if (li.Value.Length > 0)
                 {
                     positionTypeIds.Add(int.Parse(li.Value));
                 }
                 else
                 {
                     positionTypeIds.Clear();
                     break;
                 }
             }
         }
         this.AuthBLL.UpdatePosition(nodeValue.ObjectId, this.PositionNameCtl.Text, positionTypeIds);
         AuthorizationDS.PositionRow position = this.AuthBLL.ActivePosition(nodeValue.ObjectId, this.PositionIsActiveCtl.Checked);
         this.SetTreeNode(this.OrganizationTreeView.SelectedNode, position);
     } catch (ApplicationException ex) {
         PageUtility.DealWithException(this, ex);
     }
 }
Пример #3
0
    protected void AddOrganizationUnitBtn_Click(object sender, EventArgs e)
    {
        TreeNode  parentNode      = this.OrganizationTreeView.SelectedNode;
        NodeValue parentNodeValue = NodeValue.Parse(parentNode.Value);
        string    strTypeId       = this.NewUnitTypeCtl.SelectedValue;
        int?      typeId          = null;

        if (strTypeId.Length == 0)
        {
            typeId = null;
        }
        else
        {
            typeId = int.Parse(strTypeId);
        }
        int?costCenterID = null;

        if (this.NewCostCenterDDL.SelectedValue != "0")
        {
            costCenterID = int.Parse(this.NewCostCenterDDL.SelectedValue);
        }

        AuthorizationDS.OrganizationUnitRow newOU = this.AuthBLL.AddOrganizationUnit(this.NewUnitNameCtl.Text, this.NewUnitCodeCtl.Text, parentNodeValue.ObjectId, typeId, costCenterID);
        parentNode.ChildNodes.Add(NewTreeNode(newOU));
        this.ClearNewOUPanel();
    }
Пример #4
0
    protected void AddPositionBtn_Click(object sender, EventArgs e)
    {
        NodeValue  nodeValue       = NodeValue.Parse(this.OrganizationTreeView.SelectedNode.Value);
        List <int> positionTypeIds = new List <int>();

        foreach (ListItem li in this.NewPositionTypeCtl.Items)
        {
            if (li.Selected)
            {
                if (li.Value.Length > 0)
                {
                    positionTypeIds.Add(int.Parse(li.Value));
                }
                else
                {
                    positionTypeIds.Clear();
                    break;
                }
            }
        }
        AuthorizationDS.PositionRow newPosition = this.AuthBLL.AddPosition(this.NewPositionNameCtl.Text, nodeValue.ObjectId, positionTypeIds);

        TreeNode childNode = new TreeNode();

        this.SetTreeNode(childNode, newPosition);
        this.OrganizationTreeView.SelectedNode.ChildNodes.Add(childNode);
    }
Пример #5
0
    protected void DeletePositionBtn_Click(object sender, EventArgs e)
    {
        NodeValue nodeValue = NodeValue.Parse(this.OrganizationTreeView.SelectedNode.Value);

        try {
            this.AuthBLL.DeletePosition(nodeValue.ObjectId);
            this.OrganizationTreeView.SelectedNode.Parent.ChildNodes.Remove(this.OrganizationTreeView.SelectedNode);
            this.OrganizationTreeView_SelectedNodeChanged(null, null);
        } catch (ApplicationException ex) {
            PageUtility.DealWithException(this, ex);
        }
    }
Пример #6
0
    private void UpdateTreeNode(TreeNode treeNode)
    {
        foreach (TreeNode childNode in treeNode.ChildNodes)
        {
            UpdateTreeNode(childNode);
        }
        NodeValue nodeValue = NodeValue.Parse(treeNode.Value);

        switch (nodeValue.OType)
        {
        case NodeValue.ValueType.OU:
            this.SetTreeNode(treeNode, this.AuthBLL.GetOrganizationUnitById(nodeValue.ObjectId));
            break;

        case NodeValue.ValueType.Position:
            this.SetTreeNode(treeNode, this.AuthBLL.GetPositionById(nodeValue.ObjectId));
            break;
        }
    }
Пример #7
0
    protected void DeleteOrganizationUnitBtn_Click(object sender, EventArgs e)
    {
        TreeNode  node      = this.OrganizationTreeView.SelectedNode;
        NodeValue nodeValue = NodeValue.Parse(node.Value);

        try {
            this.AuthBLL.DeleteOrganizationUnit(nodeValue.ObjectId);
            if (node.Parent != null)
            {
                node.Parent.ChildNodes.Remove(node);
            }
            else
            {
                this.OrganizationTreeView.Nodes.Remove(node);
            }
            this.OrganizationTreeView_SelectedNodeChanged(null, null);
        } catch (ApplicationException ex) {
            PageUtility.DealWithException(this, ex);
        }
    }
Пример #8
0
    protected void UpdataOrganizationUnitBtn_Click(object sender, EventArgs e)
    {
        try {
            NodeValue nodeValue = NodeValue.Parse(this.OrganizationTreeView.SelectedNode.Value);
            string    strTypeId = this.UnitTypeCtl.SelectedValue;
            int?      typeId    = null;
            if (strTypeId.Length == 0)
            {
                typeId = null;
            }
            else
            {
                typeId = int.Parse(strTypeId);
            }
            int?costCenterID = null;
            if (this.CostCenterDDL.SelectedValue != "0")
            {
                costCenterID = int.Parse(this.CostCenterDDL.SelectedValue);
            }

            this.AuthBLL.UpdateOrganizationUnit(nodeValue.ObjectId, this.UnitNameCtl.Text, this.UnitCodeCtl.Text, typeId, costCenterID);
            AuthorizationDS.OrganizationUnitRow ou = this.AuthBLL.ActiveOrganizationUnit(nodeValue.ObjectId, this.UnitIsActiveCtl.Checked);
            this.SetTreeNode(this.OrganizationTreeView.SelectedNode, ou);
            if (ou.IsActive)
            {
                this.NewOUPanelArea.Style["Display"]       = "";
                this.NewPositionPanelArea.Style["Display"] = "";
            }
            else
            {
                this.NewOUPanelArea.Style["Display"]       = "none";
                this.NewPositionPanelArea.Style["Display"] = "none";
            }
            //this.NewOUPanel.Update();
            //this.NewPositionPanel.Update();
            PageUtility.ShowModelDlg(this, "更新成功");
        } catch (ApplicationException ex) {
            PageUtility.DealWithException(this, ex);
        }
    }
Пример #9
0
    //protected void ChangeParentUnitBtn_Click(object sender, EventArgs e) {
    //    if (this.OrganizationTreeView.CheckedNodes.Count == 1) {
    //        TreeNode newParentNode = this.OrganizationTreeView.CheckedNodes[0];
    //        NodeValue parentNodeValue = NodeValue.Parse(newParentNode.Value);
    //        if (parentNodeValue.OType == NodeValue.ValueType.OU) {
    //            if (parentNodeValue.IsActive) {
    //                TreeNode childNode = this.OrganizationTreeView.SelectedNode;
    //                NodeValue childNodeValue = NodeValue.Parse(childNode.Value);
    //                this.AuthBLL.SetOrganizationUnitParentOU(childNodeValue.ObjectId, parentNodeValue.ObjectId);
    //                if (childNode.Parent != null) {
    //                    childNode.Parent.ChildNodes.Remove(childNode);
    //                }
    //                newParentNode.ChildNodes.Add(childNode);
    //                this.OrganizationTreeView_SelectedNodeChanged(null, null);
    //            } else {
    //                PageUtility.ShowModelDlg(this, "目标组织机构处于非激活状态,不能迁移");
    //                return;
    //            }
    //        } else {
    //            PageUtility.ShowModelDlg(this, "请先选择一个目标组织机构");
    //            return;
    //        }
    //    } else {
    //        PageUtility.ShowModelDlg(this, "请选择唯一目标组织机构");
    //        return;
    //    }
    //}

    protected void ChangeParentUnitBtn_Click(object sender, EventArgs e)
    {
        if (this.OrganizationTreeView.CheckedNodes.Count == 1)
        {
            TreeNode  newParentNode   = this.OrganizationTreeView.CheckedNodes[0];
            NodeValue parentNodeValue = NodeValue.Parse(newParentNode.Value);
            if (parentNodeValue.OType == NodeValue.ValueType.OU)
            {
                if (parentNodeValue.IsActive)
                {
                    TreeNode  childNode      = this.OrganizationTreeView.SelectedNode;
                    NodeValue childNodeValue = NodeValue.Parse(childNode.Value);
                    this.AuthBLL.SetOrganizationUnitParentOU(childNodeValue.ObjectId, parentNodeValue.ObjectId);
                    if (childNode.Parent != null)
                    {
                        childNode.Parent.ChildNodes.Remove(childNode);
                    }
                    newParentNode.ChildNodes.Add(childNode);
                    this.OrganizationTreeView_SelectedNodeChanged(null, null);
                    //this.Page_Load(null, null);
                    Response.Redirect("~/AuthorizationManage/OrganizationManage.aspx");
                }
                else
                {
                    PageUtility.ShowModelDlg(this, "目标组织机构处于非激活状态,不能迁移");
                    return;
                }
            }
            else
            {
                PageUtility.ShowModelDlg(this, "请先选择一个目标组织机构");
                return;
            }
        }
        else
        {
            PageUtility.ShowModelDlg(this, "请选择唯一目标组织机构");
            return;
        }
    }
Пример #10
0
    protected void OrganizationTreeView_SelectedNodeChanged(object sender, EventArgs e)
    {
        if (this.OrganizationTreeView.SelectedNode != null)
        {
            NodeValue nodeValue = NodeValue.Parse(this.OrganizationTreeView.SelectedNode.Value);
            switch (nodeValue.OType)
            {
            case NodeValue.ValueType.OU:
                AuthorizationDS.OrganizationUnitRow organizationUnit = this.AuthBLL.GetOrganizationUnitById(nodeValue.ObjectId);
                this.UnitNameCtl.Text            = organizationUnit.OrganizationUnitName;
                this.UnitCodeCtl.Text            = organizationUnit.OrganizationUnitCode;
                this.UnitIsActiveCtl.Checked     = organizationUnit.IsActive;
                this.UnitTypeCtl.SelectedValue   = organizationUnit.IsOrganizationUnitTypeIdNull() ? "" : organizationUnit.OrganizationUnitTypeId.ToString();
                this.CostCenterDDL.SelectedValue = organizationUnit.IsCostCenterIDNull() ? "0" : organizationUnit.CostCenterID.ToString();

                this.ClearNewOUPanel();
                this.ClearNewPositionPanel();

                this.EditPositionPanelArea.Style["Display"] = "none";
                this.StuffPanel.Style["Display"]            = "none";
                this.EditOUPanelArea.Style["Display"]       = "";
                if (organizationUnit.IsActive)
                {
                    this.NewOUPanelArea.Style["Display"]       = "";
                    this.NewPositionPanelArea.Style["Display"] = "";
                }
                else
                {
                    this.NewOUPanelArea.Style["Display"]       = "none";
                    this.NewPositionPanelArea.Style["Display"] = "none";
                }
                break;

            case NodeValue.ValueType.Position:
                AuthorizationDS.PositionRow position = this.AuthBLL.GetPositionById(nodeValue.ObjectId);
                this.PositionNameCtl.Text        = position.PositionName;
                this.PositionIsActiveCtl.Checked = position.IsActive;
                this.PositionTypeCtl.ClearSelection();
                BusinessObjects.AuthorizationDS.PositionAndPositionTypeRow[] positionTypes = position.GetPositionAndPositionTypeRows();
                if (positionTypes == null || positionTypes.Length == 0)
                {
                    //this.PositionTypeCtl.SelectedIndex = 0;
                }
                else
                {
                    foreach (AuthorizationDS.PositionAndPositionTypeRow positionType in positionTypes)
                    {
                        foreach (ListItem li in this.PositionTypeCtl.Items)
                        {
                            if (li.Value.Equals(positionType.PositionTypeId.ToString()))
                            {
                                li.Selected = true;
                                break;
                            }
                        }
                    }
                }

                this.EditPositionPanelArea.Style["Display"] = "";
                this.StuffPanel.Style["Display"]            = "";
                this.PositionStuffDS.SelectParameters["PositionId"].DefaultValue = nodeValue.ObjectId.ToString();
                this.EditOUPanelArea.Style["Display"]      = "none";
                this.NewOUPanelArea.Style["Display"]       = "none";
                this.NewPositionPanelArea.Style["Display"] = "none";
                break;
            }
        }
        else
        {
            this.EditPositionPanelArea.Style["Display"] = "none";
            this.StuffPanel.Style["Display"]            = "none";
            this.EditOUPanelArea.Style["Display"]       = "none";
            this.NewOUPanelArea.Style["Display"]        = "none";
            this.NewPositionPanelArea.Style["Display"]  = "none";
        }
        //this.NewOUPanel.Update();
        //this.EditOUPanel.Update();
        //this.NewPositionPanel.Update();
        //this.EditPositionPanel.Update();
    }