Пример #1
0
        private bool editData(Model.products.productsInfo model, string fileName)
        {
            Model.products.productsInfo pi = new Model.products.productsInfo();
            skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
            pi = (Model.products.productsInfo)orm.Load(pi, model.piID);
            if (fileName.Trim() != "")
            {
                model.piMainPhoto = fileName;
            }
            model.createDate = pi.createDate;
            model.piSaleCount = pi.piSaleCount;

            return orm.Update(model);
        }
Пример #2
0
 private Boolean addType(Model.products.productsType model)
 {
     Boolean isSave = false;
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     model=(Model.products.productsType) orm.Add(model);
     if (model!=null)
     {
         isSave=true;
         if (model.ptParentID > 0)
         {
             Model.products.productsType pt = new Model.products.productsType();
             pt = (Model.products.productsType)orm.Load(pt, model.ptParentID);
             if (pt.isLeaf ==2)
             {
                 pt.isLeaf = 1;
                 isSave = orm.Update(pt);
             }
         }
     }
     return isSave;
 }
Пример #3
0
 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\":\"删除类型失败!\"}";
 }
Пример #4
0
 private bool updateType(Model.products.productsType model)
 {
     bool isSave = false;
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     if (model != null)
     {
         Model.products.productsType pt = new Model.products.productsType();
         pt = (Model.products.productsType)orm.Load(pt, model.ptID);
         if (pt != null)
         {
             pt.ptName = model.ptName;
             isSave = orm.Update(model);
         }
     }
     return isSave;
 }
 private bool updateClassify(Model.products.productsClassify model)
 {
     bool isSave = false;
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     if (model != null)
     {
         Model.products.productsClassify pt = new Model.products.productsClassify();
         pt = (Model.products.productsClassify)orm.Load(pt, model.pcID);
         if (pt != null)
         {
             pt.pcName = model.pcName;
             isSave = orm.Update(model);
         }
     }
     return isSave;
 }