Ejemplo n.º 1
0
    //一级类别绑定
    protected void RepCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        int      id        = ((HiddenField)e.Item.FindControl("HiddenFieldID")).Value.ToInt();
        Repeater repBrands = (Repeater)e.Item.FindControl("RepBrands");

        repBrands.DataSource = ProductService.BrandsService.GetCategoryVouchBrands(id);
        repBrands.DataBind();

        //List<Expression> express = new List<Expression>();
        //express.Add(new Expression("CategoryId", "=", id.ToStr()));
        //List<TB_Product_CategoryBrand> list = ProductService.CategoryBrandsService.Search(express);
        //string bids = "";
        //foreach (TB_Product_CategoryBrand entity in list)
        //{
        //    bids += entity.BrandId.ToStr() + ",";
        //}
        //bids = bids.TrimEnd(',');
        //if (bids != "")
        //{
        //    List<Expression> express2 = new List<Expression>();
        //    express2.Add(new Expression("id", "in", bids));
        //    Repeater repBrands = (Repeater)e.Item.FindControl("RepBrands");
        //    repBrands.DataSource = ProductService.BrandsService.Search(express2);
        //    repBrands.DataBind();
        //}


        Repeater rep = (Repeater)e.Item.FindControl("RepChildCategory");

        rep.DataSource = DataToCacheHelper.GetProductCategory().Where(m => m.ParentID == id && m.TypeID == 0).OrderBy(m => m.OrderBy);
        rep.DataBind();
    }
Ejemplo n.º 2
0
    //加载
    public void LoadDataBind()
    {
        DDLModule.DataSource     = DataToCacheHelper.GetAllDictionaries().Where(w => w.TypeCode == "04").ToList();
        DDLModule.DataTextField  = "Name";
        DDLModule.DataValueField = "Code";
        DDLModule.DataBind();

        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            var model = VisionService.ExamVisionSubjectService.Get(ID);
            if (model.ID.ToInt() > 0)
            {
                Picture.Url             = model.PicUrl;
                FckDesc.Value           = model.Description;
                DDLModule.SelectedValue = model.Type;
                TbName.Text             = model.Name;
                TbOrderBy.Text          = model.OrderBy.ToStr();
                TbResult.Text           = model.Result;

                ViewState["id"] = model.ID;
            }
        }
    }
Ejemplo n.º 3
0
    //二级类别绑定
    protected void RepChildCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        int      id  = ((HiddenField)e.Item.FindControl("HiddenFieldID")).Value.ToInt();
        Repeater rep = (Repeater)e.Item.FindControl("RepChildCategory");

        rep.DataSource = DataToCacheHelper.GetProductCategory().Where(m => m.ParentID == id && m.TypeID == 0).OrderBy(m => m.OrderBy);
        rep.DataBind();
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IEnumerable <TB_Product_Categorys> list = DataToCacheHelper.GetProductCategory().Where(c => c.ParentID == 0 && c.TypeID == 0);

        if (IsHome == true)
        {
            list = list.Where(c => c.VouchType == 1).OrderBy(c => c.OrderBy);
        }
        RepCategory.DataSource = list;
        RepCategory.DataBind();
    }
Ejemplo n.º 5
0
    public void LoadDataBind(int pageIndex)
    {
        categoryList = DataToCacheHelper.GetProductCategory().Where(m => m.ParentID == 0 && m.TypeID == 1).OrderBy(m => m.OrderBy).ToList();

        int recordCount           = 0;
        List <Expression> express = new List <Expression>();

        express.Add(new Expression("IsDelete", "=", "0"));
        express.Add(new Expression("StopDate", "<", DateTime.Now.ToShortDateString()));
        groupBuyList             = ProductService.GroupService.Search(AspNetPager1.PageSize, pageIndex, express, "id desc,addDate desc", ref recordCount);
        AspNetPager1.RecordCount = recordCount;
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 获取数据字典实体
    /// </summary>
    /// <param name="code"></param>
    /// <returns></returns>
    public static TB_System_Dictionary GetDictionary(string code)
    {
        var list = DataToCacheHelper.GetAllDictionaries().Where(d => d.Code == code);

        if (list.Count() > 0)
        {
            return(list.First());
        }
        else
        {
            return(new TB_System_Dictionary());
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ButtonDelete.Attributes.Add("onclick", "return confirm('确认删除这条信息吗?')");
        if (!IsPostBack)
        {
            ViewState["PageIndex"] = 1;
            ViewState["search"]    = "";
            LoadDataBind();

            DDLModule.DataSource     = DataToCacheHelper.GetAllDictionaries().Where(w => w.TypeCode == "04").ToList();
            DDLModule.DataTextField  = "Name";
            DDLModule.DataValueField = "Code";
            DDLModule.DataBind();

            ListItem li = new ListItem();
            li.Text  = "==请选择类型==";
            li.Value = "";
            DDLModule.Items.Insert(0, li);
        }
    }
    /// <summary>
    /// 权限
    /// </summary>
    /// <param name="showMenu">展示菜单导航</param>
    /// <returns></returns>
    public List <TB_Admin_Resources> Permission(bool showMenu)
    {
        return(new CommonHelpers().Permission());

        List <TB_Admin_Resources> modelList = new List <TB_Admin_Resources>();

        //获取以及资源信息
        List <TB_Admin_Resources> resourcesList = DataToCacheHelper.GetPermission();

        resourcesList = resourcesList.Where(r => r.ParentID == 0).ToList();
        if (showMenu == true)
        {
            resourcesList = resourcesList.Where(r => r.IsShow == true).ToList();
        }

        //遍历信息
        foreach (TB_Admin_Resources resource in resourcesList)
        {
            TB_Admin_Resources model = resource;
            model.ChildTree = new List <TB_Admin_Resources>();

            //获取子集
            List <TB_Admin_Resources> childList = DataToCacheHelper.GetPermission();
            childList = childList.Where(r => r.ParentID == resource.ID).ToList();

            if (showMenu == true)
            {
                childList = childList.Where(r => r.IsShow == true).ToList();
            }

            //判断资源编号是否在用户资源列表中
            foreach (var child in childList)
            {
                model.ChildTree.Add(child);
            }

            modelList.Add(model);
        }

        return(modelList);
    }
Ejemplo n.º 9
0
    //加载
    public void LoadDataBind()
    {
        DDLModule.DataSource     = DataToCacheHelper.GetAllDictionaries().Where(w => w.TypeCode == "03").ToList();
        DDLModule.DataTextField  = "Name";
        DDLModule.DataValueField = "Code";
        DDLModule.DataBind();

        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            var model = BasicService.ExamPrincipleService.Get(ID);
            if (model.ID.ToInt() > 0)
            {
                Picture.Url             = model.PicUrl;
                FckDesc.Value           = model.Description;
                DDLModule.SelectedValue = model.Module;
                ViewState["id"]         = model.ID;
            }
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 获取数据字典列表,绑定下拉框
    /// </summary>
    /// <param name="code">类别标识</param>
    /// <param name="dropDownList">下拉框ID</param>
    public static List <TB_System_Dictionary> GetDictionarys(string code, DropDownList dropDownList)
    {
        var list = DataToCacheHelper.GetAllDictionaries().Where(d => d.TypeCode == code).OrderBy(d => d.OrderBy).ToList();

        if (dropDownList != null)
        {
            ListItem li0 = new ListItem();
            li0.Text  = "==请选择==";
            li0.Value = "";
            dropDownList.Items.Add(li0);

            foreach (var item in list)
            {
                ListItem li = new ListItem();
                li.Text  = item.Name;
                li.Value = item.Code;
                dropDownList.Items.Add(li);
            }
        }
        return(list);
    }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取数据字典列表,绑定下拉框
        /// </summary>
        /// <param name="code">类别标识</param>
        /// <param name="dropDownList">下拉框ID</param>
        public static List <SelectListItem> GetDictionarys(string code, string defaultTxt)
        {
            var list = DataToCacheHelper.GetAllDictionaries().Where(d => d.TypeCode == code).OrderBy(d => d.OrderBy).ToList();

            List <SelectListItem> selectList = new List <SelectListItem>();
            SelectListItem        li0        = new SelectListItem();

            li0.Text  = defaultTxt;
            li0.Value = "";
            selectList.Add(li0);

            foreach (var item in list)
            {
                SelectListItem li = new SelectListItem();
                li.Text  = item.Name;
                li.Value = item.Code;
                selectList.Add(li);
            }

            return(selectList);
        }
Ejemplo n.º 12
0
    /// <summary>
    /// 权限
    /// </summary>
    /// <param name="moduleList">用户所属角色对应的权限</param>
    /// <param name="showMenu">展示菜单导航</param>
    /// <returns></returns>
    public List <TB_Admin_Resources> Permission(bool showMenu)
    {
        List <int>        resourcesIds = new List <int>();
        int               AdminUserID  = System.Web.HttpContext.Current.Request.Cookies["AdminInfo"].Values["ID"].ToInt();
        List <Expression> expression   = new List <Expression>();

        expression.Add(new Expression("AdminUserID", "=", AdminUserID.ToString()));
        List <TB_Admin_UserInRole> userInRoles = AdminService.UserInRoleService.Search(expression);

        //循环用户角色
        foreach (TB_Admin_UserInRole userRole in userInRoles)
        {
            //通过角色查询出角色对应的资源
            List <Expression> expression2 = new List <Expression>();
            expression2.Add(new Expression("RoleID", "=", userRole.RoleID.ToString()));
            IEnumerable <int> roleInfoResources = AdminService.RoleInResourcesService.Search(expression2).Select(r => r.ResourceID);

            resourcesIds.AddRange(roleInfoResources);
        }

        List <TB_Admin_Resources> modelList = new List <TB_Admin_Resources>();

        //获取以及资源信息
        List <TB_Admin_Resources> resourcesList = DataToCacheHelper.GetPermission();

        resourcesList = resourcesList.Where(r => r.ParentID == 0).ToList();
        if (showMenu == true)
        {
            resourcesList = resourcesList.Where(r => r.IsShow == true).ToList();
        }

        //遍历信息
        foreach (TB_Admin_Resources resource in resourcesList)
        {
            if (resourcesIds.Contains(resource.ID))
            {
                TB_Admin_Resources model = resource;
                model.ChildTree = new List <TB_Admin_Resources>();

                //获取子集
                List <TB_Admin_Resources> childList = DataToCacheHelper.GetPermission();
                childList = childList.Where(r => r.ParentID == resource.ID).ToList();

                if (showMenu == true)
                {
                    childList = childList.Where(r => r.IsShow == true).ToList();
                }

                //判断资源编号是否在用户资源列表中
                foreach (var child in childList)
                {
                    if (resourcesIds.Contains(child.ID))
                    {
                        model.ChildTree.Add(child);
                    }
                }

                modelList.Add(model);
            }
        }

        return(modelList);
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Response.Write(YK.Core.Core<TB_Admin_User>.CoreTemplate.Search().Count);

        //ActivityHelper.GetActivity();

        //EmailHelper.SendEmail("xxxxxxxxx","xxxxxxxx","*****@*****.**","");

        if (!IsPostBack)
        {
            int i = 0;
            foreach (List <TB_Product_Products> list in DataToCacheHelper.GetIndexVouchProducts())
            {
                i++;
                switch (i)
                {
                case 1:
                    RepVouchList.DataSource = list;
                    RepVouchList.DataBind();
                    break;

                case 2:
                    RepVouchList2.DataSource = list;
                    RepVouchList2.DataBind();
                    break;

                case 3:
                    RepVouchList3.DataSource = list;
                    RepVouchList3.DataBind();
                    break;

                case 4:
                    RepVouchList4.DataSource = list;
                    RepVouchList4.DataBind();
                    break;
                }
            }

            List <Expression> SpecialsOne = new List <Expression>();
            SpecialsOne.Add(new Expression("Mark", "like", "3"));

            RepSpecialsOne.DataSource = ProductService.ProductsService.Search(6, SpecialsOne, "OrderBy asc,addDate desc");
            RepSpecialsOne.DataBind();

            //底部推荐的一级类别
            List <Expression> vouchCategory = new List <Expression>()
            {
                new Expression("ParentID", "=", "0"),
                new Expression("VouchType", "=", "1")
            };

            //System.Linq.Expressions.Expression<Func<TB_Product_Categorys, bool>> fun = null;
            //fun=c=>c.ID<10;

            //var lambda = System.Linq.Expressions.Expression.Lambda<Func<TB_Product_Categorys, bool>>(fun.Body, fun.Parameters);

            //Expression<Func<Package, bool>> expr = new Expression<Func<Package,bool>>();

            Func <TB_Product_Categorys, bool> fun = new Func <TB_Product_Categorys, bool>(c => c.ID < 10);
            //fun = c => c.ID > 6;

            RepVouchCategory.DataSource = ProductService.CategoryService.Search(vouchCategory).OrderBy(c => c.OrderBy);
            RepVouchCategory.DataBind();
        }
    }
Ejemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     categorysList = DataToCacheHelper.GetProductCategory();
 }