public ActionResult Templar() { // Get data for existing Workouts using (ISession _S = MvcApplication.SF.GetCurrentSession()) { // CTRL + Select Templar Templar tmp = null; var tmpList = _S.QueryOver(() => tmp) .OrderBy(x => x.Segmentid).Asc .List <Templar>(); // Summon the Conclave Conclave clv = null; var typeList = _S.QueryOver(() => clv) .SelectList(l => l .Select(x => x.Typepk).WithAlias(() => clv.Typepk) .Select(x => x.Name).WithAlias(() => clv.Name) ) .TransformUsing(Transformers.AliasToBean <Conclave>()) .List <Conclave>(); // Morph Archons var archList = new List <Archon>(); foreach (var r in typeList) { archList.Add(new Archon { Key = r.Typepk, Display = r.Name.ToString() }); } foreach (var s in tmpList) { s.DDLTypes = new SelectList(archList, "Key", "Display", s.Conclave.Typepk); } return(View(tmpList)); } }
public ActionResult Conclave() { // Get data for existing Types and pass to View using (ISession _S = MvcApplication.SF.GetCurrentSession()) { Conclave clv = null; var conclaveList = _S.QueryOver(() => clv) .SelectList(l => l .Select(x => x.Typepk).WithAlias(() => clv.Typepk) .Select(x => x.Typeid).WithAlias(() => clv.Typeid) .Select(x => x.Name).WithAlias(() => clv.Name) .Select(x => x.Customflg).WithAlias(() => clv.Customflg) ) .TransformUsing(Transformers.AliasToBean <Conclave>()) .List <Conclave>(); return(View(conclaveList)); } }
public ActionResult Prophecy() { using (ISession _S = MvcApplication.SF.GetCurrentSession()) { // [1] Build Probes Prophecy phy = null; Conclave clv = null; List <Archon> archList = new List <Archon>(); // [2] Gather Minerals IList <Prophecy> phyList = _S.QueryOver(() => phy) .OrderBy(x => x.Tipid).Asc .List <Prophecy>(); IList <Conclave> typeList = _S.QueryOver(() => clv) .OrderBy(x => x.Name).Asc .List <Conclave>(); // [3] Build 4 Gateways foreach (Conclave r in typeList) { archList.Add(new Archon { Key = r.Typepk, Display = r.Name.ToString() }); } // [4] Send Units across the map foreach (Prophecy s in phyList) { s.DDLTypes = new SelectList(archList, "Key", "Display", s.Conclave.Typepk); } // [5] Destroy enemy return(View(phyList)); } }
public ActionResult WarpIn2Form(List <Warpgate> w) { if (ModelState.IsValid) { using (ISession _S = MvcApplication.SF.GetCurrentSession()) { // [0] Get Workout Name string wkNm = _S.QueryOver <Gateway>() .Where(x => x.Workoutpk == w[1].Gateway.Workoutpk) .Select(x => x.Name) .SingleOrDefault <string>(); // [1] Summon Danimoth Danimoth d = new Danimoth { DWorkoutName = wkNm, Dts = new List <Raszagal>() }; // [2] Acquire Energy foreach (Warpgate wg in w) { // [2.0] Get data for existing Wksegs Warpgate wks = null; IList <Warpgate> wksList = _S.QueryOver(() => wks) .Where(x => x.Gateway.Workoutpk == wg.Gateway.Workoutpk) .OrderBy(x => x.Sequence).Asc .List <Warpgate>(); // [2.1] DT Rush foreach (Warpgate z in wksList) { // [2.1.0] Get segment data Templar rSeg = _S.QueryOver <Templar>() .Where(x => x.Segmentpk == z.Templar.Segmentpk) .SingleOrDefault <Templar>(); // [2.1.1] Get TypePK Conclave rTyp = _S.QueryOver <Conclave>() .Where(x => x.Typepk == rSeg.Conclave.Typepk) .SingleOrDefault <Conclave>(); // [2.1.2] Get a random tip for that type ICriteria criteria = _S .CreateCriteria(typeof(Prophecy)) .Add(Restrictions.Eq("Conclave.Typepk", rTyp.Typepk)) .AddOrder(new RandomOrder()) .SetMaxResults(1); Prophecy clv2 = criteria.UniqueResult <Prophecy>(); // [2.1.3] Warp in DTs Raszagal rz = new Raszagal { RSegmentName = rSeg.Name, RSegmentIntensity = rSeg.Intensity, RTip = clv2, RWkseg = new Warpgate { Duration = z.Duration * 1000, Sequence = z.Sequence } }; // [2.1.4] Warp DTs to Danimoth d.Dts.Add(rz); } } return(View("Aiur", d)); } } else { return(View("Index")); } }
public ActionResult ConclaveForm(List <Conclave> newList) { if (ModelState.IsValid) { // Process submission data and return to Home using (ISession _S = MvcApplication.SF.GetCurrentSession()) { // Get existing Types Conclave clv = null; var oldList = _S.QueryOver(() => clv) .SelectList(l => l .Select(x => x.Typepk).WithAlias(() => clv.Typepk) ) .TransformUsing(Transformers.AliasToBean <Conclave>()) .List <Conclave>(); // Compare new and old Lists foreach (var r in newList) { // updates if (oldList.Any(p => p.Typepk == r.Typepk)) { var persistentType = _S.Load <Conclave>(r.Typepk); persistentType.Typeid = r.Typeid; persistentType.Name = r.Name; persistentType.Customflg = r.Customflg; _S.Save(persistentType); _S.Flush(); _S.Clear(); } // inserts else if (r.Typepk == -1) { var persistentType = new Conclave { Typeid = r.Typeid, Name = r.Name, Customflg = r.Customflg }; _S.Save(persistentType); _S.Flush(); _S.Clear(); } } // deletions foreach (var x in oldList) { if (!newList.Any(p => p.Typepk == x.Typepk)) { var persistentType = _S.Load <Conclave>(x.Typepk); _S.Delete(persistentType); _S.Flush(); _S.Clear(); } } } ViewBag.onSuccess_Message = "Types updated successfully."; return(View("Index")); } else { ViewBag.onSuccess_Message = "You must construct additional Pylons."; return(View("Index")); } }