Exemplo n.º 1
0
        /// <summary>
        /// 遍历选择拖动的菜单ID
        /// </summary>
        /// <param name="node">选择的菜单节点</param>
        /// <returns></returns>
        private string GetNodesID(DevExpress.XtraTreeList.Nodes.TreeListNode node)
        {
            //如果本节点有父节点,那么也一起选择进来,先找父节点,再找本节点,再找下面的子节点
            GetNodesParentID(node);
            if (!MenuSelectResult.Contains(node.GetValue("ID").ToString()))
            {
                MenuSelectResult += node.GetValue("ID").ToString() + ",";
                LMenuID.Add(node.GetValue("ID").ToString());
                LMenuName.Add(node.GetValue("sMenuName").ToString());
                LMenuParentID.Add(node.GetValue("iParentID").ToString());
            }

            //遍历当前节点下面所有的菜单,也一起选择
            foreach (DevExpress.XtraTreeList.Nodes.TreeListNode n in node.Nodes)
            {
                MenuSelectResult += n.GetValue("ID").ToString() + ",";
                LMenuID.Add(n.GetValue("ID").ToString());
                LMenuName.Add(n.GetValue("sMenuName").ToString());
                LMenuParentID.Add(n.GetValue("iParentID").ToString());
                if (n.HasChildren)
                {
                    GetNodesID(n);
                }
            }
            return(MenuSelectResult.Substring(0, MenuSelectResult.Length - 1));
        }
Exemplo n.º 2
0
        static public void TreeNodeToDataObject <T>(T dataObject, DevExpress.XtraTreeList.Nodes.TreeListNode treeNode)
        {
            Type type = typeof(T);

            foreach (PropertyInfo pi in type.GetProperties())
            {
                if (treeNode.GetValue(pi.Name) != System.DBNull.Value)
                {
                    pi.SetValue(dataObject, treeNode.GetValue(pi.Name), null);
                }
            }
        }
Exemplo n.º 3
0
        private void SeleccionarNodo(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
        {
            try
            {
                if (nodo.Id == -100000)
                {
                    ucseg_menu_x_empresa_x_usuario1.treeList_menu.ExpandAll();
                }
                else
                {
                    if ((bool)nodo.GetValue("info_menu.me_es_menu"))
                    {
                        info_menu.IdMenu            = (int)nodo.GetValue("IdMenu");
                        info_menu.IdMenu_padre      = (int)nodo.GetValue("info_menu.IdMenu_padre");
                        info_menu.me_nombre         = (string)nodo.GetValue("info_menu.me_nombre");
                        info_menu.me_nivel          = (int)nodo.GetValue("info_menu.me_nivel");
                        info_menu.me_es_menu        = (bool)nodo.GetValue("info_menu.me_es_menu");
                        info_menu.me_nom_formulario = (string)nodo.GetValue("info_menu.me_nom_formulario");
                        info_menu.me_nom_assembly   = (string)nodo.GetValue("info_menu.me_nom_assembly");

                        this.Cursor = Cursors.WaitCursor;
                        LlamarFormulario();
                        MarcarNodoPadre(nodo);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ha ocurrido un error, comuníquese con sistemas", param.nom_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 4
0
        private void SeleccionarNodo(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
        {
            try
            {
                if (nodo.Id == -100000)
                {
                    ucseg_menu_x_empresa_x_usuario1.treeList_menu.ExpandAll();
                }
                else
                {
                    if ((bool)nodo.GetValue("info_menu.me_es_menu"))
                    {
                        info_menu.IdMenu            = (int)nodo.GetValue("IdMenu");
                        info_menu.IdMenu_padre      = (int)nodo.GetValue("info_menu.IdMenu_padre");
                        info_menu.me_nombre         = (string)nodo.GetValue("info_menu.me_nombre");
                        info_menu.me_nivel          = (int)nodo.GetValue("info_menu.me_nivel");
                        info_menu.me_es_menu        = (bool)nodo.GetValue("info_menu.me_es_menu");
                        info_menu.me_nom_formulario = (string)nodo.GetValue("info_menu.me_nom_formulario");
                        info_menu.me_nom_assembly   = (string)nodo.GetValue("info_menu.me_nom_assembly");

                        this.Cursor = Cursors.WaitCursor;
                        LlamarFormulario();
                        MarcarNodoPadre(nodo);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 取选择变化后的对应表
        /// </summary>
        /// <param name="p_dtDef">关联表</param>
        /// <param name="p_strFilter">关联表的过滤字段</param>
        /// <param name="p_intFilterValue">关联表过滤的值</param>
        /// <param name="p_strKeyName">对应的关键字段</param>
        public void GetChange(ref DataTable p_dtDef, string p_strFilter, object p_objFilterValue, string p_strKeyName)
        {
            DataView dv = new DataView(p_dtDef);
            string   sf = p_dtDef.Columns[p_strFilter].DataType == typeof(String) ? "{0}='{1}'" : "{0}={1}";

            dv.RowFilter = string.Format(sf, p_strFilter, p_objFilterValue);

            for (int i = 0; i < lstCheck.AllNodesCount; i++)
            {
                bool add = true;
                DevExpress.XtraTreeList.Nodes.TreeListNode tn = lstCheck.FindNodeByID(i);
                foreach (DataRowView r in dv)
                {
                    if ((p_dtDef.Columns[p_strKeyName].DataType == typeof(String) && Convert.ToString(r[p_strKeyName]).Trim() == Convert.ToString(tn.GetValue(p_strKeyName)).Trim()) ||
                        (p_dtDef.Columns[p_strKeyName].DataType != typeof(String) && weCare.Core.Utils.Function.Dec(r[p_strKeyName]) == weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName))))
                    {
                        add = false;
                        if (!tn.Checked)
                        {
                            r.Delete();
                        }
                        break;
                    }
                }
                if (add && tn.Checked)
                {
                    DataRow r = p_dtDef.NewRow();
                    if (p_dtDef.Columns[p_strFilter].DataType == typeof(String))
                    {
                        r[p_strFilter] = Convert.ToString(p_objFilterValue);
                    }
                    else
                    {
                        r[p_strFilter] = weCare.Core.Utils.Function.Dec(p_objFilterValue);
                    }

                    if (p_dtDef.Columns[p_strKeyName].DataType == typeof(String))
                    {
                        r[p_strKeyName] = Convert.ToString(tn.GetValue(p_strKeyName));
                    }
                    else
                    {
                        r[p_strKeyName] = weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName));
                    }
                    p_dtDef.Rows.Add(r);
                }
            }
        }
Exemplo n.º 6
0
 private void MarcarNodoPadre(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
 {
     try
     {
         if (nodo.ParentNode != null)
         {
             if (nodo.GetValue("IdMenuPadre") as int? != 0)
             {
                 if (!(bool)nodo.ParentNode.GetValue("Tiene_FormularioAsociado"))
                 {
                     nodo.ParentNode.Selected = true;
                 }
                 else
                 {
                     MarcarNodoPadre(nodo.ParentNode);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Exemplo n.º 7
0
        private void treeListMenuInfo_CellValueChanged(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e)
        {
            Menuinfo menuinfo = treeListMenuInfo.GetDataRecordByNode(e.Node) as Menuinfo;

            menuinfoPowerClient.PropertyValueChanged(menuinfo, e.Column.FieldName);
            if (e.Value.ToString() == "True")
            {
                DevExpress.XtraTreeList.Nodes.TreeListNode node = e.Node.ParentNode;

                while (node != null)
                {
                    if (node.GetValue("CheckValue").ToString() == "True")
                    {
                        node = node.ParentNode;
                        continue;
                    }
                    menuinfo = treeListMenuInfo.GetDataRecordByNode(node) as Menuinfo;
                    menuinfo.Check(true);
                    menuinfoPowerClient.PropertyValueChanged(menuinfo, e.Column.FieldName);

                    node.SetValue("CheckValue", true);
                    node = node.ParentNode;
                }
            }
        }
Exemplo n.º 8
0
 private bool Modificar()
 {
     try
     {
         seg_Menu_bus bus = new seg_Menu_bus();
         Info_Menu.IdMenu          = this.Info_Menu.IdMenu;
         Info_Menu.DescripcionMenu = txtDescripcion.Text;
         Info_Menu.Habilitado      = this.Info_Menu.Habilitado;
         if (numericUpDownPosicion.Value != 0)
         {
             Info_Menu.PosicionMenu = (int)numericUpDownPosicion.Value;
         }
         if (Info_Menu.nivel != 0)
         {
             Info_Menu.nivel = RetornarNodoCheckeado(treeListMenuPadre.Nodes).Level + 1;
         }
         if (!checkBoxTienePadre.Checked)
         {
             Info_Menu.IdMenuPadre = 0;
         }
         else
         {
             DevExpress.XtraTreeList.Nodes.TreeListNode nodo = RetornarNodoCheckeado(treeListMenuPadre.Nodes);
             if (nodo == null)
             {
                 return(false);
             }
             Info_Menu.IdMenuPadre = (int)nodo.GetValue("IdMenu");
         }
         if (checkBoxTieneFormulario.Checked)
         {
             Info_Menu.Tiene_FormularioAsociado = true;
             Info_Menu.nom_Formulario           = txtNombreFormulario.Text;
             Info_Menu.nom_Asembly = txtNombreAsembly.Text;
         }
         string mensaje = "";
         if (bus.ModificarDB(Info_Menu, ref mensaje))
         {
             MessageBox.Show("Grabado Ok", "Listo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             treeListMenuPadre.Selection[0].GetValue(Info_Menu.DescripcionMenu);
             treeListMenuPadre.Selection[0].GetValue(Info_Menu.IdMenu);
             treeListMenuPadre.Selection[0].GetValue(Info_Menu.PosicionMenu);
             return(true);
         }
         else
         {
             MessageBox.Show(mensaje, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
 }
Exemplo n.º 9
0
 bool NodeContainsPattern(DevExpress.XtraTreeList.Nodes.TreeListNode node, string pattern)
 {
     foreach (DevExpress.XtraTreeList.Columns.TreeListColumn col in node.TreeList.Columns)
     {
         if (node.GetValue(col).ToString().Contains(pattern))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 10
0
        private void SeleccionarNodo(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
        {
            try
            {
                if (nodo.Id == -100000)
                {
                    ucSeg_Menu_x_Usuario_x_Empresa1.treeListMenu_x_Usuario_x_Empresa.ExpandAll();
                }
                else
                {
                    if ((bool)nodo.GetValue("Tiene_FormularioAsociado"))
                    {
                        InfoMenu.IdMenu                   = (int)nodo.GetValue("IdMenu");
                        InfoMenu.IdMenuPadre              = (int)nodo.GetValue("IdMenuPadre");
                        InfoMenu.DescripcionMenu          = (string)nodo.GetValue("DescripcionMenu");
                        InfoMenu.PosicionMenu             = (int)nodo.GetValue("PosicionMenu");
                        InfoMenu.Habilitado               = (bool)nodo.GetValue("Habilitado");
                        InfoMenu.Tiene_FormularioAsociado = (bool)nodo.GetValue("Tiene_FormularioAsociado");
                        InfoMenu.nom_Formulario           = (string)nodo.GetValue("nom_Formulario");
                        InfoMenu.nom_Asembly              = (string)nodo.GetValue("nom_Asembly");

                        InfoMenu.nivel = (int)nodo.GetValue("nivel");
                        this.Cursor    = Cursors.WaitCursor;
                        LlamarFormulario();
                        MarcarNodoPadre(nodo);
                    }
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 11
0
        private void ImagesTreeList_DragDrop(object sender, DragEventArgs e)
        {
            DevExpress.XtraTreeList.Nodes.TreeListNode DestinationNode;

            Point pt = ((DevExpress.XtraTreeList.TreeList)sender).PointToClient(new Point(e.X, e.Y));
            //DevExpress.XtraTreeList.Nodes.TreeListNode DestinationNode = ((DevExpress.XtraTreeList.Nodes.TreeListNode)sender).Calc
            var _Info = ImagesTreeList.CalcHitInfo(pt);

gto:
            DestinationNode = _Info.Node;
            if (DestinationNode == null)
            {
                goto gto;
            }

            DevExpress.XtraTreeList.Nodes.TreeListNode _Node = (DevExpress.XtraTreeList.Nodes.TreeListNode)e.Data.GetData("DevExpress.XtraTreeList.Nodes.TreeListNode");

StartGetNodeID:

            var _DestinationID = DestinationNode.GetValue("ID").ToString();
            var _NodeID = _Node.GetValue("ID").ToString();

            if (DestinationNode.GetValue("IsFolder").ToString().ToLower() == "1")
            {
                var _Group = _GroupCollection.GetGroupByID(_DestinationID);

                if (_Node.GetValue("IsFolder").ToString().ToLower() == "1")
                {
                    _GroupCollection.MoveGroupToGroup(_Node.GetValue("ID").ToString(), _DestinationID);
                }
            }
            else
            {
                DestinationNode = DestinationNode.ParentNode;
                goto StartGetNodeID;
            }
            e.Effect = DragDropEffects.None;
            PopulateTreeView();
        }
Exemplo n.º 12
0
        /// <summary>
        /// 添加同级菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButtonMenuinfoAdd_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren() == false)
            {
                return;
            }
            DevExpress.XtraTreeList.Nodes.TreeListNode node       = this.treeListMenuInfo.FocusedNode;
            DevExpress.XtraTreeList.Nodes.TreeListNode parentNode = node.ParentNode;
            string parentid = null;

            if (parentNode != null)
            {
                parentid = parentNode.GetValue("Sysid") as string;
            }
            Menuinfo menuinfo = NewMenuinfo(parentid);

            Save(menuinfo);
            this.bindingListMenuInfo.ResetBindings();
            ValidateChildren();
        }
Exemplo n.º 13
0
 private bool?GetCheckValue(DevExpress.XtraTreeList.Nodes.TreeListNode node)
 {
     if (node.GetValue("Bool0") == null || node.GetValue("Bool1") == null || node.GetValue("Bool0") == DBNull.Value || node.GetValue("Bool1") == DBNull.Value)
     {
         return(null);
     }
     if (Convert.ToBoolean(node.GetValue("Bool0")) == true && Convert.ToBoolean(node.GetValue("Bool1")) == true)
     {
         return(true);
     }
     if ((bool)node.GetValue("Bool0") == false && (bool)node.GetValue("Bool1") == false)
     {
         return(false);
     }
     return(null);
 }
Exemplo n.º 14
0
        void DisplayInfo2()
        {
            lock (this)
            {
                try
                {
                    //ds_Collection = objMasterService.Get_All_Rex_Dm_Bophan_Collection();
                    //DataSet ds = objRex.GetAll_Rex_Nhansu_By_Bophan_Collection(id_bophan);
                    //foreach (DataRow row_rex_nhansu in ds_Collection.Tables[0].Rows)
                    //    row_rex_nhansu["Ngaysinh"] = GoobizFrame.Windows.MdiUtils.DateTimeMask.YMDToShortDatePattern("" + row_rex_nhansu["Ngaysinh"],
                    //        GoobizFrame.Windows.MdiUtils.DateTimeMask.GetDateTimeFormat());

                    //dgrex_Dm_Bophan.DataSource = ds_Bophan;
                    //dgrex_Dm_Bophan.DataMember = ds_Bophan.Tables[0].TableName;

                    //bandedGridView1.FocusedRowHandle = 3;
                    //focusNode.GetValue("Id_Bophan");
                    //bandedGridView1.Columns["Id_Bophan"].FilterInfo = new
                    //DevExpress.XtraGrid.Columns.ColumnFilterInfo(bandedGridView1.Columns["Id_Bophan"], Id_Bophan);
                    //bandedGridView1.BestFitColumns();
                    if (this.focusNode != null)
                    {
                        if (focusNode.GetValue("Id_Bophan").ToString() != "")
                        {
                            int focus = bandedGridView1.GetRowHandle(ds_Bophan.Tables[0].Rows.IndexOf(ds_Bophan.Tables[0].Select("Id_Bophan='" + focusNode.GetValue("Id_Bophan").ToString() + "'")[0]));
                            bandedGridView1.FocusedRowHandle = focus;
                            DataBindingControl();
                        }
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    MessageBox.Show(ex.ToString());
#endif
                }
            }
        }
Exemplo n.º 15
0
 private void MarcarNodoPadre(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
 {
     try
     {
         if (nodo.ParentNode != null)
         {
             if (nodo.GetValue("info_menu.IdMenu_padre") as int? != 0)
             {
                 if (!(bool)nodo.ParentNode.GetValue("info_menu.me_es_menu"))
                 {
                     nodo.ParentNode.Selected = true;
                 }
                 else
                 {
                     MarcarNodoPadre(nodo.ParentNode);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 16
0
 private void MarcarNodoPadre(DevExpress.XtraTreeList.Nodes.TreeListNode nodo)
 {
     try
     {
         if (nodo.ParentNode != null)
         {
             if (nodo.GetValue("info_menu.IdMenu_padre") as int? != 0)
             {
                 if (!(bool)nodo.ParentNode.GetValue("info_menu.me_es_menu"))
                 {
                     nodo.ParentNode.Selected = true;
                 }
                 else
                 {
                     MarcarNodoPadre(nodo.ParentNode);
                 }
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Ha ocurrido un error, comuníquese con sistemas", param.nom_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// 关联表并显示
 /// </summary>
 ///<param name="p_dtDef">定义关联的表</param>
 ///<param name="p_strKeyName">对应的关键字段</param>
 public void JoinDataSource(DataTable p_dtDef, string p_strKeyName)
 {
     for (int i = 0; i < lstCheck.AllNodesCount; i++)
     {
         DevExpress.XtraTreeList.Nodes.TreeListNode tn = lstCheck.FindNodeByID(i);
         tn.Checked = false;
         foreach (DataRow r in p_dtDef.Rows)
         {
             if ((p_dtDef.Columns[p_strKeyName].DataType == typeof(String) && Convert.ToString(r[p_strKeyName]).Trim() == Convert.ToString(tn.GetValue(p_strKeyName)).Trim()) ||
                 (p_dtDef.Columns[p_strKeyName].DataType != typeof(String) && weCare.Core.Utils.Function.Dec(r[p_strKeyName]) == weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName))))
             {
                 tn.Checked = true;
                 break;
             }
         }
     }
 }