/// <summary>
        /// 显示品牌配置
        /// </summary>
        /// <returns></returns>
        public string GetBrandVen()
        {
            ProductStockBLL psb     = new ProductStockBLL();
            string          vencode = Request.Form["vencode"] == null ? "" : Request.Form["vencode"].ToString();
            StringBuilder   allpage = new StringBuilder();

            string[] str = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            char []  cr  = new char [] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
            for (int i = 0; i < str.Length; i++)
            {
                allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' id='" + str[i] + "' onchange='CheckAll(\"" + str[i] + "\")' />" + str[i] + "</div>");
                List <model.BrandVen> list = psb.GetBrandByVencode(vencode);
                list = list.Where(a => a.BrandNameVen.StartsWith(str[i])).ToList();
                for (int j = 0; j < list.Count; j++)
                {
                    allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='" + str[i] + "' id='" + list[j].BrandAbridge + "'>" + list[j].BrandNameVen + "</label></div>");
                }
                allpage.Append("</div><div style='clear:both'></div>");
            }
            List <model.BrandVen> listall = psb.GetBrandByVencode(vencode);

            for (int i = 0; i < str.Length; i++)
            {
                listall = listall.Where(a => a.BrandNameVen.StartsWith(str[i]) == false).ToList();
            }
            allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' id='else' onchange='CheckAll(else)' />其他</div>");
            for (int i = 0; i < listall.Count; i++)
            {
                allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='else' id='" + listall[i].BrandAbridge + "'>" + listall[i].BrandNameVen + "</label></div>");
            }
            return(allpage.ToString());
        }
Exemple #2
0
        /// <summary>
        /// 显示需要选择的页面
        /// </summary>
        /// <returns></returns>
        public string BrandShowPage()
        {
            StringBuilder allpage = new StringBuilder();

            if (userInfo.User.personaId == 1)  //如果是超级管理员
            {
                #region       超级管理员
                ProductStockBLL psb       = new ProductStockBLL();
                string          vencode   = Request.Form["vencode"] == null ? "" : Request.Form["vencode"].ToString();
                string          roleId    = Request.Form["roleId"] == null ? "0" : Request.Form["roleId"].ToString();
                string[]        BrandUser = ptb.GetBrandRole(vencode, roleId);
                string[]        str       = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
                for (int i = 0; i < str.Length; i++)
                {
                    string[] RoleBrand = bb.GetUserBrandName(roleId, vencode, str[i]);
                    if (RoleBrand.Length > 0)
                    {
                        allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' checked='checked' type='checkbox' id='" + str[i] + "' onchange='CheckAll(\"" + str[i] + "\")' />" + str[i] + "</div>");
                    }
                    else
                    {
                        allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' id='" + str[i] + "' onchange='CheckAll(\"" + str[i] + "\")' />" + str[i] + "</div>");
                    }
                    List <model.BrandVen> list = psb.GetBrandByVencode(vencode);
                    list = list.Where(a => a.BrandNameVen.StartsWith(str[i])).ToList();//匹配首字母
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (RoleBrand.Contains(list[j].BrandAbridge))
                        {
                            allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' checked='checked' Genre='Brand' name='" + str[i] + "' id='" + list[j].BrandAbridge + "'>" + list[j].BrandNameVen + "</label></div>");
                        }
                        else
                        {
                            allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='" + str[i] + "' id='" + list[j].BrandAbridge + "'>" + list[j].BrandNameVen + "</label></div>");
                        }
                    }
                    allpage.Append("</div><div style='clear:both'></div>");
                }
                List <model.BrandVen> listall = psb.GetBrandByVencode(vencode);
                for (int i = 0; i < str.Length; i++)
                {
                    listall = listall.Where(a => a.BrandNameVen.StartsWith(str[i]) == false).ToList();//排除首字母A-Z
                }
                string[] elsrRoleBrand = bb.GetUserBrandName(roleId, vencode);
                if (elsrRoleBrand.Length > 0)
                {
                    allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' checked='checked' id='rest' onchange='CheckAll(\"rest\")' />其他</div>");
                }
                else
                {
                    allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' id='rest' onchange='CheckAll(\"rest\")' />其他</div>");
                }
                for (int i = 0; i < listall.Count; i++)
                {
                    if (elsrRoleBrand.Contains(listall[i].BrandAbridge))
                    {
                        allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' checked='checked' name='rest' id='" + listall[i].BrandAbridge + "'>" + listall[i].BrandNameVen + "</label></div>");
                    }
                    else
                    {
                        allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='rest' id='" + listall[i].BrandAbridge + "'>" + listall[i].BrandNameVen + "</label></div>");
                    }
                }
                allpage.Append("</div><div style='clear:both'></div>");
                return(allpage.ToString());

                #endregion
            }
            else
            {
                #region   用户
                string   vencode      = Request.Form["vencode"] == null ? "" : Request.Form["vencode"].ToString();
                string   roleId       = Request.Form["roleId"] == null ? "0" : Request.Form["roleId"].ToString();
                string[] str          = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
                string[] strUserBrand = bb.GetUserBrandSx(userInfo.User.Id.ToString(), vencode);
                //首字母A-Z
                for (int i = 0; i < str.Length; i++)
                {
                    #region
                    List <model.BrandConfig> list = bb.GetAllUserBrand(roleId, vencode, str[i]);
                    if (list.Count > 0)
                    {
                        allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' checked='checked' type='checkbox' id='" + str[i] + "' onchange='CheckAll(\"" + str[i] + "\")' />" + str[i] + "</div>");
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (strUserBrand.Contains(list[j].BrandId))
                            {
                                allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' checked='checked' Genre='Brand' name='" + str[i] + "' id='" + list[j].BrandId + "'>" + list[j].BrandName + "</label></div>");
                            }
                            else
                            {
                                allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='" + str[i] + "' id='" + list[j].BrandId + "'>" + list[j].BrandName + "</label></div>");
                            }
                        }
                    }
                    allpage.Append("</div><div style='clear:both'></div>");
                    #endregion
                }
                //其他字符开头
                List <model.BrandConfig> listAll = bb.GetAllUserBrand(roleId, vencode);
                for (int i = 0; i < str.Length; i++)
                {
                    listAll = listAll.Where(a => a.BrandName.ToUpper().StartsWith(str[i]) == false).ToList();//排除首字母A-Z
                }
                allpage.Append("<div><div style='color:blue;font-size:15px;'><input class='ckeckboxAll' type='checkbox' checked='checked' id='else' onchange='CheckAll(else)' />其他</div>");
                for (int i = 0; i < listAll.Count; i++)
                {
                    if (strUserBrand.Contains(listAll[i].BrandId))
                    {
                        allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' checked='checked' Genre='Brand' name='else' id='" + listAll[i].BrandId + "'>" + listAll[i].BrandName + "</label></div>");
                    }
                    else
                    {
                        allpage.Append("<div style='float:left;min-width:120px'><label><input type='checkbox' Genre='Brand' name='else' id='" + listAll[i].BrandId + "'>" + listAll[i].BrandName + "</label></div>");
                    }
                }
                return(allpage.ToString());

                #endregion
            }
        }