Пример #1
0
    public void Bind()
    {
        List <Hi.Model.SYS_GType> GtypeList = new Hi.BLL.SYS_GType().GetList("ID,ParentId,TypeName,IsEnabled,(select top 1 '1'  from SYS_GType sg where sg.ParentId=SYS_GType.ID )SVdef3", "  dr= 0 and IsEnabled = 1 and ParentId=0", "");

        this.rptGTypeList.DataSource = GtypeList;
        this.rptGTypeList.DataBind();
    }
Пример #2
0
    public void GtypeBind()
    {
        List <Hi.Model.SYS_GType> list = new Hi.BLL.SYS_GType().GetList("", " dr=0 and IsEnabled=1 and Deep=1", "");

        this.Gtype.DataSource = list;
        this.Gtype.DataBind();
    }
Пример #3
0
    /// <summary>
    /// 绑定分类
    /// </summary>
    public void DataBindClass()
    {
        List <Hi.Model.SYS_GType> Lindustry = new Hi.BLL.SYS_GType().GetList("top 16 *", "dr='0' and IsEnabled=1 and Deep=1 ", "ID asc");

        this.RepList.DataSource = Lindustry;
        this.RepList.DataBind();
    }
Пример #4
0
    public void Bind()
    {
        List <Hi.Model.SYS_GType> GtypeList = new Hi.BLL.SYS_GType().GetList("", "  dr= 0 and IsEnabled = 1 and ParentId=0", "");

        this.rptGTypeList.DataSource = GtypeList;
        this.rptGTypeList.DataBind();
    }
Пример #5
0
 /// <summary>
 /// 绑定前台导航
 /// </summary>
 public void TitleDivDataBind()
 {
     if (CategoryIDUrl != "0")
     {
         int categoryID = Convert.ToInt32(CategoryIDUrl);
         Hi.Model.SYS_GType Lindustry = new Hi.BLL.SYS_GType().GetModel(categoryID);
         TitleDiv.InnerHtml  = "<i class='bt'>全部结果</i>>";
         TitleDiv.InnerHtml += "<i class='cdn'>" + Lindustry.TypeName + "<a href='javascript:;' class='close'></a></i>";
     }
 }
Пример #6
0
    //生成新的分类0: code 和 1:Fullcode  和 2:Deep

    public string[] NewCategoryCode(int pid)
    {
        string[] codes = new string[3];

        if (pid > 0)
        {
            List <Hi.Model.SYS_GType> PList = new Hi.BLL.SYS_GType().GetList("top 1 *", " id = '" + pid + "' and dr = 0", "");
            if (PList.Count > 0)
            {
                codes[2] = (PList[0].Deep + 1).ToString(); //赋值deep级数
                List <Hi.Model.SYS_GType> oneList = new Hi.BLL.SYS_GType().GetList("top 1 TypeCode", " Deep = '" + codes[2] + "' and dr = 0", "ID desc");
                if (oneList.Count > 0)
                {
                    codes[0] = (oneList[0].TypeCode.ToInt() + 1).ToString();
                }
                else
                {
                    if (codes[2].ToInt(0) == 2)
                    {
                        codes[0] = "100";
                    }
                    else
                    {
                        codes[0] = "1000";
                    }
                }
                codes[1] = PList[0].FullCode + "-" + codes[0];
                if (PList[0].IsEnd)
                {
                    PList[0].ts    = DateTime.Now;
                    PList[0].IsEnd = false;
                    new Hi.BLL.SYS_GType().Update(PList[0]);
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                        "<script>layerCommon.msg('父节点不存在,请确认!', IconOption.哭脸, 2000);</script>");
            }
        }
        else
        {
            codes[2] = "1";
            List <Hi.Model.SYS_GType> oneList = new Hi.BLL.SYS_GType().GetList("top 1 TypeCode", " ParentId = 0", "ID desc");
            if (oneList.Count > 0)
            {
                codes[1] = codes[0] = (oneList[0].TypeCode.ToInt(0) + 1).ToString();
            }
            else
            {
                codes[1] = codes[0] = "10";
            }
        }
        return(codes);
    }
Пример #7
0
 /// <summary>
 /// 获取商品分类
 /// </summary>
 /// <param name="Gid"></param>
 /// <returns></returns>
 public string Gtype(string Gid)
 {
     Hi.Model.SYS_GType gtype = new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(Gid));
     if (gtype != null)
     {
         return("{\"TypeName\":\"" + gtype.TypeName + "\",\"ID\":\"" + gtype.ID + "\"}");
     }
     else
     {
         return("{\"TypeName\":\"请选择\",\"ID\":\"0\"}");
     }
 }
Пример #8
0
    //    public void databind()
    //    {
    //        StringBuilder strwhere = new StringBuilder();
    //        string sql = Returnsql(CompId.ToString(), DisID.ToString(), strwhere.ToString());
    //        //查询商品信息
    //        Pagger pagger = new Pagger(sql);
    //        Pager.RecordCount = pagger.GetDataCount(sql);
    //        DataTable dt = pagger.getData(Pager.PageSize, Pager.StartRecordIndex - 1);

    //        this.rpGoodsInfo.DataSource = dt;
    //        this.rpGoodsInfo.DataBind();
    //    }

    //    public string Returnsql(string Compid, string DisId, string where)
    //    {
    //        StringBuilder sql = new StringBuilder();

    //        sql.AppendFormat(@"select info.ID,info.GoodsID,info.CompID,info.ValueInfo,info.Inventory,info.SalePrice,info.BarCode
    //,g.GoodsName,g.CategoryID,g.Unit,g.Pic
    //,coll.GoodsID collGoodsID
    //,dis.TinkerPrice disTinkerPrice
    //,pro.ProID ,pro.ID prodID,pro.GoodInfoID,pro.GoodsPrice proGoodsPrice,pro.Discount proDiscount,pro.CreateDate proCreateDate
    //,pro.Type proTypes,pro.ProType
    //,case when isnull(ProType,0) not in (3,5,6) then (case when isnull(ProID,0)<>0 then pro.GoodsPrice
    // when isnull(dis.TinkerPrice,0)<>0 then dis.TinkerPrice else info.SalePrice end)
    // when isnull(dis.TinkerPrice,0)<>0 then dis.TinkerPrice else info.SalePrice end pr
    //from BD_GoodsInfo info left join BD_Goods g on info.GoodsID=g.ID
    //left join BD_DisCollect coll on coll.GoodsID=info.GoodsID and coll.CompID={0} and coll.DisID={1}
    //left join BD_GoodsPrice dis on dis.GoodsInfoID=info.ID and dis.CompID={0} and dis.DisID={1} and Isnull(dis.IsEnabled,0)=1
    //left join (select a.ProID,a.ID,a.GoodInfoID,a.GoodsPrice,a.Discount,a.CreateDate,a.ProType,a.Type from
    //(select prod.ProID,prod.ID,prod.GoodInfoID,GoodsPrice,pro.Discount,pro.CreateDate,pro.ProType,pro.Type
    //,pro.IsEnabled,pro.dr,pro.ProStartTime,pro.ProEndTime,pro.CompID
    //from BD_Promotion pro left join  BD_PromotionDetail prod on pro.ID=prod.ProID ) a
    //inner join (select  max(prod.ID) ID,max(ProID) proID,prod.GoodInfoID from BD_Promotion as pro
    //left join BD_PromotionDetail as prod on pro.ID=prod.ProID group by prod.GoodInfoID) b
    //on a.ID=b.ID and a.proID=b.proID and a.goodInfoID=b.GoodInfoID
    //where Isnull(a.Type,0) in (0,1) and isnull(a.ProType,0)in(1,2,3,4)
    //and isnull(a.dr,0)=0  and isnull(a.IsEnabled,0)=1 and getdate() between  a.ProStartTime and a.ProEndTime
    //and a.CompID={0}) as pro on pro.GoodInfoID=info.ID
    //where isnull(info.IsOffline,0)=1 and isnull(info.dr,0)=0 and isnull(info.IsEnabled,0)=1 and info.CompID={0}
    //and isnull(g.IsEnabled,0)=1 and isnull(g.IsOffline,0)=1 and isnull(g.dr,0)=0 {2}
    //order by pro.CreateDate desc,coll.GoodsID desc,g.CreateDate desc", Compid, DisId, where);

    //        return sql.ToString();
    //    }

    //    public void Pager_PageChanged(object sender, EventArgs e)
    //    {
    //        databind();
    //    }

    /// <summary>
    /// 绑定商品分类
    /// </summary>
    /// <param name="CompId"></param>
    /// <returns></returns>
    public string GoodsCategory()
    {
        StringBuilder sb = new StringBuilder();

        List <Hi.Model.SYS_GType> gTypes = new Hi.BLL.SYS_GType().GetList("Deep,TypeName,ID,ParentID", " Isnull(dr,0)=0 and Isnull(IsEnabled,0)=1", "");

        if (gTypes != null && gTypes.Count > 0)
        {
            //商品分类一级
            List <Hi.Model.SYS_GType> cl1 = gTypes.FindAll(p => p.Deep == 1 && p.ParentId == 0);
            if (cl1 != null && cl1.Count > 0)
            {
                sb.Append("<div class=\"sorts\">");

                sb.AppendFormat("<div class=\"sorts1\"><i class=\"arrow2\"></i><a href=\"javascript:;\" class=\"a1\" tip=\"\">{0}</a></div>", "全部");
                sb.Append("</div>");
                foreach (var item in cl1)
                {
                    sb.Append("<div class=\"sorts\">");

                    sb.AppendFormat("<div class=\"sorts1\"><i class=\"arrow2\"></i><a href=\"javascript:;\" class=\"a1\" tip=\"{1}\">{0}</a></div>", item.TypeName, item.ID);

                    //商品分类二级
                    List <Hi.Model.SYS_GType> cl2 = gTypes.FindAll(p => p.Deep == 2 && p.ParentId == item.ID);
                    if (cl2 != null && cl2.Count > 0)
                    {
                        sb.Append("<ul class=\"sorts2\" tipdis=\"no\" style=\"display:none;\">");
                        foreach (var item2 in cl2)
                        {
                            sb.Append("<li>");
                            sb.AppendFormat("<i class=\"arrow3\"></i><a href=\"javascript:;\" tip=\"{1}\">{0}</a>", item2.TypeName, item2.ID);
                            //商品分类三级
                            List <Hi.Model.SYS_GType> cl3 = gTypes.FindAll(p => p.Deep == 3 && p.ParentId == item2.ID);

                            if (cl3 != null && cl3.Count > 0)
                            {
                                sb.Append("<ul class=\"sorts3\" tipdis=\"no\" style=\"display:none;\">");
                                foreach (var item3 in cl3)
                                {
                                    sb.AppendFormat("<li tip=\"{1}\"><a href=\"javascript:;\" tip=\"{1}\">{0}</a></li>", item3.TypeName, item3.ID);
                                }
                                sb.Append("</ul>");
                            }
                            sb.Append("</li>");
                        }
                        sb.Append("</ul>");
                    }
                    sb.Append("</div>");
                }
            }
        }
        return(sb.ToString());
    }
Пример #9
0
    /// <summary>
    /// 查询二级分类下的子类
    /// </summary>
    /// <param name="ParentId">二级分类ID</param>
    /// <returns></returns>
    public string two(string ParentId)
    {
        List <Hi.Model.SYS_GType> GtypeList = new Hi.BLL.SYS_GType().GetList("", "  dr= 0 and IsEnabled = 1 and ParentId=" + ParentId + "", "");
        string html = "";

        foreach (var item in GtypeList)
        {
            html += "<tr id = '" + item.ID + "' class=\"tr" + item.ParentId + " tr3\" parentid = '" + item.ParentId + "' style = 'height: 26px;width: 100%;' >" +
                    "<td ><div  style=\"margin-left:80px;width:150px\"> <img class=\"Openimg3\" height='9' src='../../Company/images/menu_minus.gif' width='9'" +
                    "border='0' />&nbsp;" + item.TypeName + "---" + item.ID + "</div></td><td><div class=\"tcle\">" +
                    "" + (item.IsEnabled ? "启用" : "禁用") + "</div></td></tr>";
        }
        return(html);
    }
Пример #10
0
    /// <summary>
    /// 查询一级分类下的子类
    /// </summary>
    /// <param name="ParentId">一级分类ID</param>
    /// <returns></returns>
    public string one(string ParentId)
    {
        List <Hi.Model.SYS_GType> GtypeList = new Hi.BLL.SYS_GType().GetList("ID,ParentId,TypeName,IsEnabled,(select top 1 '1'  from SYS_GType sg where sg.ParentId=SYS_GType.ID )SVdef3", "  dr= 0 and IsEnabled = 1 and ParentId=" + ParentId + "", "");
        string html = "";

        foreach (var item in GtypeList)
        {
            html += "<tr id = '" + item.ID + "' class=\"tr" + item.ParentId + " tr2\" parentid = '" + item.ParentId + "' style = 'height: 26px;width: 100%;' >" +
                    "<td ><div  style=\"margin-left:50px;width:150px\"> <img class=\"Openimg2\" height='9' src='../../Company/images/" + (item.SVdef3 == null ? "menu_minus" : "menu_plus") + ".gif' width='9'" +
                    "border='0' />&nbsp;" + item.TypeName + "</div></td><td><div class=\"tcle\">" +
                    "" + (item.IsEnabled ? "启用" : "禁用") + "</div></td> </tr>";
        }
        return(html);
    }
Пример #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!string.IsNullOrEmpty(treeid))
         {
             Hi.Model.SYS_GType type = new Hi.BLL.SYS_GType().GetModel(treeid.ToInt(0));
             if (type != null)
             {
                 this.txt_product_class.Value = type.TypeName;
                 this.hid_product_class.Value = type.ID.ToString();
             }
         }
     }
 }
Пример #12
0
    //查询数据
    public void loadData()
    {
        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";
        }

        //查询企业数据
        List <Hi.Model.BD_Company> comps = new Hi.BLL.BD_Company().GetList("id,CompName", " dr=0 and IsEnabled=1 and AuditState=2 and exists(select 1 from YZT_CMerchants  yc  where yc.InvalidDate >=getdate() and yc.CompID = BD_Company.id " + builder + ")", " AuditState");

        Rp_Production.DataSource = comps;
        Rp_Production.DataBind();

        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 " + builder;

        DataTable dt = SqlHelper.GetTable(SqlHelper.LocalSqlServer, sql);

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow item in dt.Rows)
            {
                if (item["deep"].ToString() == "1")
                {
                    gtypeids += gtypeids != "" ? "," + item["ID"].ToString() : item["ID"].ToString();
                }
                else
                {
                    string cid = getCategoryDet(item["ParentId"].ToString());
                    gtypeids += gtypeids != "" ? "," + cid : cid;
                }
            }
        }

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

        Rp_Category1.DataSource = gtypes;
        Rp_Category1.DataBind();
    }
Пример #13
0
 /// <summary>
 /// 编辑
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     Hi.Model.SYS_GType gType = new Hi.BLL.SYS_GType().GetModel(hideTypeId.Value.Trim().ToInt(0));
     if (gType != null)
     {
         gType.TypeName = txtTypeNames.Value.Trim();
         gType.ts       = DateTime.Now;
         new Hi.BLL.SYS_GType().Update(gType);
         Response.Redirect("IndustryList.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                 "<script>layerCommon.msg('此分类不存在,请确认!', IconOption.错误, 2000);</script>");
     }
 }
Пример #14
0
    /// <summary>
    /// 商品列表绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = "  and ComPid=" + this.CompID + " and isnull(dr,0)=0";

        if (ViewState["strWhere"] != null)
        {
            strWhere += ViewState["strWhere"].ToString();
        }
        else
        {
            if (this.ddlState.SelectedValue != "")
            {
                strWhere += " and isNUll(IsOffLine,0)=" + this.ddlState.SelectedValue;
            }
        }
        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strWhere, out pageCount, out Counts);
        List <int> CateIds         = l.Select(T => T.CategoryID).ToList();

        CateIds = CateIds.Distinct().ToList();
        List <Hi.Model.SYS_GType> CateList = new List <Hi.Model.SYS_GType>();

        if (CateIds.Count > 0)
        {
            CateList = new Hi.BLL.SYS_GType().GetList("TypeName,ID", "dr=0 and ID in(" + string.Join(",", CateIds) + ")", "");
        }
        ViewState["CateList"]    = CateList;
        this.rptGoods.DataSource = l;
        this.rptGoods.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Пример #15
0
    /// <summary>
    /// 递归得到第一级分类ID
    /// </summary>
    /// <param name="cateId"></param>
    /// <returns></returns>
    public string getCategoryDet(string cateId)
    {
        List <Hi.Model.SYS_GType> gtypes = new Hi.BLL.SYS_GType().GetList("", "dr=0 and IsEnabled=1 and ID=" + cateId, "");

        if (gtypes != null && gtypes.Count > 0)
        {
            if (gtypes[0].Deep != 1)
            {
                cid = string.Empty;
                getCategoryDet(gtypes[0].ParentId.ToString());
            }
            else
            {
                cid = gtypes[0].ID.ToString();
            }
        }
        return(cid);
    }
Пример #16
0
    public string del(string typeId)
    {
        Hi.Model.SYS_GType gType    = new Hi.BLL.SYS_GType().GetModel(typeId.Trim().ToInt(0));
        Hi.BLL.SYS_GType   BllGtype = new Hi.BLL.SYS_GType();
        if (gType != null)
        {
            if (gType.ParentId > 0)
            {
                gType.ts = DateTime.Now;
                gType.dr = true;

                //重置父级是否末节点
                List <Hi.Model.SYS_GType> oneList = new Hi.BLL.SYS_GType().GetList("top 1 TypeCode", " ParentId = '" + gType.ParentId + "' and dr = 0", "ID desc");
                if (oneList.Count > 0)
                {
                    Hi.Model.SYS_GType PgType = new Hi.BLL.SYS_GType().GetModel(gType.ParentId);
                    PgType.ts    = DateTime.Now;
                    PgType.IsEnd = true;
                    BllGtype.Update(PgType);
                }
                BllGtype.Update(gType);

                //同时删除子分类
                List <Hi.Model.SYS_GType> childList = new Hi.BLL.SYS_GType().GetList("", " ParentId = '" + gType.ID + "' and dr = 0", "ID desc");
                foreach (Hi.Model.SYS_GType childType in childList)
                {
                    childType.ts = DateTime.Now;
                    childType.dr = true;
                    BllGtype.Update(childType);
                }
            }
            else
            {
                gType.ts = DateTime.Now;
                gType.dr = true;
                BllGtype.Update(gType);
            }
            return("1");
        }
        else
        {
            return("删除失败,此分类不存在!");
        }
    }
Пример #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (UType == "label")
         {
             txt_txtIndusname.Visible = false;
             lblIndusName.Visible = true;
         }
         if (!string.IsNullOrEmpty(id))
         {
             Hi.Model.SYS_GType type = new Hi.BLL.SYS_GType().GetModel(id.ToInt(0));
             if (type != null)
             {
                 txt_txtIndusname.Value = type.TypeName;
                 lblIndusName.InnerText = type.TypeName;
                 hid_IndusId.Value = id;
             }
         }
     }
 }
Пример #18
0
 /// <summary>
 /// 获取行业分类三级分类名称
 /// </summary>
 /// <param name="ParentId"></param>
 /// <returns></returns>
 public string GetGtypeName(string ParentId)
 {
     Hi.Model.SYS_GType gtype3 = new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(ParentId));
     if (gtype3 != null)
     {
         Hi.Model.SYS_GType gtype2 = new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(gtype3.ParentId));
         if (gtype2 == null)
         {
             return("(请重新选择系统大类)");
         }
         Hi.Model.SYS_GType gtype1 = new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(gtype2.ParentId));
         if (gtype1 == null)
         {
             return("(请重新选择系统大类)");
         }
         return("(" + gtype1.TypeName + ">" + gtype2.TypeName + ">" + gtype3.TypeName + ")");
     }
     else
     {
         return("(请重新选择系统大类)");
     }
 }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            List <Hi.Model.SYS_SysName> SysNameList = new Hi.BLL.SYS_SysName().GetList("Value", " name='搜索热词' and  dr=0 ", "");
            if (SysNameList.Count > 0)
            {
                List <string> valuelist = SysNameList[0].Value.Split(',').ToList();
                StringBuilder sb        = new StringBuilder();
                int           count     = 0;
                foreach (var item in valuelist)
                {
                    count++;
                    if (count == 1)
                    {
                        sb.Append(" <a href =\"goodslist_0_" + item + ".html\" style=\"color:red\">" + item + "</a>");
                    }
                    else
                    {
                        sb.Append(" <a href =\"goodslist_0_" + item + ".html\">" + item + "</a>");
                    }
                }
                SelectValue.InnerHtml = sb.ToString();
            }
            if (!IsIndex)
            {
                leftNav.Style.Add("display", "none");
            }

            List <Hi.Model.SYS_GType> gType = new Hi.BLL.SYS_GType().GetList("", " ParentId=0 and IsEnabled=1 and ISNULL(dr,0)=0", "");
            if (gType != null && gType.Count > 0)
            {
                this.rpt_Gtype.DataSource = gType;
                this.rpt_Gtype.DataBind();
            }
        }
    }
Пример #20
0
    /// <summary>
    /// 验证商品大类下是否包含这个商品一级分类
    /// </summary>
    /// <returns></returns>
    public string CheckGoodsCate(string value, string str, DataRow dr)
    {
        string catestr = string.Empty;

        string[] catelist = value.Split('/');//根据/分隔商品分类
        for (int i = 0; i < catelist.Length; i++)
        {
            string cateValue = catelist[i].Replace("'", "''");
            if (i == 0)
            {//一级
                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=0   and TypeName='" + cateValue + "'", "");
                if (l.Count == 0)
                {
                    dr["chkstr"] += "<br>" + "没有【" + catelist[i] + "】这个一级分类!";
                    return(catestr);
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 1)//只有一级分类情况
                    {
                        List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + l[0].ID + "", "");
                        if (ll.Count > 0)
                        {
                            dr["chkstr"] += "<br>" + "【" + catelist[i] + "】一级分类下还有二级分类,必须输入最小的分类!";
                            return(catestr);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else if (i == 1)
            {//二级
                string goodsCateId = string.Empty;
                if (catestr.IndexOf("@") != -1)
                {
                    goodsCateId = catestr.Split('@')[1];
                    catestr     = catestr.Split('@')[0];
                }
                else
                {
                    List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=0   and TypeName='" + catestr + "'", "");
                    if (ll.Count > 0)
                    {
                        goodsCateId = ll[0].ID.ToString();
                    }
                }
                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1  and TypeName='" + cateValue + "'  and parentid=" + goodsCateId, "");
                if (l.Count == 0)
                {
                    dr["chkstr"] += "<br>" + "【" + catestr + "】一级分类下没有【" + catelist[i] + "】这个二级分类!";
                    return(catestr);
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 2)//只有二级分类情况
                    {
                        List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + l[0].ID + " ", "");
                        if (ll.Count > 0)
                        {
                            dr["chkstr"] += "<br>" + "【" + catelist[i] + "】二级分类下还有三级分类,必须输入最小的分类!";
                            return(catestr);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else if (i == 2)
            { //三级
                string goodsCateId = string.Empty;
                if (catestr.IndexOf("@") != -1)
                {
                    goodsCateId = catestr.Split('@')[1];
                    catestr     = catestr.Split('@')[0];
                }
                else
                {
                    List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid!=0   and TypeName='" + catestr + "' ", "");
                    if (ll.Count > 0)
                    {
                        goodsCateId = ll[0].ID.ToString();
                    }
                }

                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + goodsCateId + " and TypeName='" + cateValue + "' ", "");
                if (l.Count == 0)
                {
                    dr["chkstr"] += "<br>" + "【" + catestr + "】二级分类下没有【" + catelist[i] + "】这个三级分类!";
                    return(catestr);
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 3)//只有二级分类情况
                    {
                        break;
                    }
                }
            }
        }
        return(catestr);
    }
Пример #21
0
    /// <summary>
    /// 绑定产品信息
    /// </summary>
    /// <param name="id"></param>
    public void Bind(int id)//, int goodsInfoId)
    {
        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id);
        if (model != null && model.dr == 0 && model.IsEnabled == 1)
        {
            if (goodsInfoId == 0)
            {
                List <Hi.Model.BD_GoodsInfo> l = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsid=" + id, "");
                if (l.Count > 0)
                {
                    this.lblCode.InnerText      = l[0].BarCode.Trim();       //商品编号
                    this.lblInventory.InnerText = l[0].Inventory.ToString(); //商品库存.
                    goodsInfoId = l[0].ID;
                }
            }
            else
            {
                Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                if (model2 != null)
                {
                    this.lblCode.InnerText      = model2.BarCode.Trim();       //商品编号
                    this.lblInventory.InnerText = model2.Inventory.ToString(); //商品库存.
                }
            }
            Hi.Model.SYS_GType model3 = new Hi.BLL.SYS_GType().GetModel(model.CategoryID);
            if (model3 != null)
            {
                this.lblCategory.InnerText = model3.TypeName.Trim(); //分类
            }
            GetZiDingYi(model);                                      //自定义字段
            // this.divTitle.InnerText = model.GoodsName.Trim();//biaot
            // this.divTitle.InnerHtml = model.GoodsName.Trim() + SelectGoods.ProType(zhek);//商品名称

            string zhek = Cuxiao(goodsInfoId.ToString());
            if (!Util.IsEmpty(zhek))
            {
                this.divTitle.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek);//商品名称
            }
            else
            {
                this.divTitle.InnerHtml = model.GoodsName;
            }
            if (model.IsLS == 1)
            {
                this.isls.Visible         = true;
                this.lbllsprice.InnerText = "¥" + model.LSPrice.ToString("0.00");
            }
            else
            {
                this.isls.Visible = false;
            }
            this.divMemo.InnerHtml      = model.Title.Trim(); //描述
            this.lblHideInfo1.InnerText = model.HideInfo1;
            this.lblHideInfo2.InnerText = model.HideInfo2;    //描述
            this.lblUnit.InnerText      = model.Unit.Trim();  //计量单位
            // this.lblRecommend.InnerText = model.IsRecommended == 2 ? "推荐" : "否";//是否推荐
            if (model.IsRecommended == 2)
            {
                this.lblShow.InnerText      = "显示";
                this.lblRecommend.InnerText = "推荐";
            }
            else if (model.IsRecommended == 1)
            {
                this.lblShow.InnerText      = "显示";
                this.lblRecommend.InnerText = "不推荐";
            }
            else
            {
                this.lblShow.InnerText      = "不显示";
                this.lblRecommend.InnerText = "不推荐";
            }
            if (model.Details == "")
            {
                this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>";
            }
            else
            {
                this.DivShow.InnerHtml = model.Details;
            }
            if (!string.IsNullOrEmpty(model.Pic))//有图片
            {
                LoginModel logUser  = HttpContext.Current.Session["UserModel"] as LoginModel;
                string     basePath = Common.GetWebConfigKey("OssImgPath") + "company/" + ((logUser != null) ? logUser.CompID.ToString() : "") + "/";
                string     surfix   = "?x-oss-process=style/resize400";
                this.imgPic.Src  = basePath + model.Pic + surfix;
                this.imgPic2.Src = basePath + model.Pic + surfix;
                this.imgPic.Attributes.Add("jqimg", basePath + model.Pic);
                this.imgPic2.Attributes.Add("bimg", basePath + model.Pic);
            }
            else
            {
                this.imgPic.Src  = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif");
                this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif");
            }
        }
        else
        {
            JScript.AlertMethod(this, "商品不存在或者已经被删除", JScript.IconOption.错误, "function(){location.href='GoodsInfoList.aspx';}");
            return;
        }
        string html = string.Empty;
        List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and goodsId=" + id.ToString(), "");

        if (ll.Count > 0)
        {
            int xy = 0;
            foreach (Hi.Model.BD_GoodsAttrs item in ll)
            {
                List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and attrsId=" + item.ID, "");
                if (lll.Count > 0)
                {
                    html += "<div class=\"li\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\" style=\"display: inline;\">";
                    int count = 1;
                    foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll)
                    {
                        //Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                        //if (xy == 0)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        //else if (xy == 1)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        //else if (xy == 2)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        if (count == 1)
                        {
                            html += "<a href=\"javascript:;\" class=\"hover\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        else
                        {
                            html += "<a href=\"javascript:;\" class=\"\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        count++;
                    }
                    html += "</div></div>";
                }
                xy++;
            }
        }
        litAttrVaue.Text = html;
    }
Пример #22
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();
    }
Пример #23
0
    /// <summary>
    /// 验证商品大类下是否包含这个商品一级分类
    /// </summary>
    /// <returns></returns>
    public string CheckGoodsCate(string value, string str, int index, SqlTransaction Tran)
    {
        string catestr = string.Empty;

        string[] catelist = value.Split('/');//根据/分隔商品分类
        for (int i = 0; i < catelist.Length; i++)
        {
            if (i == 0)
            {//一级
                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=0   and TypeName='" + catelist[i] + "'", "", Tran);
                if (l.Count == 0)
                {
                    Eroor = true;
                    throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。没有【" + catelist[i] + "】这个一级分类!请修改后重新导入。<br/>");
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 1)//只有一级分类情况
                    {
                        List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + l[0].ID + " ", "", Tran);
                        if (ll.Count > 0)
                        {
                            Eroor = true;
                            throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。【" + catelist[i] + "】一级分类下还有二级分类,必须选择最小的分类!请修改后重新导入。<br/>");
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else if (i == 1)
            {//二级
                string goodsCateId = string.Empty;
                if (catestr.IndexOf("@") != -1)
                {
                    goodsCateId = catestr.Split('@')[1];
                    catestr     = catestr.Split('@')[0];
                }
                else
                {
                    List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=0   and TypeName='" + catestr + "' ", "", Tran);
                    if (ll.Count > 0)
                    {
                        goodsCateId = ll[0].ID.ToString();
                    }
                }
                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1  and TypeName='" + catelist[i] + "'  and parentid=" + goodsCateId, "", Tran);
                if (l.Count == 0)
                {
                    Eroor = true;
                    throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。【" + catestr + "】一级分类下没有【" + catelist[i] + "】这个二级分类!请修改后重新导入。<br/>");
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 2)//只有二级分类情况
                    {
                        List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + l[0].ID + "", "", Tran);
                        if (ll.Count > 0)
                        {
                            Eroor = true;
                            throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。【" + catelist[i] + "】二级分类下还有三级分类,必须选择最小的分类!请修改后重新导入。<br/>");
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else if (i == 2)
            { //三级
                string goodsCateId = string.Empty;
                if (catestr.IndexOf("@") != -1)
                {
                    goodsCateId = catestr.Split('@')[1];
                    catestr     = catestr.Split('@')[0];
                }
                else
                {
                    List <Hi.Model.SYS_GType> ll = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid!=0   and TypeName='" + catestr + "'", "", Tran);
                    if (ll.Count > 0)
                    {
                        goodsCateId = ll[0].ID.ToString();
                    }
                }

                List <Hi.Model.SYS_GType> l = new Hi.BLL.SYS_GType().GetList("ID", "isnull(dr,0)=0 and isenabled=1 and parentid=" + goodsCateId + " and TypeName='" + catelist[i] + "' ", "", Tran);
                if (l.Count == 0)
                {
                    Eroor = true;
                    throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。【" + catestr + "】二级分类下没有【" + catelist[i] + "】这个三级分类!请修改后重新导入。<br/>");
                }
                else
                {
                    catestr = catelist[i] + "@" + l[0].ID;
                    if (catelist.Length == 3)//只有二级分类情况
                    {
                        break;
                    }
                }
            }
        }
        return(catestr);
    }
Пример #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((HttpContext.Current.Session["UserModel"] as LoginModel) != null)
        {
            CompID = (HttpContext.Current.Session["UserModel"] as LoginModel).CompID;
        }

        object obj2 = Request["action"];

        if (obj2 != null)
        {
            if (obj2.ToString() == "yanz")//验证是否还存在下级分类
            {
                int id = 0;
                if (Request["id"] != null)
                {
                    id = Convert.ToInt32(Request["id"]);
                }
                Response.Write(GetMinCategory(id));
                Response.End();
            }
        }
        if (!IsPostBack)
        {
            object obj = Request.QueryString["type"];
            if (obj != null)
            {
                type = obj.ToString();
                if (!Util.IsEmpty(type))
                {
                    if (Request.QueryString["disId"] != null)
                    {
                        disID = Request.QueryString["disId"];
                    }
                    else
                    {
                        disID = "0";
                    }

                    if (type == "1")//商品分类
                    {
                        IsExepand = Common.RsertFolding(type, CompID);
                        string strwhere = string.Empty;
                        List <Hi.Model.SYS_GType> FindList = new List <Hi.Model.SYS_GType>();
                        List <Hi.Model.SYS_GType> l        = new Hi.BLL.SYS_GType().GetList("id,TypeName,ParentId", "isnull(dr,0)=0 and isenabled=1 ", " id");
                        if (string.IsNullOrWhiteSpace(Request["val"]))
                        {
                            FindList = l.Where(T => T.ParentId == 0).ToList();
                        }
                        else
                        {
                            string SearchValue = Request["val"].Replace("'", "''");
                            List <Hi.Model.SYS_GType> ParentList = new List <Hi.Model.SYS_GType>();
                            strwhere += " isnull(dr,0)=0 and isenabled=1 and TypeName like '%" + SearchValue + "%'";
                            FindList  = new Hi.BLL.SYS_GType().GetList("id,TypeName,ParentId", strwhere, " id");
                            foreach (Hi.Model.SYS_GType model in FindList)
                            {
                                //string NewName = model.CategoryName.Replace(SearchValue, "<i style='color:red'>" + SearchValue + "</i>");
                                string NewName     = model.TypeName;
                                var    ParentModel = l.Where(T => T.ID == model.ParentId).ToList();
                                if (ParentModel.Count > 0)
                                {
                                    NewName = ParentModel[0].TypeName + " > " + NewName;
                                }
                                model.TypeName = NewName;
                                ParentList.Add(model);
                            }
                            FindList = ParentList;
                        }
                        if (l.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(l, FindList, type);
                        }
                    }
                    else if (type == "2")//代理商区域
                    {
                        List <Hi.Model.BD_DisArea> FindList = new List <Hi.Model.BD_DisArea>();
                        List <Hi.Model.BD_DisArea> ll       = new Hi.BLL.BD_DisArea().GetList("id,AreaName,ParentId", "CompanyID=" + this.CompID + " and isnull(dr,0)=0 ", "");
                        FindList = ll.Where(T => T.ParentID == 0).ToList();
                        if (ll.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(ll, FindList, type);
                        }
                    }
                    else if (type == "3")//代理商分类
                    {
                        List <Hi.Model.BD_DisType> FindList = new List <Hi.Model.BD_DisType>();
                        List <Hi.Model.BD_DisType> lll      = new Hi.BLL.BD_DisType().GetList("id,ParentId,TypeName", "compid=" + this.CompID + " and isnull(dr,0)=0 ", "");
                        FindList = lll.Where(T => T.ParentId == 0).ToList();
                        if (lll.Count > 0 && FindList.Count > 0)
                        {
                            BindHTML(lll, FindList, type);
                        }
                    }
                    else if (type == "4")//代理商地址
                    {
                        List <Hi.Model.BD_DisAddr> llll = new Hi.BLL.BD_DisAddr().GetList("id,Address", "disid=" + disID + " and isnull(dr,0)=0", "");
                        if (llll.Count > 0)
                        {
                            BindHTML(llll, llll, type);
                        }
                    }
                    else if (type == "5")
                    {//代理商管理员
                        List <Hi.Model.BD_Distributor> lllll = new Hi.BLL.BD_Distributor().GetList("id,DisName", "compid=" + this.CompID + " and isnull(dr,0)=0", "Id desc");
                        if (lllll.Count > 0)
                        {
                            BindHTML(lllll, lllll, type);
                        }
                    }
                    else if (type == "6")
                    {//代理商管理员
                        List <Hi.Model.BD_Distributor> lllll = new Hi.BLL.BD_Distributor().GetList("id,DisName", "compid=" + this.CompID + " and isnull(dr,0)=0 and AuditState=2 and IsEnabled=1", "Id asc");
                        if (lllll.Count > 0)
                        {
                            BindHTML(lllll, lllll, type);
                        }
                    }
                }
            }
        }
    }
Пример #25
0
    public string GoodsType = string.Empty;//代理商分类数据源
    public void bind()
    {
        int IndID = new Hi.BLL.BD_Company().GetModel(this.CompID).IndID;
        //绑定分类
        StringBuilder             sbdis    = new StringBuilder();
        List <Hi.Model.SYS_GType> godtype1 = new Hi.BLL.SYS_GType().GetList("TypeCode,ID,TypeName", "isnull(dr,0)=0 and  ParentId=0 ", "");

        if (godtype1.Count > 0)
        {
            sbdis.Append("[");
            int count = 0;
            foreach (var item in godtype1)
            {
                count++;
                sbdis.Append("{code:'" + item.ID + "',value: '" + item.ID + "',label: '" + item.TypeName + "'");
                List <Hi.Model.SYS_GType> godtype2 = new Hi.BLL.SYS_GType().GetList("TypeCode,ID,TypeName", "isnull(dr,0)=0  and ParentId=" + item.ID, "");
                if (godtype2.Count > 0)
                {
                    sbdis.Append(",children: [");
                    int count2 = 0;
                    foreach (var item2 in godtype2)
                    {
                        count2++;
                        sbdis.Append("{code:'" + item2.ID + "',value: '" + item2.ID + "',label: '" + item2.TypeName + "'");
                        List <Hi.Model.SYS_GType> godtype3 = new Hi.BLL.SYS_GType().GetList("TypeCode,ID,TypeName", "isnull(dr,0)=0  and ParentId=" + item2.ID, "");
                        if (godtype3.Count > 0)
                        {
                            sbdis.Append(",children: [");
                            int count3 = 0;
                            foreach (var item3 in godtype3)
                            {
                                count3++;
                                if (count3 == godtype3.Count)
                                {
                                    sbdis.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.TypeName + "'}");
                                }
                                else
                                {
                                    sbdis.Append("{code:'" + item3.ID + "',value: '" + item3.ID + "',label: '" + item3.TypeName + "'},");
                                }
                            }
                            sbdis.Append("]");
                        }

                        if (count2 == godtype2.Count)
                        {
                            sbdis.Append("}");
                        }
                        else
                        {
                            sbdis.Append("},");
                        }
                    }
                    sbdis.Append("]");
                }
                if (count == godtype1.Count)
                {
                    sbdis.Append("}");
                }
                else
                {
                    sbdis.Append("},");
                }
            }
            sbdis.Append("]");
            GoodsType = sbdis.ToString();
        }
    }
Пример #26
0
    /// <summary>
    /// 新增子类
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string Typename  = Common.NoHTML(txtTypeName.Value.Trim());
        string Parentid  = Common.NoHTML(hideTypeId.Value.Trim());
        string Typecode  = string.Empty;
        string ParentIds = "0";//父元素ID   用于判断是否存在重复子元素

        Hi.Model.BD_GoodsCategory DisType = new Hi.Model.BD_GoodsCategory();

        if (Parentid != "0" && Parentid != "")
        {
            Hi.Model.BD_GoodsCategory one = new Hi.BLL.BD_GoodsCategory().GetModel(Convert.ToInt32(Parentid));
            if (one != null)
            {
                Typecode        = one.GoodsTypeID.ToString(); //商品大类
                DisType.Code    = one.Code + "-" + NewCategoryCode((one.Deep + 1).ToString());
                DisType.Deep    = one.Deep + 1;
                DisType.ParCode = one.Code;
                ParentIds       = one.ID.ToString();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                        "<script>layerCommon.msg('添加失败!', IconOption.哭脸, 2000);</script>");
                return;
            }

            if (DisType.Deep == 4)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                        "<script>layerCommon.msg('最多只能三级!', IconOption.哭脸, 2000);</script>");
                return;
            }
        }
        else//一级大类
        {
            Typecode        = hid_txtGtype.Value;;//商品大类
            DisType.Code    = NewCategoryCode("1");
            DisType.Deep    = 1;
            DisType.ParCode = "";
            ParentIds       = "0";
        }

        int Result = 0;

        if (string.IsNullOrEmpty(Typecode) || Typecode == "0")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('商品大类不能为空!', IconOption.哭脸, 2000);</script>");
            return;
        }
        else if (Parentid == "0")
        {
            Hi.Model.SYS_GType gtype = new Hi.BLL.SYS_GType().GetModel(Convert.ToInt32(Typecode));
            if (gtype.Deep != 3)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('请选择三级商品大类!', IconOption.哭脸, 2000);</script>");
                return;
            }
        }
        if (string.IsNullOrEmpty(Typename))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('分类名称不能为空!', IconOption.哭脸, 2000);</script>");
            return;
        }
        if (IsExistsType("CategoryName", Typename, ParentIds))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('分类名称已存在!', IconOption.哭脸, 2000);</script>");
            return;
        }
        if (string.IsNullOrEmpty(Parentid) || !int.TryParse(Parentid, out Result))
        {
            DisType.ParentId = 0;
        }
        else
        {
            DisType.ParentId = Result;
        }
        DisType.CompID       = CompID;
        DisType.CategoryName = Typename;
        DisType.GoodsTypeID  = Convert.ToInt32(Typecode);
        DisType.SortIndex    = NewCateId().ToString();
        DisType.CreateDate   = DateTime.Now;
        DisType.CreateUserID = 0;
        DisType.IsEnabled    = 1;
        DisType.ts           = DateTime.Now;
        DisType.modifyuser   = 0;

        SqlTransaction trans = SqlHelper.CreateStoreTranSaction();

        try
        {
            int countID = 0;
            if ((countID = new Hi.BLL.BD_GoodsCategory().Add(DisType, trans)) > 0)
            {
                List <Hi.Model.BD_Goods> gList = new Hi.BLL.BD_Goods().GetList("", " CategoryID='" + Parentid + "'", "");
                if (gList != null && gList.Count > 0)
                {
                    foreach (var bdGoodse in gList)
                    {
                        bdGoodse.CategoryID = countID;
                        new Hi.BLL.BD_Goods().Update(bdGoodse, trans);
                    }
                }
                trans.Commit();

                Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                        "<script>layerCommon.msg('新增成功!', IconOption.笑脸, 2000);location.href='GoodsCategory.aspx?type=" + Request["type"].ToString() + "';</script>");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Result",
                                                        "<script>layerCommon.msg('添加失败!', IconOption.哭脸, 2000);</script>");
            }
        }
        catch (Exception ex)
        {
            if (trans != null)
            {
                if (trans.Connection != null)
                {
                    trans.Rollback();
                }
            }
            ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>layerCommon.msg('" + ex.Message + "', IconOption.哭脸, 2000);</script>");
            return;
        }
        finally
        {
            SqlHelper.ConnectionClose();
            if (trans != null)
            {
                if (trans.Connection != null)
                {
                    trans.Connection.Close();
                }
            }
        }
    }