Example #1
0
 private bool allotProducts(List<int> proIDs, List<int> classIds)
 {
     if (proIDs.Count < 1)
     {
         return true;
     }
     Model.products.TypeProducts model = new Model.products.TypeProducts();
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     for (int intLoop = 0; intLoop < proIDs.Count; intLoop++)
     {
         if (orm.Delete("delete TypeProducts where piID=" + proIDs[intLoop]))
         {
             for (int intLoops = 0; intLoops < classIds.Count; intLoops++)
             {
                 model = new Model.products.TypeProducts();
                 model.piID = proIDs[intLoop];
                 model.ptID = classIds[intLoops];
                 orm.Add(model);
             }
         }
         else
         {
             return false;
         }
     }
     return true;
 }
 private Boolean addClassify(Model.products.productsClassify model)
 {
     Boolean isSave = false;
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     model = (Model.products.productsClassify)orm.Add(model);
     if (model != null)
     {
         isSave = true;
     }
     return isSave;
 }
 private bool addData(Model.products.productsInfo model, string fileName)
 {
     model.piMainPhoto ="/ProductsImage/"+ fileName;
     model.createDate = DateTime.Now;
     skywolfORM.ORM.ORM orm = new skywolfORM.ORM.ORM();
     model =(Model.products.productsInfo) orm.Add(model);
     if (model != null)
     {
         return true;
     }
     return false;
 }
 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;
 }