private bool checkHasLeaf(int id)
 {
     List<Model.products.productsClassify> lists = new List<Model.products.productsClassify>();
     Model.products.productsClassify model = new Model.products.productsClassify();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     lists = orm.List(model, "pcParentID=" + id).OfType<Model.products.productsClassify>().ToList();
     if (lists.Count > 0)
         return false;
     else
         return true;
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
     Model.products.productsInfo model = new Model.products.productsInfo();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     lists = orm.List(model, "").OfType<Model.products.productsInfo>().ToList();
     if (lists.Count > 0)
     {
         model = lists[0];
     }
     ltDetail.Text = model.piDetail;
 }
Example #3
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int pcID = Commons.WebPage.PageRequest.GetQueryInt("pcID");
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     List<Model.products.productsClassify> lists = new List<Model.products.productsClassify>();
     Model.products.productsClassify model = new Model.products.productsClassify();
     lists = orm.List(model, "pcParentID=" + pcID).OfType<Model.products.productsClassify>().ToList();
     string str = "[]";
     str = Newtonsoft.Json.JsonConvert.SerializeObject(lists);
     context.Response.Write(str);
 }
Example #4
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int pcID = Commons.WebPage.PageRequest.GetQueryInt("pcID");
     List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
     Model.products.productsInfo model = new Model.products.productsInfo();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     string strWhere = "";
     if (pcID > 0)
     {
         strWhere = "piID in(select piID from TypeProducts where ptID=" + pcID + ")";
     }
     lists = orm.List(model, strWhere).OfType<Model.products.productsInfo>().ToList();
     string str = "[]";
     str = Newtonsoft.Json.JsonConvert.SerializeObject(lists);
     context.Response.Write(str);
 }
        private List<Model.products.productsClassify> loadData(int parentID)
        {
            Model.products.productsClassify pt = new Model.products.productsClassify();
            skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
            List<Model.products.productsClassify> lists = orm.List(pt, "pcParentID=" + parentID).OfType<Model.products.productsClassify>().ToList();
            if (lists.Count > 0)
            {
                List<Model.products.productsClassify> ptChild = null;
                foreach (Model.products.productsClassify model in lists)
                {
                    ptChild = loadData(model.pcID);
                    if (ptChild.Count > 0)
                    {
                        model.children = ptChild;
                    }

                }
            }

            return lists;
        }
        private List<Model.products.productsType> loadData(int parentID)
        {
            Model.products.productsType pt=new Model.products.productsType();
            skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
            List<Model.products.productsType> lists = orm.List(pt, "ptParentID="+parentID).OfType<Model.products.productsType>().ToList();
            if (lists.Count > 0)
            {
                List<Model.products.productsType> ptChild = null;
                foreach (Model.products.productsType model in lists)
                {
                    if (model.isLeaf == 1)
                    {
                        ptChild = loadData(model.ptID);
                        if (ptChild.Count > 0)
                        {
                            model.children = ptChild;
                        }
                    }
                }
            }

            return lists;
        }
 private string delType(int id)
 {
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     Model.products.productsType model = new Model.products.productsType();
     model = (Model.products.productsType)orm.Load(model, id);
     if (model == null)
     {
         return "{\"success\":false,\"msg\":\"该类型不存在或已被删除!\"}";
     }
     if (model.isLeaf == 1)
     {
         return "{\"success\":false,\"msg\":\"该类型存在子类型,请先删除子类型!\"}";
     }
     int parentID = model.ptParentID;
     if (orm.Delete(model))
     {
         if (parentID > 0)
         {
             List<Model.products.productsType> lists = orm.List(model, "ptParentID=" + parentID).OfType<Model.products.productsType>().ToList();
             if (lists.Count < 1)
             {
                 model = (Model.products.productsType)orm.Load(model, parentID);
                 if (model != null)
                 {
                     model.isLeaf = 2;
                     if (orm.Update(model))
                     {
                         return "{\"success\":true,\"msg\":\"删除类型成功!\"}";
                     }
                 }
             }
         }
         return "{\"success\":true,\"msg\":\"删除类型成功!\"}";
     }
     return "{\"success\":false,\"msg\":\"删除类型失败!\"}";
 }
Example #8
0
        private void loadData()
        {
            List<Model.products.productsInfo> lists = new List<Model.products.productsInfo>();
            skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
            Model.products.productsInfo model = new Model.products.productsInfo();
            lists = orm.List(model, "").OfType<Model.products.productsInfo>().ToList();
            string strPic = "";
            string strText = "";
            string strLink = "";
            if (lists.Count > 0)
            {
                for (int intLoop = 0; intLoop < lists.Count; intLoop++)
                {
                    if (intLoop == 0)
                    {
                        strPic += "<li name=\"pic"+intLoop+"\" class=\"show\"> <a href=\"javascript:void(0)\"> ";
                        strLink+="<li name=\"sign"+intLoop+"\" class=\"current\"><a href=\"javascript:void(0);\">"+(intLoop+1)+"</a></li>";
                    }
                    else
                    {
                        strPic += "<li name=\"pic0\"> <a href=\"javascript:void(0)\"> ";
                        strLink += "<li name=\"sign" + intLoop + "\"><a href=\"javascript:void(0);\">" + (intLoop + 1) + "</a></li>";
                    }
                    strPic += "<img src=\"ProductsImage/" + lists[intLoop].piMainPhoto + "\" alt=\"" + lists[intLoop].piName + "\" title=\"" + lists[intLoop].piName + "\" width=\"\" height=\"\"> ";
                    strPic += "</a> </li>";

                    strText+="<div class=\"sliderTextAll\" name=\"txt"+intLoop+"\"><div class=\"sliderText\">";
                    strText += "<p><span>" + lists[intLoop].piName + "</span>品质:" + lists[intLoop].pqValue + "&nbsp;&nbsp;&nbsp;&nbsp;售价:"+lists[intLoop].piPrice+"</p>";
                    strText += "</div><div class=\"sliderTxtBot\"></div></div>";

                }
            }
            ltPic.Text = strPic;
            ltText.Text = strText;
            ltLink.Text = strLink;
        }