Esempio n. 1
0
        public void Remove(int?Id)
        {
            TravelType dbEntity = db.tbl_Travel_Type.Find(Id);

            dbEntity.isDelete = true;
            db.SaveChanges();
        }
Esempio n. 2
0
 public IActionResult Create(TravelType model)
 {
     if (HttpContext.Session.GetString("ID") == null)
     {
         return(RedirectToAction("Login", "Admin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             bool check = travelTypeRepository.checkID(model.ID);
             if (check)
             {
                 travelTypeRepository.Add(model);
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError(string.Empty, "This ID already exists.");
                 return(View());
             }
         }
         return(View(model));
     }
 }
Esempio n. 3
0
        public void Edit(TravelType _TravelType)
        {
            var dbEntity = db.tbl_Travel_Type.Find(_TravelType.ID);

            dbEntity.Name = _TravelType.Name;
            db.SaveChanges();
        }
Esempio n. 4
0
    //protected override void OnNorth(InputValue value)
    //{
    //    //positions[3].MoveToPosition(this);
    //}
    //protected override void OnEast(InputValue value)
    //{
    //    //positions[2].MoveToPosition(this);

    //}
    //protected override void OnSouth(InputValue value)
    //{
    //    //positions[0].MoveToPosition(this);

    //}
    //protected override void OnWest(InputValue value)
    //{
    //    //positions[1].MoveToPosition(this);
    //}

    public void MoveToPosition(Vector3 pos, TravelType travelType)
    {
        if (canMove)
        {
            transform.position = pos;
        }
    }
Esempio n. 5
0
 public ParticleTemplate()
 {
     name             = "";
     gravity_affected = false;
     image            = new Rectangle(0, 0, 6, 6);
     travel_path      = TravelType.Straight;
     speed            = 300f;
 }
Esempio n. 6
0
 public Holiday(string section, string uid, HolidayType type, string name, TravelType travel, Country country)
 {
     this.Type = type;
     this.LongName = name;
     this.Travel = travel;
     this.Country = country;
     this.Uid = uid;
     Holiday.Section = section;
 }
Esempio n. 7
0
 public Holiday(string section, string uid, HolidayType type, string name, TravelType travel, Country country)
 {
     Type = type;
     LongName = name;
     Travel = travel;
     Country = country;
     Uid = uid;
     Section = section;
 }
Esempio n. 8
0
            public bool AllowMovement(Tileset tileset, TravelType travelType, bool isPlayer = true)
            {
                if (!isPlayer && Type == TileType.Water)
                {
                    return(false);
                }

                if (Type != TileType.Normal)
                {
                    return(true);
                }

                return(tileset.AllowMovement(BackTileIndex, FrontTileIndex, travelType));
            }
Esempio n. 9
0
 public IActionResult Edit(TravelType model)
 {
     if (HttpContext.Session.GetString("ID") == null)
     {
         return(RedirectToAction("Login", "Admin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             travelTypeRepository.Edit(model);
             return(RedirectToAction("Index"));
         }
         return(View(model));
     }
 }
 public void Traval(TravelType type)
 {
     if (Root != null)
     {
         Console.WriteLine($"Travel type -> {type.ToString()}");
         if (type == TravelType.BreadthFirstTravel)
         {
             Console.Write($"{Root.Value} ");
         }
         else
         {
             Root.PrintTreeNode(type);
         }
         Console.WriteLine("");
     }
     else
     {
         Console.WriteLine("Tree is not initialized...");
     }
 }
Esempio n. 11
0
 public IActionResult Delete(int?Id)
 {
     if (HttpContext.Session.GetString("ID") == null)
     {
         return(RedirectToAction("Login", "Admin"));
     }
     else
     {
         if (Id == null)
         {
             //Error
             return(NotFound());
         }
         else
         {
             TravelType model = travelTypeRepository.GetTravelType(Id);
             return(View(model));
         }
     }
 }
Esempio n. 12
0
 public static string GetTravelSpeedString(TravelType type, TravelSpeed speed, bool imperial = false)
 {
     var travelSpeed = GetTravelSpeed(type, speed, imperial);
     int idxImp = imperial ? 0 : 1;
     string[] label = { " mph", " km/h" };
     string result = travelSpeed.ToString() + label[idxImp];
     return result;
 }
Esempio n. 13
0
        public static double GetTravelSpeed(TravelType type, TravelSpeed speed, bool imperial = false)
        {
            int idxSpeed = speed == TravelSpeed.Slow ? 0 : speed == TravelSpeed.Normal ? 1 : 2;
            int idxImp = imperial ? 0 : 1;
            int[,] walkingSpeed = { { 2, 3, 5 }, { 3, 5, 8 } };
            int[,] cyclingSpeed = { { 6, 10, 15 }, { 10, 15, 22 } };

            double result = 0;
            if (type == TravelType.Walking)
                result = walkingSpeed[idxImp, idxSpeed];
            else
                result = cyclingSpeed[idxImp, idxSpeed];
            return result;
        }
Esempio n. 14
0
        //
        // GET: /Admin/TravelType/Details/5

        public ViewResult Details(int id)
        {
            TravelType traveltype = db.TravelTypes.Single(t => t.id == id);

            return(View(traveltype));
        }
Esempio n. 15
0
        public static bool CheckTravel( Mobile caster, Point3D to, Map map, TravelType type )
        {
            if ( IsInvalid( map, to ) )
                return false;

            DungeonRegion fdc = caster.Region as DungeonRegion;
            DungeonRegion fdt = Region.Find(to, map) as DungeonRegion;

            switch ( type )
            {
                case TravelType.Recall:
                {
                    if ( ( fdc != null && !fdc.CanRecall ) || ( fdt != null && !fdt.CanRecall ) )
                    {
                        caster.SendAsciiMessage( "You cannot seem to get a fix on your destination." );
                        return false;
                    }
                    else if ( IsWindLoc( to ) && caster.Skills[SkillName.Magery].Value < 72.0 )
                    {
                        caster.SendAsciiMessage( "You are not worthy of entrance to the city of Wind." );
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }

                case TravelType.Gate:
                {
                    if ( ( fdc != null && !fdc.CanGate ) || ( fdt != null && !fdt.CanGate ) )
                    {
                        caster.SendAsciiMessage( "You cannot seem to get a fix on your destination." );
                        return false;
                    }
                    else if ( IsWindLoc( to ) || IsWindLoc( caster.Location ) )
                    {
                        caster.SendAsciiMessage( "You cannot Gate Travel to that location." );
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }

                case TravelType.Mark:
                {
                    if ( fdc != null && !fdc.CanRecall && !fdc.CanGate )
                    {
                        caster.SendAsciiMessage( "The spell seems to have no effect." );
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }

                default:
                {
                    return true;
                }
            }
        }