Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LO lO = db.LOs.Find(id);

            db.LOs.Remove(lO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "LOID,LearningOutcome,LODesc,DepartmentID")] LO lO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", lO.DepartmentID);
     return(View(lO));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "LOID,LearningOutcome,LODesc,DepartmentID")] LO lO)
        {
            if (ModelState.IsValid)
            {
                db.LOs.Add(lO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", lO.DepartmentID);
            return(View(lO));
        }
Exemplo n.º 4
0
        // GET: LOes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LO lO = db.LOs.Find(id);

            if (lO == null)
            {
                return(HttpNotFound());
            }
            return(View(lO));
        }
Exemplo n.º 5
0
        // GET: LOes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LO lO = db.LOs.Find(id);

            if (lO == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", lO.DepartmentID);
            return(View(lO));
        }
Exemplo n.º 6
0
        public static LayoutOptions LOtoLayoutOptions(LO layoutOptions)
        {
            switch (layoutOptions)
            {
            case LO.S: return(LayoutOptions.Start);

            case LO.C: return(LayoutOptions.Center);

            case LO.E: return(LayoutOptions.End);

            case LO.F: return(LayoutOptions.Fill);

            case LO.SE: return(LayoutOptions.StartAndExpand);

            case LO.CE: return(LayoutOptions.CenterAndExpand);

            case LO.EE: return(LayoutOptions.EndAndExpand);

            case LO.FE: return(LayoutOptions.FillAndExpand);

            default: return(LayoutOptions.Start);
            }
        }
Exemplo n.º 7
0
 private static object GetFromDeserilize(object s)
 {
     if (s == null)
     {
         return(null);
     }
     else if (s is Newtonsoft.Json.Linq.JObject)
     {
         DSO res   = new DSO();
         var j_obj = s as Newtonsoft.Json.Linq.JObject;
         foreach (var jtoken in j_obj.Children())
         {
             res.Add(((Newtonsoft.Json.Linq.JProperty)jtoken).Name
                     , GetFromDeserilize(((Newtonsoft.Json.Linq.JProperty)jtoken).Value));
         }
         return(res);
     }
     else if (s is Newtonsoft.Json.Linq.JArray)
     {
         var j_obj = s as Newtonsoft.Json.Linq.JArray;
         LO  obj   = new LO();
         foreach (var jtoken in j_obj.Children())
         {
             obj.Add(GetFromDeserilize(jtoken));
         }
         return(obj);
     }
     else if (s is Newtonsoft.Json.Linq.JValue)
     {
         var j_obj = s as Newtonsoft.Json.Linq.JValue;
         return(j_obj.Value);
     }
     else
     {
         throw new Exception("unknown json type");
     }
 }
Exemplo n.º 8
0
 public override void copyWrapProperty(WrapProperty otherWrapProperty)
 {
     if (otherWrapProperty is LO <T> )
     {
         LO <T> otherLP = (LO <T>)otherWrapProperty;
         // find listChange
         List <Change <T> > changes = new List <Change <T> >();
         {
             // make the same count
             {
                 // remove excess value
                 if (this.getValueCount() > otherLP.getValueCount())
                 {
                     ChangeRemove <T> changeRemove = new ChangeRemove <T>();
                     {
                         changeRemove.index  = otherLP.getValueCount();
                         changeRemove.number = this.getValueCount() - otherLP.getValueCount();
                     }
                     changes.Add(changeRemove);
                 }
                 // need insert
                 else if (this.getValueCount() < otherLP.getValueCount())
                 {
                     ChangeAdd <T> changeAdd = new ChangeAdd <T>();
                     {
                         changeAdd.index = this.getValueCount();
                         for (int i = this.getValueCount(); i < otherLP.getValueCount(); i++)
                         {
                             changeAdd.values.Add(otherLP.vs[i]);
                         }
                     }
                     changes.Add(changeAdd);
                 }
             }
             // Copy each value
             {
                 // oldChangeSet
                 ChangeSet <T> oldChangeSet = null;
                 // minCount
                 int minCount = Math.Min(this.getValueCount(), otherLP.getValueCount());
                 for (int i = 0; i < minCount; i++)
                 {
                     T oldValue = this.vs[i];
                     T newValue = otherLP.vs[i];
                     // get new add data
                     T    needAddData = default(T);
                     bool needAdd     = false;
                     {
                         if (!object.Equals(newValue, oldValue))
                         {
                             needAdd     = true;
                             needAddData = newValue;
                         }
                     }
                     // Make changeSet
                     if (needAdd)
                     {
                         // get changeSet
                         ChangeSet <T> changeSet = null;
                         {
                             // setIdex: set position in list
                             int setIndex = i;
                             // check old
                             if (oldChangeSet != null)
                             {
                                 if (oldChangeSet.index + oldChangeSet.values.Count == setIndex)
                                 {
                                     changeSet = oldChangeSet;
                                 }
                             }
                             // make new
                             if (changeSet == null)
                             {
                                 changeSet = new ChangeSet <T>();
                                 {
                                     changeSet.index = setIndex;
                                 }
                                 changes.Add(changeSet);
                                 // set new old
                                 oldChangeSet = changeSet;
                             }
                         }
                         // add value
                         changeSet.values.Add(needAddData);
                     }
                 }
             }
         }
         // Change
         if (changes.Count > 0)
         {
             this.processChange(changes);
         }
     }
     else
     {
         Logger.LogError("why not the same type wrapProperty: " + this + "; " + otherWrapProperty);
     }
 }
    public static void Main()
    {
        var lo = new LO();

        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult();

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult();

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult();

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, B
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult();

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            NULL
        });
        lo.Add(new OB {
            A
        });
        lo.DisplayResult();

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, B
        });
        lo.Add(new OB {
            A
        });
        lo.DisplayResult("Why is this not a transition but an exception?");


        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, NULL
        });
        lo.Add(new OB {
            A, NULL, NULL
        });
        lo.Add(new OB {
            A
        });
        lo.DisplayResult("<A,NULL> and <A,NULL,NULL> are considered equal as per your second comment.");

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, B, NULL, C
        });
        lo.Add(new OB {
            A
        });
        lo.DisplayResult("As per your first comment");

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, B
        });
        lo.Add(new OB {
            B, A
        });
        lo.Add(new OB {
            A
        });
        lo.DisplayResult("Second and third OB are equal as per your first comment");

        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            NULL, A
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult();
        lo.Clear();
        lo.Add(new OB {
            A
        });
        lo.Add(new OB {
            A, B, C
        });
        lo.Add(new OB {
            B
        });
        lo.DisplayResult("Why is this not a transition as per your fourth comment?");
    }
Exemplo n.º 10
0
 public Stage2(Stage1Result MeaningPartStage1Result, LO.MainParts.Algorithms.Stage4Result MainPartsStage4Result)
     : base(GetAlgorithmName(), GetAlgorithmLO(), GetSourceInfoType(), GetStage())
 {
     _result = new Stage2Result();
     _meaningPartStage1Result = MeaningPartStage1Result;
     _mainPartsStage4Result = MainPartsStage4Result;
 }
Exemplo n.º 11
0
    public VR GetVR(string key)
    {
        //如果对象存在,则直接从享元池获取
        if (VRs.ContainsKey(key))
        {
            return((VR)VRs[key]);
        }
        //如果对象不存在,先创建一个新的对象添加到享元池中,然后返回
        else
        {
            VR fw = null;
            switch (key)
            {
            case "SS": fw = new SS(isBE, false); break;

            case "US": fw = new US(isBE); break;

            case "SL": fw = new SL(isBE, false); break;

            case "UL": fw = new UL(isBE, false); break;

            case "FL": fw = new FL(isBE, false); break;

            case "FD": fw = new FD(isBE, false); break;

            case "DA": fw = new DA(isBE, false); break;

            case "TM": fw = new TM(isBE, false); break;

            case "DT": fw = new DT(isBE, false); break;

            case "AS": fw = new AS(isBE, false); break;

            case "OB": fw = new OB(isBE); break;

            case "OF": fw = new OF(isBE, true); break;

            case "OW": fw = new OW(isBE); break;

            case "SQ": fw = new SQ(isBE, true); break;

            case "LO": fw = new LO(isBE, true); break;

            case "UI": fw = new UI(isBE, true); break;

            case "SH": fw = new SH(isBE, true); break;

            case "AE": fw = new AE(isBE, true); break;

            case "CS": fw = new CS(isBE, true); break;

            case "PN": fw = new PN(isBE, true); break;

            case "DS": fw = new DS(isBE); break;

            case "IS": fw = new IS(isBE, true); break;
                //default for text
                //default: fw = new ST(isBE, false); break;
            }
            VRs.Add(key, fw);
            return(fw);
        }
    }
Exemplo n.º 12
0
    public static void refresh <T>(LO <T> listProperty, IList <T> syncList)
    {
        if (listProperty == null || syncList == null)
        {
            Debug.LogError("IdentityUtils null error");
            return;
        }
        // find listChange
        List <Change <T> > changes = new List <Change <T> >();

        {
            // make the same count
            {
                // remove excess value
                if (listProperty.getValueCount() > syncList.Count)
                {
                    ChangeRemove <T> changeRemove = new ChangeRemove <T>();
                    {
                        changeRemove.index  = syncList.Count;
                        changeRemove.number = listProperty.getValueCount() - syncList.Count;
                    }
                    changes.Add(changeRemove);
                }
                // need insert
                else if (listProperty.getValueCount() < syncList.Count)
                {
                    ChangeAdd <T> changeAdd = new ChangeAdd <T>();
                    {
                        changeAdd.index = listProperty.getValueCount();
                        for (int i = listProperty.getValueCount(); i < syncList.Count; i++)
                        {
                            changeAdd.values.Add(syncList[i]);
                        }
                    }
                    changes.Add(changeAdd);
                }
            }
            // Copy each value
            {
                // oldChangeSet
                ChangeSet <T> oldChangeSet = null;
                // minCount
                int minCount = System.Math.Min(listProperty.getValueCount(), syncList.Count);
                // get changes
                for (int i = 0; i < minCount; i++)
                {
                    T oldValue = (T)listProperty.getValue(i);
                    T newValue = syncList[i];
                    if (!object.Equals(newValue, oldValue))
                    {
                        // get changeSet
                        ChangeSet <T> changeSet = null;
                        {
                            // setIdex: set position in list
                            int setIndex = i;
                            // check old
                            if (oldChangeSet != null)
                            {
                                if (oldChangeSet.index + oldChangeSet.values.Count == setIndex)
                                {
                                    changeSet = oldChangeSet;
                                }
                            }
                            // make new
                            if (changeSet == null)
                            {
                                changeSet = new ChangeSet <T>();
                                {
                                    changeSet.index = setIndex;
                                }
                                changes.Add(changeSet);
                                // set new old
                                oldChangeSet = changeSet;
                            }
                        }
                        // add value
                        changeSet.values.Add(newValue);
                    }
                }
            }
        }
        // Change
        if (changes.Count > 0)
        {
            listProperty.processChange(changes);
        }
    }