Example #1
0
        public ActionResult WarpIn1()
        {
            if (ModelState.IsValid)
            {
                Warpgate      d        = new Warpgate();
                List <Archon> archList = new List <Archon>();

                // Get data for existing Workouts
                using (ISession _S = MvcApplication.SF.GetCurrentSession())
                {
                    Gateway wk = null;

                    var wkList = _S.QueryOver(() => wk)
                                 .OrderBy(x => x.Name).Asc
                                 .List <Gateway>();

                    foreach (var r in wkList)
                    {
                        archList.Add(new Archon
                        {
                            Key     = r.Workoutpk,
                            Display = r.Name.ToString()
                        });
                    }

                    d.DDLWorkouts = new SelectList(archList, "Key", "Display");
                }

                return(View(d));
            }

            else
            {
                return(View("Index"));
            }
        }
Example #2
0
        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"));
            }
        }
Example #3
0
        public ActionResult WarpIn2()
        {
            if (ModelState.IsValid)
            {
                // [0] Build Probes
                List <Warpgate> f2    = new List <Warpgate>();
                List <Archon>   ctrl1 = new List <Archon>();
                List <Archon>   ctrl2 = new List <Archon>();

                // [1] Warp in Pylons
                using (ISession _S = MvcApplication.SF.GetCurrentSession())
                {
                    // [1.0] Select all Gateways
                    Gateway         wk     = null;
                    IList <Gateway> wkList = _S.QueryOver(() => wk)
                                             .OrderBy(x => x.Name).Asc
                                             .List <Gateway>();

                    // [1.1] Assimilate Archons and assign control groups
                    foreach (Gateway r in wkList)
                    {
                        if (r.Iswarmupflg)
                        {
                            ctrl1.Add(new Archon
                            {
                                Key     = r.Workoutpk,
                                Display = r.Name.ToString()
                            });
                        }
                        else
                        {
                            ctrl2.Add(new Archon
                            {
                                Key     = r.Workoutpk,
                                Display = r.Name.ToString()
                            });
                        }
                    }

                    // [1.2] Load Archons into Warp Prism
                    for (int i = 0; i < 2; i++)
                    {
                        Warpgate wg = new Warpgate();

                        if (i == 0)
                        {
                            wg.DDLWorkouts = new SelectList(ctrl1, "Key", "Display");
                        }
                        else
                        {
                            wg.DDLWorkouts = new SelectList(ctrl2, "Key", "Display");
                        }

                        f2.Add(wg);
                    }

                    // [1.3] Commence Archon drop
                    return(View(f2));
                }
            }

            else
            {
                return(View("Index"));
            }
        }
Example #4
0
        public ActionResult AssimilationForm(List <Warpgate> d)
        {
            if (ModelState.IsValid)
            {
                using (ISession _S = MvcApplication.SF.GetCurrentSession())
                {
                    Warpgate tp = null;

                    IList <Warpgate> oldList = _S.QueryOver(() => tp)
                                               .Where(x => x.Gateway.Workoutpk == d[0].Gateway.Workoutpk)
                                               .List <Warpgate>();

                    foreach (Warpgate q in d)
                    {
                        //updates
                        if (oldList.Any(p => p.Wksegpk == q.Wksegpk))
                        {
                            Warpgate persistentType = _S.Load <Warpgate>(q.Wksegpk);

                            persistentType.Gateway  = q.Gateway;
                            persistentType.Templar  = q.Templar;
                            persistentType.Duration = q.Duration;
                            persistentType.Sequence = q.Sequence;

                            _S.Save(persistentType);
                            _S.Flush();
                            _S.Clear();
                        }

                        //inserts
                        else if (q.Wksegpk == -1)
                        {
                            Warpgate persistentType = new Warpgate
                            {
                                Gateway  = q.Gateway,
                                Templar  = q.Templar,
                                Duration = q.Duration,
                                Sequence = q.Sequence
                            };

                            _S.Save(persistentType);
                            _S.Flush();
                            _S.Clear();
                        }
                    }

                    //deletions
                    foreach (Warpgate x in oldList)
                    {
                        if (!d.Any(p => p.Wksegpk == x.Wksegpk))
                        {
                            Warpgate persistentType = _S.Load <Warpgate>(x.Wksegpk);

                            _S.Delete(persistentType);
                            _S.Flush();
                            _S.Clear();
                        }
                    }
                }

                ViewBag.onSuccess_Message = "WkSeg updated successfully.";

                return(View("Index"));
            }
            else
            {
                return(View("Index"));
            }
        }
Example #5
0
        public ActionResult WarpIn1Form(Warpgate d)
        {
            if (ModelState.IsValid)
            {
                using (ISession _S = MvcApplication.SF.GetCurrentSession())
                {
                    // Get segment list
                    Templar sg = null;

                    IList <Templar> sgList = _S.QueryOver(() => sg)
                                             .SelectList(l => l
                                                         .Select(x => x.Segmentpk).WithAlias(() => sg.Segmentpk)
                                                         .Select(x => x.Name).WithAlias(() => sg.Name)
                                                         )
                                             .OrderBy(x => x.Name).Asc
                                             .TransformUsing(Transformers.AliasToBean <Templar>())
                                             .List <Templar>();

                    List <Archon> list2 = new List <Archon>();

                    foreach (Templar r in sgList)
                    {
                        list2.Add(new Archon
                        {
                            Key     = r.Segmentpk,
                            Display = r.Name.ToString()
                        });
                    }

                    // Get data for existing Wksegs
                    Warpgate wks = null;

                    IList <Warpgate> wksList = _S.QueryOver(() => wks)
                                               .Where(x => x.Gateway.Workoutpk == d.Gateway.Workoutpk)
                                               .OrderBy(x => x.Sequence).Asc
                                               .List <Warpgate>();

                    foreach (Warpgate z in wksList)
                    {
                        z.DDLSegments = new SelectList(list2, "Key", "Display", z.Templar.Segmentpk);
                    }

                    // Return data needed for controller if no result
                    if (wksList.Count == 0)
                    {
                        Gateway tmpG = new Gateway
                        {
                            Workoutpk = d.Gateway.Workoutpk
                        };

                        wksList.Add(new Warpgate
                        {
                            Gateway     = tmpG,
                            DDLSegments = new SelectList(list2, "Key", "Display")
                        });
                    }

                    return(View("Assimilation", wksList));
                }
            }

            else
            {
                return(View("Index"));
            }
        }