private void Frame_ProcessActionContainer(object sender, ProcessActionContainerEventArgs e)
 {
     if (e.ActionContainer is NavigationActionContainer)
     {
         ASPxNavBar navBar = ((NavigationActionContainer)e.ActionContainer).NavigationControl as ASPxNavBar;
         if (navBar != null)
         {
             // Customize the main ASPxNavBar control.
             navBar.EnableAnimation = true;
             foreach (NavBarGroup group in navBar.Groups)
             {
                 group.Expanded = false;
                 //foreach (NavBarItem item in group.Items)
                 //{
                 //    if (item is NavBarTreeViewItem)
                 //    {
                 //        ASPxTreeView innerTreeView = ((NavBarTreeViewItem)item).TreeViewNavigationControl.Control;
                 //        // Customize the inner ASPxTreeView control inside the navigation group.
                 //        innerTreeView.ShowExpandButtons = false;
                 //    }
                 //}
             }
         }
         else
         {
             ASPxTreeView mainTreeView = ((NavigationActionContainer)e.ActionContainer).NavigationControl as ASPxTreeView;
             if (mainTreeView != null)
             {
                 // Customize the main ASPxTreeView control.
                 mainTreeView.ShowExpandButtons = false;
             }
         }
     }
 }
        private void ShowNavigationItemAction_CustomizeControl(object sender, DevExpress.ExpressApp.Actions.CustomizeControlEventArgs e)
        {
            ASPxNavBar navBar = e.Control as ASPxNavBar;

            if (navBar != null)
            {
                // Customize the main ASPxNavBar control.
                navBar.EnableAnimation = true;
                foreach (NavBarGroup group in navBar.Groups)
                {
                    foreach (NavBarItem item in group.Items)
                    {
                        if (item is NavBarTreeViewItem)
                        {
                            ASPxTreeView innerTreeView = ((NavBarTreeViewItem)item).TreeViewNavigationControl.Control;
                            // Customize the inner ASPxTreeView control inside the navigation group.
                            innerTreeView.ShowExpandButtons = false;
                        }
                    }
                }
            }
            else
            {
                ASPxTreeView mainTreeView = e.Control as ASPxTreeView;
                if (mainTreeView != null)
                {
                    // Customize the main ASPxTreeView control.
                    mainTreeView.ShowExpandButtons = false;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 将列表变成树,并且绑定到树(先清空节点)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tv"></param>
        /// <param name="data"></param>
        /// <param name="keyGet"></param>
        /// <param name="parentKeyGet"></param>
        /// <param name="nodeSet"></param>
        /// <param name="dept"></param>
        /// <param name="destroyData"></param>
        public static void FromList <T>(this ASPxTreeView tv,
                                        List <T> data, Func <T, string> keyGet, Func <T, string> parentKeyGet,
                                        Action <TreeViewNode, T> nodeSet, string rootId = null, int dept = -1, bool destroyData = false,
                                        Func <List <T>, List <T> > orderBy = null)
        {
            tv.Nodes.Clear();
            if (data.Count == 0)
            {
                return;
            }
            List <T> lstCopy = data;

            if (!destroyData)
            {
                lstCopy = data.ToList();               // 做多一个拷贝
            }
            // 采用递归方式执行节点创建
            Action <List <T>, int, string, TreeViewNodeCollection> _do = (all, dpt, parentId, parentCollection) => { };

            _do = (all, dpt, parentId, parentCollection) =>
            {
                Func <T, bool> _where = t => parentKeyGet(t) == parentId;
                if (string.IsNullOrEmpty(parentId))
                {
                    _where = t => string.IsNullOrEmpty(parentKeyGet(t));
                }

                var children = all.Where(_where).ToList();
                if (orderBy != null)
                {
                    children = orderBy(children);
                }
                children.ForEach(c => all.Remove(c));
                children.ForEach(c =>
                {
                    var node = new TreeViewNode()
                    {
                        Name = keyGet(c)
                    };
                    nodeSet(node, c);
                    if (parentCollection != null)
                    {
                        parentCollection.Add(node);
                    }
                    if (dpt < dept || dept == -1)
                    {
                        _do(all, (dpt == -1) ? dpt : dpt + 1, node.Name, node.Nodes);
                    }
                });
            };

            // 执行递归,并返回结果
            // 最高层的字段值为 null 或者 空字符串
            _do(lstCopy, 0, rootId, tv.Nodes);
            if (tv.Nodes.Count == 0)
            {
                _do(lstCopy, 0, "-1", tv.Nodes);                      // 没获得树,则用 "-1" 试试
            }
        }
Ejemplo n.º 4
0
    protected void tvSiteMap_DataBound(object sender, EventArgs e)
    {
        ASPxTreeView tvSiteMap = sender as ASPxTreeView;

        if (!IsPostBack)
        {
            tvSiteMap.ExpandAll();
        }
    }
Ejemplo n.º 5
0
        /**
         * Telerik:RadtreeView: variable to create TreeView (get DB from tbl SO_TAI_KHOAN)
         * intCap: Begin from 1
         * intParentNodeID: Begin from 0
         * node: Begin is null
         **/
        public static void DrawTelericTreeView_Menus(ASPxTreeView radTreeView, int intVaiTroID, int intParentNodeID, TreeViewNode node, string strMenuType, ATCLEntities entities)
        {
            bool blCheck = false;
            bool blZero  = false;

            if (intParentNodeID == 0)
            {
                blZero = true;
            }
            //var objMenus = entities.jos_menu.Where(x => (blZero ? x.parent == 0 : x.parent == intParentNodeID) && (x.id_menutype == intMenuType)).ToList();
            var objMenus = entities.TBL_MENU.Join(entities.TBL_MENU_LOAI, M => (int)M.ID_LOAI_MENU, T => T.ID, (M, T) => new { M, T })
                           .Where(x => (x.M.isEnabled) &&
                                  (blZero ? x.M.ID_CHA == 0 : x.M.ID_CHA == intParentNodeID) &&
                                  (strMenuType.Equals(x.T.CODE))).Select(z => z.M).OrderBy(y => y.STT).ToList();


            if ((objMenus != null) && (objMenus.Count > 0))
            {
                foreach (var item in objMenus)
                {
                    var objVaiTroMenu = entities.TBL_MENU_QUYEN.Where(x => x.ID_QUYEN == intVaiTroID && x.ID_MENU == item.ID).ToList();
                    if (objVaiTroMenu != null && objVaiTroMenu.Count > 0)
                    {
                        blCheck = true;
                    }
                    else
                    {
                        blCheck = false;
                    }

                    string strMoTa = item.TEN;//item.TIEU_DE
                    if (node == null)
                    {
                        TreeViewNode nodeCap1 = new TreeViewNode(strMoTa);

                        nodeCap1.Name = item.ID.ToString();
                        DrawTelericTreeView_Menus(radTreeView, (int)intVaiTroID, (int)item.ID, nodeCap1, strMenuType, entities);
                        nodeCap1.Expanded = true; //Expand all
                        nodeCap1.Checked  = blCheck;
                        radTreeView.Nodes.Add(nodeCap1);
                    }
                    else
                    {
                        TreeViewNode child = new TreeViewNode(strMoTa);
                        child.Name     = item.ID.ToString();
                        child.Expanded = true; //Expand all
                        child.Checked  = blCheck;
                        node.Nodes.Add(child);
                        DrawTelericTreeView_Menus(radTreeView, (int)intVaiTroID, (int)item.ID, child, strMenuType, entities);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public static void DrawTelericTreeView_DS_Quyen(ASPxTreeView radTreeView, int intQuyenID, int intParentNodeID, TreeViewNode node, ATCLEntities entities)
        {
            bool blCheck = false;
            bool blZero  = false;

            if (intParentNodeID == 0)
            {
                blZero = true;
            }
            //var objMenus = entities.jos_menu.Where(x => (blZero ? x.parent == 0 : x.parent == intParentNodeID) && (x.id_menutype == intMenuType)).ToList();
            var objQuyen = entities.TBL_RULE.Where(x => (x.isEnabled) &&
                                                   (blZero ? x.ID_PARENT == 0 : x.ID_PARENT == intParentNodeID)
                                                   ).OrderBy(y => y.ORDER).ToList();


            if ((objQuyen != null) && (objQuyen.Count > 0))
            {
                foreach (var item in objQuyen)
                {
                    var objQuyenRule = entities.TBL_QUYEN_RULE.Where(x => x.ID_QUYEN == intQuyenID && x.ID_RULE == item.ID).ToList();
                    if (objQuyenRule != null && objQuyenRule.Count > 0)
                    {
                        blCheck = true;
                    }
                    else
                    {
                        blCheck = false;
                    }

                    string strMoTa = item.NAME;
                    if (node == null)
                    {
                        TreeViewNode nodeCap1 = new TreeViewNode(strMoTa);
                        nodeCap1.Name = item.ID.ToString();
                        DrawTelericTreeView_DS_Quyen(radTreeView, (int)intQuyenID, (int)item.ID, nodeCap1, entities);
                        nodeCap1.Expanded = true; //Expand all
                        nodeCap1.Checked  = blCheck;
                        radTreeView.Nodes.Add(nodeCap1);
                    }
                    else
                    {
                        TreeViewNode child = new TreeViewNode(strMoTa);
                        child.Name     = item.ID.ToString();
                        child.Expanded = true; //Expand all
                        child.Checked  = blCheck;
                        node.Nodes.Add(child);
                        DrawTelericTreeView_DS_Quyen(radTreeView, (int)intQuyenID, (int)item.ID, child, entities);
                    }
                }
            }
        }
Ejemplo n.º 7
0
    public static void BindData(ASPxTreeView treeview, DevExpress.Xpo.Session s, string objectname, string filter = "", params object[] parameter)
    {
        try
        {
            DynamicDataTableClassInfo classInfo = dynamicClasses[objectname];

            if (classInfo != null)
            {
                XPServerCollectionSource ds = new XPServerCollectionSource(s, dynamicClasses[objectname], CriteriaOperator.Parse(filter, parameter));
                treeview.DataSource = ds;
            }
            else
                throw new Exception(string.Format("Đối tượng {0} không tìm thấy trong database. Nếu không có dữ liệu hiển thị thì XPOProfiles để xem điều kiện lọc đúng chưa", objectname));
        }
        catch (Exception ex)
        {
            SiAuto.Main.LogColored(Color.Red, "Loi BindData:" + ex.ToString());
            throw ex;
        }
    }
        public void BuildPersonalViewMenu(SPView view, Page page, SPList spList = null)
        {
            try
            {
                if (view == null && spList == null)
                {
                    return;
                }

                HtmlGenericControl personalViewDiv = UtilityControl.FindControl <HtmlGenericControl>(page, "divForPersonalView", false).FirstOrDefault();
                if (personalViewDiv == null)
                {
                    return;
                }

                HtmlGenericControl control = new HtmlGenericControl(HtmlTextWriterTag.Div.ToString());
                control.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "nav-leftNavigationContainer");

                ASPxTreeView treeControl = new ASPxTreeView
                {
                    EnableViewState  = false,
                    TextField        = ListViewDelegateControls.NavigationElementDisplayNameAttr,
                    NodeLinkMode     = ItemLinkMode.TextOnly,
                    NavigateUrlField = ListViewDelegateControls.NavigationElementLinkAttr,
                    ID = "treePersonalView"
                };

                treeControl.Images.CollapseButton.Url = "/_layouts/15/images/Navicon/LeftNavigation/minus.png";
                treeControl.Images.ExpandButton.Url   = "/_layouts/15/images/Navicon/LeftNavigation/plus.png";

                PersonalViewsStructs personalViewsStructs = new PersonalViewsStructs();
                PersonalViewsStructs childrensStructs     = new PersonalViewsStructs();
                PersonalViewsStruct  rootPersonalView     = new PersonalViewsStruct
                {
                    DisplayName = PersonalViewHeadText,
                    Id          = Guid.NewGuid().ToString().Replace("-", "_"),
                    Link        = "javascript:void(0)",
                    Children    = childrensStructs
                };
                personalViewsStructs.Add(rootPersonalView);

                SPViewCollection spViewCollection = spList != null ? spList.Views : view.ParentList.Views;

                childrensStructs.AddRange(from SPView spView in spViewCollection
                                          where spView.PersonalView
                                          select new PersonalViewsStruct
                {
                    DisplayName = spView.Title,
                    Link        = string.Format(ViewHrefFormat, spView.ParentList.ID, spView.ID),
                    Id          = spList != null ? spList.ID.ToString().Replace("-", "_") : view.ID.ToString().Replace("-", "_")
                });

                if (personalViewsStructs.Count == 1 && personalViewsStructs[0].HasChildren)
                {
                    control.Controls.Add(treeControl);
                    personalViewDiv.Controls.Add(control);
                    personalViewDiv.Visible = true;
                    treeControl.DataSource  = personalViewsStructs;
                    treeControl.DataBind();
                    treeControl.ExpandAll();
                }
            }
            catch (Exception ex)
            {
                Logger.ShowErrorOnPage("Не удалось изменить/сохранить отображение ", ex);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ASPxTreeView     tvNodes  = mode_cd.FindControl("tvNodes") as ASPxTreeView;
            List <T_CM_Bank> bankList = new BLL.T_CM_Bank().GetList().Where(p => p.Account == "现金" || p.Account == "挂账" || p.Account == "银行卡" || p.ParentID != "0").ToList();

            UIHelper.TreeViewCreateNodes(bankList, tvNodes.Nodes, "0");
            if (!IsPostBack)
            {
                gvw_CardType.DataSource = _cardType.GetList(new QueryInfo <T_Vip_CardType>());
                gvw_CardType.DataBind();
                //hfd_cust_no.Value = txt_cust_no.Text = InitCustomerCode();
                //品牌
                DataBindCode.DataBindComboBoxColumn(cbb_brand, " para_type='brand'");
                //车型
                //DataBindCode.DataBindComboBoxColumn(cbb_car_type, " para_type='car_type'");
                cbb_car_type.DataSource = _carType.GetList(new QueryInfo <T_Vip_CarType>());
                cbb_car_type.DataBind();
                //价位
                DataBindCode.DataBindComboBoxColumn(cbb_car_sales, " para_type='car_sales'");
                //会员
                glp_cust.DataBind();
                //施工
                gl_Crews.DataBind();
                var caa = _caa.GetList(new QueryInfo <T_Vip_CarArea>().SetQuery("is_top", true));
                cbb_car_area.DataSource = caa;
                cbb_car_area.DataBind();
                var caa_default = caa.FirstOrDefault(p => p.is_default);
                if (caa_default != null)
                {
                    cbb_car_area.Items.FindByValue(caa_default.name).Selected = true;
                }
                //初始数据
                Consume = new Sal_Consume();
                var consume = new T_Sal_Consume(); consume.SetState(EntityState.Added);
                consume.id         = Guid.NewGuid();
                consume.shop_id    = UIHelpers.UserProvide.GetCurrentShopGuid();
                consume.acct_no    = DateTime.Now.ToString("yyyyMMddHHmmssffffff");
                consume.status_cd  = "5";
                consume.order_type = 3;
                consume.add_date   = consume.update_date = DateTime.Now;
                consume.update_opr = UIHelpers.UserProvide.GetCurrentUserName();
                Consume.consume    = consume;
                sdt_sale_amt.Value = consume.sales_amt;
                //sdt_rich_amt.Value = 0;
                sdt_paid_in.Value     = consume.paid_in;
                sdt_give_change.Value = consume.give_change;
                txt_acct_no.Value     = consume.acct_no;
                if (null != consume.amt_mode_cd)
                {
                    UIHelper.TreeViewSelectedNode(tvNodes, consume.amt_mode_cd);
                }
                if (tvNodes.SelectedNode != null)
                {
                    mode_cd.Text     = tvNodes.SelectedNode.Text;
                    mode_cd.KeyValue = tvNodes.SelectedNode.Name;
                }
                else
                {
                    tvNodes.SelectedNode = tvNodes.Nodes[0];
                    mode_cd.Text         = tvNodes.SelectedNode.Text;
                    mode_cd.KeyValue     = tvNodes.SelectedNode.Name;
                }
                var gvw_car_no = dde_car_no.FindControl("gvw_car_no") as ASPxGridView;
            }
            ASPxWebControl.RegisterBaseScript(Page);
        }