private void TransportDataCount() { TransportDevicesDao transportDevicesDao = new TransportDevicesDaoImpl(); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); List <TransportDevicesEntity> myTransports = transportDevicesDao.GetAllTransportDevicesByOwner(member); ResponseMessage.Add("TransportsCount", Convert.ToString(myTransports.Count)); }
private void GenerateDatabase() { var dbContext = AliveContext.Context; dbContext.Database.Create(); //fill the database with temporarily data MembersDao mem = new MembersDaoImpl(); List <MembersEntity> mems = mem.GetTemplateMembers(); for (int i = 0; i < mems.Count; i++) { dbContext.Members.Add(mems[i]); } dbContext.SaveChanges(); BoatsDao boat = new BoatsDaoImpl(); List <BoatsEntity> boats = boat.GetTemplateBoats(); for (int i = 0; i < boats.Count; i++) { dbContext.Boats.Add(boats.SingleOrDefault(b => b.BoatId == i)); } dbContext.SaveChanges(); TransportDevicesDao device = new TransportDevicesDaoImpl(); List <TransportDevicesEntity> devices = device.GetTemplateTransportDevices(); for (int i = 0; i < devices.Count; i++) { dbContext.TransportDevices.Add(devices.SingleOrDefault(d => d.TransportDeviceId == i)); } dbContext.SaveChanges(); RentRequestsDao rent = new RentRequestsDaoImpl(); List <RentRequestsEntity> rents = rent.GetTemplateRentRequests(); for (int i = 0; i < rents.Count; i++) { dbContext.RentRequests.Add(rents[i]); } dbContext.SaveChanges(); BoatRentalsDao boatRent = new BoatRentalsDaoImpl(); List <BoatRentalsEntity> boatRents = boatRent.GetTemplateBoatRents(); for (int i = 0; i < boatRents.Count; i++) { dbContext.BoatRentals.Add(boatRents[i]); } dbContext.SaveChanges(); }
private void LoadMainTransportData() { TransportDevicesDao transportDevicesDao = new TransportDevicesDaoImpl(); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); List <TransportDevicesEntity> myTransports = transportDevicesDao.GetAllTransportDevicesByOwner(member); for (int i = 0; i < myTransports.Count; i++) { ResponseMessage.Add("TransportName" + Convert.ToString(i), myTransports[i].TransportDeviceName); } for (int i = 0; i < myTransports.Count; i++) { ResponseMessage.Add("TransportImage" + Convert.ToString(i), myTransports[i].TransportDeviceImage); } for (int i = 0; i < myTransports.Count; i++) { ResponseMessage.Add("TransportId" + Convert.ToString(i), Convert.ToString(myTransports[i].TransportDeviceId)); } }
private void LoadSelectedTransportDevice() { TransportDevicesDao transportDevicesDao = new TransportDevicesDaoImpl(); TransportDevicesEntity transportDevice = transportDevicesDao.GetTransportDevicesById(Convert.ToInt32(id)); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberBTransportDevice(transportDevice); ResponseMessage.Add("TransportDeviceName", transportDevice.TransportDeviceName); ResponseMessage.Add("CarryingCapacity", Convert.ToString(transportDevice.CarryingCapacity)); ResponseMessage.Add("TransportDeviceType", Convert.ToString(transportDevice.TransportDeviceType)); ResponseMessage.Add("TransportDeviceLength", Convert.ToString(transportDevice.TransportDeviceLength)); ResponseMessage.Add("TransportDeviceWidth", Convert.ToString(transportDevice.TransportDeviceWidth)); ResponseMessage.Add("TransportDeviceImage", Convert.ToString(transportDevice.TransportDeviceImage)); /*Member Adatok, ha az is kellene, például a foglalásnál*/ ResponseMessage.Add("email", member.Email); ResponseMessage.Add("password", member.Password); ResponseMessage.Add("permission", member.Permission.ToString()); char[] delimiter = { ' ' }; string[] memberName = member.MemberName.Split(delimiter); string[] firstnameaArray = memberName.Take(memberName.Count() - 1).ToArray(); string firstname = string.Join(" ", firstnameaArray); string lastname = memberName.Last(); ResponseMessage.Add("firstname", firstname); ResponseMessage.Add("lastname", lastname); ResponseMessage.Add("country", member.Country); ResponseMessage.Add("city", member.City); ResponseMessage.Add("street", member.Street); ResponseMessage.Add("houseNumber", member.HouseNumber); ResponseMessage.Add("MemberImage", member.MemberImage); /* ^^Member Adatok, ha az is kellene, például a foglalásnál*/ }