Esempio n. 1
0
        public List <VesselType> GetVesselTypeListForDopDown()
        {
            List <VesselType> vesselTypeList = new List <VesselType>();
            ShipDAL           shipDal        = new ShipDAL();

            return(shipDal.GetVesselTypeListForDopDown());
        }
Esempio n. 2
0
        public List <VesselSubSubType> GetVesselSubSubTypeListBySubTypeForDopDown(int vesselSubTypeId)
        {
            List <VesselSubSubType> vesselTypeList = new List <VesselSubSubType>();
            ShipDAL shipDal = new ShipDAL();

            return(shipDal.GetVesselSubSubTypeListBySubTypeForDopDown(vesselSubTypeId));
        }
Esempio n. 3
0
        public Ship GetShipDetailsById(int shipId)
        {
            ShipDAL shipDal = new ShipDAL();

            //Ship ship = new Ship();

            return(shipDal.GetShipDetailsById(shipId));
        }
Esempio n. 4
0
        public ShipManual GetManual(string controllerName, string actionName)
        {
            ShipManual file    = new ShipManual();
            ShipDAL    shipDAL = new ShipDAL();

            file = shipDAL.GetManual(controllerName, actionName);
            return(file);
        }
Esempio n. 5
0
        public List <Ship> GetAllShipsPageWise(int pageIndex, ref int totalCount, int pageSize)
        {
            List <Ship> shipsList = new List <Ship>();
            ShipDAL     shipDal   = new ShipDAL();

            shipsList = shipDal.GetAllShipsPageWise(pageIndex, ref totalCount, pageSize);

            return(shipsList);
        }
 public IHttpActionResult GetSystemFleets(string System)
 {
     try
     {
         return(Ok(ShipDAL.GetUserFleets(null, null, null, System).FindAll(x => x.Status == 0)));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult AddShipDesigns([FromBody] UserDesigns design)
 {
     try
     {
         return(Ok(ShipDAL.AddShipDesigns(design)));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult GetShipDesignbyUser(int UserID)
 {
     try
     {
         return(Ok(ShipDAL.GetShipDesignbyUser(UserID)));;
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult RemoveShipDesigns(int UserID, int ShipDesignID)
 {
     try
     {
         return(Ok(ShipDAL.RemoveShipDesigns(UserID, ShipDesignID)));;
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult GetShipDesignDetails(int ShipDesignID)
 {
     try
     {
         return(Ok(ShipDAL.GetShipDesignDetails(ShipDesignID)));;
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult GetShipPods()
 {
     try
     {
         return(Ok(ShipDAL.GetShipPods()));;
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult GetPlanetFleets(int UserID, int PlanetID)
 {
     try
     {
         return(Ok(ShipDAL.GetPlanetFleets(UserID, PlanetID)));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
 public IHttpActionResult AddShipDesignPods([FromBody] List <AddShipPods> Pods)
 {
     try
     {
         return(Ok(ShipDAL.AddShipDesignPods(Pods)));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Esempio n. 14
0
        public static List <Fleet> InsertUpdatePlayerShip(BuildingQue ship)
        {
            List <Fleet> fleets = ShipDAL.GetUserFleets(ship.UserID, ship.PlanetID).FindAll(x => x.Status == 0).OrderBy(x => x.Arrival).ToList();

            if (fleets.Count == 0)
            {
                ShipDAL.AddFleet(ship);
            }
            else
            {
                ShipDAL.AddFleetDetails(ship, fleets[0].FleetID);
            }
            fleets = ShipDAL.GetUserFleets(ship.UserID, ship.PlanetID);
            return(fleets);
        }
Esempio n. 15
0
        public static PlanetDetail AddShipQueue(BuildingQue buildingQue)
        {
            PlanetDetail pl   = PlanetDAL.GetPlanet(buildingQue.PlanetID, buildingQue.UserID);
            UserDesigns  ship = ShipDAL.GetShipDesignbyUser(buildingQue.UserID).Find(x => x.ShipDesignID == buildingQue.BuildingID);

            if (pl.Materials < ship.MaterialCost || pl.Military < ship.MilitaryCost)
            {
                throw new Exception("Not enough resources");
            }
            else
            {
                PlanetDAL.UpdatePopAndMats(buildingQue.PlanetID, pl.Materials - buildingQue.MaterialCost, pl.Population, pl.Military - (int)ship.MilitaryCost.Value);
                pl.Materials -= buildingQue.MaterialCost;
                pl.Military  -= (int)ship.MilitaryCost.Value;
            }


            AllbuildQues BuildingsQueLeft = PlanetBLL.GetBuildingQueue(buildingQue.PlanetID, buildingQue.UserID);
            DateTime     UTC = DateTime.UtcNow;

            BuildingQue bq = new BuildingQue();

            bq.BuildingID   = buildingQue.BuildingID;
            bq.PlanetID     = buildingQue.PlanetID;
            bq.Seconds      = buildingQue.Seconds;
            bq.UserID       = buildingQue.UserID;
            bq.MaterialCost = buildingQue.MaterialCost;
            bq.Movement     = buildingQue.Movement;
            bq.Type         = 3;

            DateTime?maxCompletetionDate = BuildingsQueLeft.shipQue.FindAll(x => x.Type == 3).Max(x => x.CompletetionDate);

            if (maxCompletetionDate.HasValue)
            {
                bq.CompletetionDate = maxCompletetionDate.Value.AddSeconds(buildingQue.Seconds.Value);
            }
            else
            {
                bq.CompletetionDate = UTC.AddSeconds(buildingQue.Seconds.Value);
            }
            PlanetDAL.AddBuildingQue(bq);
            return(pl);
        }
Esempio n. 16
0
 public static List <Fleet> MoveFleet(int UserID, int FleetID, int PlanetID)
 {
     ShipDAL.SetMoveFleet(UserID, FleetID, PlanetID);
     return(ShipDAL.GetUserFleets(UserID));
 }
Esempio n. 17
0
 public static List <Fleet> FleetMoveComplete(int UserID)
 {
     ShipDAL.FleetMoveComplete();
     return(ShipDAL.GetUserFleets(UserID));
 }
Esempio n. 18
0
        public List <Ship> GetAllShipForDropDown()
        {
            ShipDAL shipDal = new ShipDAL();

            return(shipDal.GetAllShipForDropDown());
        }
Esempio n. 19
0
        public int SaveShipDetails(Ship ship)
        {
            ShipDAL shipBl = new ShipDAL();

            return(shipBl.SaveShipDetails(ship));
        }