Example #1
0
    //查询下级分类数据
    public string getCategoryResource(string cateId)
    {
        string data = string.Empty;

        string builder = string.Empty;

        LoginModel user = Session["UserModel"] as LoginModel;

        if (user != null)
        {
            builder = @" and yc.id in ( select fca.CMID from YZT_FCArea fca left join BD_Distributor dis on (fca.Province+fca.City+fca.Area=dis.Province+dis.City+dis.Area or fca.Province+fca.City=dis.Province+dis.City or fca.Province=dis.Province) and dis.IsEnabled=1 where 1=1 and dis.ID=" + user.DisID + " and fca.CompID=" + user.CompID + " union select fcd.CMID from YZT_FCDis fcd where fcd.DisID=" + user.DisID + "and fcd.CompID=" + user.CompID + " union select ID from YZT_CMerchants where type=1 and dr=0 and isnull(IsEnabled,0)=1)";
        }
        else
        {
            builder = @" and yc.Type=1 and isnull(yc.IsEnabled,0)=1";
        }

        string gtypeids = string.Empty;
        string sql      = "select g.CategoryID,gt.* from  YZT_CMerchants yc  left join BD_GoodsInfo info   on info.ID=yc.GoodsID left join BD_Goods g on g.ID=info.GoodsID left join SYS_GType gt on gt.ID=g.CategoryID where isnuLL(gt.dr,0)=0 and isnuLL(gt.IsEnabled,0)=1 and ParentId=" + cateId + builder;

        //查询商品一级分类数据
        //List<Hi.Model.SYS_GType> gtypes = new Hi.BLL.SYS_GType().GetList("id,TypeName", " dr=0 and IsEnabled=1 and ParentId=" + cateId + "", "createdate");

        List <Hi.Model.SYS_GType> gtypes = new List <Hi.Model.SYS_GType>();
        DataTable dt = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql);

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow item in dt.Rows)
            {
                Hi.Model.SYS_GType gt = new Hi.Model.SYS_GType();
                gt.ID       = item["ID"].ToString().ToInt(0);
                gt.ParentId = item["ParentId"].ToString().ToInt(0);
                gt.FullCode = item["FullCode"].ToString();
                gt.TypeName = item["TypeName"].ToString();
                gtypes.Add(gt);
            }
        }

        data = new JavaScriptSerializer().Serialize(gtypes);
        return(data);
    }
Example #2
0
    //新增一级分类
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string Typename = Common.NoHTML(txtTypeName.Value.Trim());
        int    Parentid = Common.NoHTML(hidePTypeId.Value.Trim()).ToInt(0);

        Hi.Model.SYS_GType gType = new Hi.Model.SYS_GType();
        gType.CreateDate = DateTime.Now;
        gType.CreateUser = UserID.ToString();
        gType.TypeName   = Typename;
        gType.ts         = gType.CreateDate;

        string[] codes = NewCategoryCode(Parentid);
        gType.TypeCode = codes[0];
        gType.FullCode = codes[1];
        gType.Deep     = codes[2].ToInt(0);
        gType.ParentId = Parentid;

        gType.IsEnd     = true;
        gType.IsEnabled = true;
        new Hi.BLL.SYS_GType().Add(gType);
        Page.ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('新增成功!', IconOption.笑脸, 1500);location.href='IndustryList.aspx';</script>");
    }
Example #3
0
    public void DataBindClass()
    {
        CategoryID3List   = "";
        Gtypediv2.Visible = false;
        Gtypediv3.Visible = false;

        List <Hi.Model.SYS_GType> GtypeModel = new Hi.BLL.SYS_GType().GetList("Deep,ID,ParentId,TypeCode,TypeName,FullCode", " dr='0' and IsEnabled=1 ", "ID asc");

        //绑定分类
        if (CategoryIDUrl != "0")                                                                                 //行业类别ID 不为空
        {
            Hi.Model.SYS_GType model = GtypeModel.Where(b => b.ID == Convert.ToInt32(CategoryIDUrl)).ToList()[0]; /*new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(Request.QueryString["CategoryID"]));*/
            if (model.Deep == 1)                                                                                  //一级分类
            {
                Gtypediv2.Visible    = true;                                                                      //展示二级分类
                GtypeName2.InnerHtml = "<i>" + model.TypeName + "</i>";
                CategoryID           = model.ID.ToString();                                                       //保存一级分类ID
                List <Hi.Model.SYS_GType> Lindustry3 = GtypeModel.Where(b => b.Deep == 3 && b.FullCode.Contains(model.TypeCode + "-")).ToList();
                foreach (var item in Lindustry3)
                {
                    CategoryID3List += item.ID + ",";
                }
                if (CategoryID3List != "" && CategoryID3List.Length > 0)
                {
                    CategoryID3List = CategoryID3List.Substring(0, CategoryID3List.Length - 1);
                }
            }
            else if (model.Deep == 2)                                                                               //二级分类
            {
                Gtypediv2.Visible = true;                                                                           //展示二级分类
                Gtypediv3.Visible = true;                                                                           //展示三级分类
                CategoryID        = model.ParentId.ToString();                                                      //保存一级分类ID
                CategoryID2       = model.ID.ToString();                                                            //保存二级分类ID
                Hi.Model.SYS_GType model2 = GtypeModel.Where(b => b.ID == Convert.ToInt32(CategoryID)).ToList()[0]; /*new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(CategoryID));*/
                GtypeName2.InnerHtml = "<i>" + model2.TypeName + "</i>";
                GtypeName3.InnerHtml = "<i>" + model.TypeName + "</i>";

                //绑定三级
                List <Hi.Model.SYS_GType> Lindustry3 = GtypeModel.Where(b => b.ParentId == Convert.ToInt32(CategoryID2)).ToList();
                //查询分类下所有三级ID
                foreach (var item in Lindustry3)
                {
                    CategoryID3List += item.ID + ",";
                }
                if (CategoryID3List.Length > 1)
                {
                    CategoryID3List = CategoryID3List.Substring(0, CategoryID3List.Length - 1);
                }
            }
            else if (model.Deep == 3)                            //三级分类
            {
                Gtypediv2.Visible = true;                        //展示二级分类
                Gtypediv3.Visible = true;                        //展示三级分类
                string TypeCode1 = model.FullCode.Split('-')[0]; //保存一级分类ID
                List <Hi.Model.SYS_GType> gTypes1 = GtypeModel.Where(T => T.TypeCode == TypeCode1).ToList();
                if (gTypes1.Count > 0)
                {
                    CategoryID = gTypes1[0].ID.ToString();
                }
                CategoryID2 = model.ParentId.ToString();                                                             //保存二级分类ID
                CategoryID3 = model.ID.ToString();                                                                   //保存二级分类ID
                Hi.Model.SYS_GType model2 = GtypeModel.Where(b => b.ID == Convert.ToInt32(CategoryID2)).ToList()[0]; /*new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(CategoryID2));*/
                Hi.Model.SYS_GType model1 = GtypeModel.Where(b => b.ID == Convert.ToInt32(CategoryID)).ToList()[0];  /*new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(CategoryID));*/
                GtypeName2.InnerHtml = "<i>" + model1.TypeName + "</i>";
                GtypeName3.InnerHtml = "<i>" + model2.TypeName + "</i>";
                CategoryID3List      = model.ID.ToString();
            }
            List <Hi.Model.SYS_GType> Lindustry2 = GtypeModel.Where(b => b.ParentId == Convert.ToInt32(CategoryID)).ToList();
            this.Gtype2.DataSource = Lindustry2;
            this.Gtype2.DataBind();
            if (CategoryID2 != "0")
            {
                //绑定三级
                List <Hi.Model.SYS_GType> Lindustry3 = GtypeModel.Where(b => b.ParentId == Convert.ToInt32(CategoryID2)).ToList();
                this.Gtype3.DataSource = Lindustry3;
                this.Gtype3.DataBind();
            }
        }

        //绑定一级分类
        List <Hi.Model.SYS_GType> Lindustry = GtypeModel.Where(b => b.ParentId == Convert.ToInt32(0)).ToList();

        // new Hi.BLL.SYS_GType().GetList("ID,TypeName", " dr='0' and IsEnabled=1 and ParentId=0  ", "ID asc");
        this.RepList.DataSource = Lindustry;
        this.RepList.DataBind();
    }
Example #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.SYS_GType model)
 {
     return(dal.Update(model));
 }
Example #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.SYS_GType model)
 {
     return(dal.Add(model));
 }