Esempio n. 1
0
 public IQueryable<Item> ItemGetByClass(IQueryable<Item> items, ClassM classm)
 {
     return from cly in yikuData.T_Classify
             where items.Contains(cly.Item) && cly.CID == classm.CID
             orderby cly.IID
             select cly.Item;
 }
Esempio n. 2
0
 public ClassM ClassCreate(string className, int classFatherID)
 {
     ClassM classm = new ClassM();
     classm.Name = className;
     classm.FatherID = classFatherID;
     yikuData.ClassMs.AddObject(classm);
     return classm;
 }
Esempio n. 3
0
 public ClassM ClassCreateAsRoot(string className)
 {
     ClassM classm = new ClassM();
     classm.Name = className;
     classm.FatherID = null;
     yikuData.ClassMs.AddObject(classm);
     return classm;
 }
        public T_Classify AddClassify(Item item, ClassM classm)
        {
            T_Classify tcl = GetT_Classify(item, classm);
            if (tcl == null) tcl = new T_Classify();
            else return tcl;

            tcl.CID = classm.CID;
            tcl.IID = item.IID;
            Add(tcl);
            return tcl;
        }
Esempio n. 5
0
        public ActionResult Classes(FormCollection value)
        {
            ViewData["ErrorMessage"] = "";
            if(!string.IsNullOrEmpty(Request.Form["cName"]) ){
                ClassM classm = new ClassM();
                classm.Name = Request.Form["cName"];
                if(!string.IsNullOrEmpty(Request.Form["cFatherID"]) ){
                    try { classm.FatherID = Convert.ToInt32(Request.Form["cFatherID"]); }
                    catch { }
                }

                yikuData.Add(classm);
                yikuData.Save();
            }

            int eID = -1;
            try{ eID = Convert.ToInt32(Request.Form["eID"]);}
            catch{; }

            if(eID > 0){
                ClassM classm = yikuData.GetClass(eID);
                if (classm != null)
                {
                    if (!string.IsNullOrEmpty(Request.Form["eName"]))
                        classm.Name = Request.Form["eName"];
                    if (!string.IsNullOrEmpty(Request.Form["eFatherID"]))
                    {
                        try { classm.FatherID = Convert.ToInt32(Request.Form["eFatherID"]); }
                        catch { }
                    }
                    yikuData.Save();
                }
            }

            return View(yikuData.GetClasses());
        }
Esempio n. 6
0
 /// <summary>
 /// 用于向 ClassMs EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToClassMs(ClassM classM)
 {
     base.AddObject("ClassMs", classM);
 }
Esempio n. 7
0
 public IQueryable<Item> ItemGetByClass(ClassM classm)
 {
     return ItemGetByClass(yikuData.Items, classm);
 }
Esempio n. 8
0
 public IQueryable<Item> GetItems(ClassM classm)
 {
     return from tcl in yikuData.T_Classify
            where tcl.CID == classm.CID
            select tcl.Item;
 }
 public IQueryable<T_Classify> GetT_Classifys(ClassM classm)
 {
     return from tcl in yikuData.T_Classify
            where tcl.CID == classm.CID
            select tcl;
 }
 public T_Classify GetT_Classify(Item item, ClassM classm)
 {
     return yikuData.T_Classify.SingleOrDefault(tcl => tcl.IID == item.IID && tcl.CID == classm.CID);
 }
 public void DeleteClassify(Item item, ClassM classm)
 {
     T_Classify tcl = GetT_Classify(item, classm);
     if (tcl != null)
         Delete(tcl);
 }
Esempio n. 12
0
 /// <summary>
 /// 创建新的 ClassM 对象。
 /// </summary>
 /// <param name="cID">CID 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 public static ClassM CreateClassM(global::System.Int32 cID, global::System.String name)
 {
     ClassM classM = new ClassM();
     classM.CID = cID;
     classM.Name = name;
     return classM;
 }
Esempio n. 13
0
 public IQueryable<ClassM> sonClasses(ClassM classm)
 {
     return yikuData.ClassGetSons(classm);
 }
Esempio n. 14
0
 public bool ClassRoot(ClassM classm)
 {
     if (classm.FatherID == null || classm.FatherID == 1) return true;
     return false;
 }
Esempio n. 15
0
 public IQueryable<ClassM> ClassGetSons(ClassM classm)
 {
     return from c in yikuData.ClassMs
            where c.FatherID == classm.CID
            select c;
 }
Esempio n. 16
0
 public ClassM ClassGetFather(ClassM classm)
 {
     return yikuData.ClassMs.SingleOrDefault(cl => cl.CID == classm.FatherID);
 }
Esempio n. 17
0
 public bool ClassExist(ClassM classm)
 {
     ClassM c = yikuData.ClassMs.SingleOrDefault(cl => cl == classm);
     if (c != null) return true;
     return false;
 }