Ejemplo n.º 1
0
        public void treeListPlanCta_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            try
            {
                TreeListNode childNode = (TreeListNode)e.Node;

                _Centro_costo_Info = (ct_Centro_costo_Info)treeListPlanCta.GetDataRecordByNode(childNode);
                if (_Centro_costo_Info != null)
                {
                    _centro_costo_PadreInfo = _List_centro_costo_Info.Find(delegate(ct_Centro_costo_Info ca) { return(ca.IdCentroCosto == _Centro_costo_Info.IdCentroCostoPadre && ca.IdEmpresa == _Centro_costo_Info.IdEmpresa); });
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
            if (tree.FocusedNode == null)
            {
                return;
            }
            if (tree.FocusedColumn != null)
            {
                string      FileName = tree.FocusedColumn.FieldName;
                DataRowView v        = tree.GetDataRecordByNode(tree.FocusedNode) as DataRowView;
                if (tree.FocusedNode.HasChildren)
                {
                    if (this.treeList1.Columns["jsdj"] != null)
                    {
                        this.treeList1.Columns["jsdj"].OptionsColumn.AllowEdit = false;
                    }
                    if (this.treeList1.Columns["Feature"] != null)
                    {
                        this.treeList1.Columns["Feature"].OptionsColumn.AllowEdit = false;
                    }
                    if (this.treeList1.Columns["Name"] != null)
                    {
                        this.treeList1.Columns["Name"].OptionsColumn.AllowEdit = false;
                    }
                    if (this.treeList1.Columns["Calculation"] != null)
                    {
                        this.treeList1.Columns["Calculation"].OptionsColumn.AllowEdit = false;
                    }
                    if (this.treeList1.Columns["Coefficient"] != null)
                    {
                        this.treeList1.Columns["Coefficient"].OptionsColumn.AllowEdit = false;
                    }
                    if (this.treeList1.Columns["Quantities"] != null)
                    {
                        this.treeList1.Columns["Quantities"].OptionsColumn.AllowEdit = false;
                    }
                }
                else
                {
                    if (this.treeList1.Columns["jsdj"] != null)
                    {
                        this.treeList1.Columns["jsdj"].OptionsColumn.AllowEdit = true;
                    }
                    if (this.treeList1.Columns["Feature"] != null)
                    {
                        this.treeList1.Columns["Feature"].OptionsColumn.AllowEdit = true;
                    }
                    if (this.treeList1.Columns["Name"] != null)
                    {
                        this.treeList1.Columns["Name"].OptionsColumn.AllowEdit = true;
                    }
                    if (this.treeList1.Columns["Calculation"] != null)
                    {
                        this.treeList1.Columns["Calculation"].OptionsColumn.AllowEdit = true;
                    }
                    if (this.treeList1.Columns["Coefficient"] != null)
                    {
                        this.treeList1.Columns["Coefficient"].OptionsColumn.AllowEdit = false;
                    }
                    if (v["Unit"].ToString().Equals("项"))
                    {
                        if (this.treeList1.Columns["Quantities"] != null)
                        {
                            this.treeList1.Columns["Quantities"].OptionsColumn.AllowEdit = false;
                        }
                    }
                    else
                    if (this.treeList1.Columns["Quantities"] != null)
                    {
                        this.treeList1.Columns["Quantities"].OptionsColumn.AllowEdit = true;
                    }
                }

                if (string.IsNullOrEmpty(tree.FocusedNode.GetValue("Remark").ToString()))
                {
                    if (this.treeList1.Columns["Remark"] != null)
                    {
                        this.treeList1.Columns["Remark"].OptionsColumn.AllowEdit = false;
                    }
                }
                else
                {
                    if (this.treeList1.Columns["Remark"] != null)
                    {
                        this.treeList1.Columns["Remark"].OptionsColumn.AllowEdit = true;
                    }
                }

                if (Convert.ToBoolean(tree.FocusedNode.GetValue("IsSys")))
                {
                    if (this.treeList1.Columns["Unit"] != null)
                    {
                        this.treeList1.Columns["Unit"].OptionsColumn.AllowEdit = false;
                    }
                }
                else
                {
                    if (this.treeList1.Columns["Unit"] != null)
                    {
                        this.treeList1.Columns["Unit"].OptionsColumn.AllowEdit = true;
                    }
                }
                if (!APP.Jzbx_pwd)
                {
                    this.treeList1.OptionsBehavior.Editable = !v["DZBS"].Equals(true);
                }
                else
                {
                    this.treeList1.OptionsBehavior.Editable = true;
                }
            }
        }