public List <BoatsEntity> GetAllBoatsByOwner(MembersEntity Owner)/*Függvény, ami visszaad egy listát, ami tartalmazza, az adott felhasználó hajóit*/ { var linqQuery = from row in dbc.Boats where row.FKOwner.MemberId.Equals(Owner.MemberId) select row; List <BoatsEntity> BoatsList = linqQuery.ToList(); return(BoatsList); }
public int UpdateMember(MembersVM objeto) { try { var memberEntity = new MembersEntity { AreaActuationRole = objeto.AreaActuationRole, CurrentlyWork = objeto.CurrentlyWork, Degree = objeto.Degree, Email = objeto.Email, IdUsuario = objeto.IdUsuario, Id = objeto.Id, Name = objeto.Name, Organization = objeto.Organization, WebSite = objeto.WebSite, AnaliseFinalizada = objeto.AnaliseFinalizada }; //_context.Members. _repositoryMembers.Update(memberEntity); _repositoryMembers.Context.SaveChanges(); return((int)RestResponse.SUCCESS); } catch (Exception e) { Console.WriteLine(e); return((int)RestResponse.SERVER_ERROR); } }
public List <TransportDevicesEntity> GetAllTransportDevicesByOwner(MembersEntity Owner)/*Függvény, ami visszaad egy listát, ami tartalmazza, hogy az adott felhasználónak, milyen szállító eszközei vannak*/ { var linqQuery = from row in dbc.TransportDevices where row.FKOwner.MemberId.Equals(Owner.MemberId) select row; List <TransportDevicesEntity> TransportDevicesList = linqQuery.ToList(); return(TransportDevicesList); }
public List <RentRequestsEntity> GetAllRentRequestsByWhoBorrows(MembersEntity WhoBorrows)/*Függvény, ami visszaad egy listát, ami tartalmazza, hogy az adott felhasználónak, milyen kölcsönzési kérelmei vannak vannak*/ { var linqQuery = from row in dbc.RentRequests where row.WhoBorrows.Equals(WhoBorrows) select row; List <RentRequestsEntity> RentRequestsList = linqQuery.ToList(); return(RentRequestsList); }
private void TryToLogin() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(Email); if (member == null || !member.Password.Equals(Password)) { FeedbackMessage = "Hibás e-mail cím vagy jelszó!"; ServiceStatus = Status.Error; } else { if (member.Permission == 0) { ResponseMessage.Add("permission", "admin"); } else { ResponseMessage.Add("permission", "user"); } FeedbackMessage = "Sikeres belépés!"; ServiceStatus = Status.OK; } // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
private void UpdateUser() { //DatabaseContext dbc = new DatabaseContext(); MembersEntity memberData = dbc.Members.SingleOrDefault(m => m.Email.Equals(email)); memberData.MemberName = firstname + " " + lastname; memberData.Email = email; memberData.Country = country; memberData.City = city; memberData.Street = street; memberData.HouseNumber = houseNumber; memberData.Permission = permission; memberData.MemberImage = picturePath; dbc.SaveChanges(); FeedbackMessage = "Adatok sikeresen módosítva!"; ServiceStatus = Status.OK; // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
private void TryToBook() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity whoBorrows = membersDao.getMemberByEmail(whoBorrowsEmail); RentRequestsEntity rentRequest = new RentRequestsEntity(); rentRequest.BoatToBorrow = boatToBorrow; //to DO deviceBorrow rentRequest.DeviceToBorrow = null; rentRequest.StartingDate = from; rentRequest.EndDate = to; rentRequest.FromWhere = fromWhere; rentRequest.ToWhere = toWhere; rentRequest.WhoBorrows = whoBorrows; rentRequest.Status = 1; dbc.RentRequests.Add(rentRequest); dbc.SaveChanges(); FeedbackMessage = "Foglalás kérés jelezve a tulajdonos felé!"; ServiceStatus = Status.OK; // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
GetBoatRentalsByWhoRents( MembersEntity WhoRents) /*Függvény, ami visszaad egy listát, ami tartalmazza, hogy az adott felhaszálónak milyen kölcsönzései vannak*/ { var linqQuery = from row in dbc.BoatRentals where row.FKWhoRents.Equals(WhoRents) select row; List <BoatRentalsEntity> BoatRentalsList = linqQuery.ToList(); return(BoatRentalsList); }
private void BoatDataCount() { BoatsDao boatsDao = new BoatsDaoImpl(); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); List <BoatsEntity> myBoats = boatsDao.GetAllBoatsByOwner(member); ResponseMessage.Add("BoatsCount", Convert.ToString(myBoats.Count)); }
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 Register_Click(object sender, RoutedEventArgs e) { try { Validator registerValidator = new Validator(); if (imgBoatPicture.Tag == null) { imgBoatPicture.Tag = "Stock_transport_image.png"; } registerValidator.ValidationComponents.Add(new EmptyFieldValidator(imgBoatPicture.Tag.ToString(), "fénykép")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatLenght.Text, "Hossz")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatWidth.Text, "Szélesség")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatManpower.Text, "Kapacitás")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatName.Text, "Név")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatType.Text, "Típus")); registerValidator.ValidateElements(); BoatsDao boatsDao = new BoatsDaoImpl(); TransportDevicesEntity NewEntity = new TransportDevicesEntity(); dbc = AliveContext.Context; NewEntity.TransportDeviceId = dbc.Boats.OrderByDescending(u => u.BoatId).FirstOrDefault().BoatId; if (imgBoatPicture.Tag == null) { imgBoatPicture.Tag = "stock_boat_image.png"; } NewEntity.TransportDeviceImage = imgBoatPicture.Tag.ToString(); NewEntity.TransportDeviceLength = Convert.ToInt32(tbBoatLenght.Text); NewEntity.TransportDeviceWidth = Convert.ToInt32(tbBoatWidth.Text); NewEntity.TransportDeviceName = tbBoatName.Text; //boatsEntity.BoatRentals = null; NewEntity.TransportDeviceType = tbBoatType.Text; MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); NewEntity.FKOwner = member; NewEntity.CarryingCapacity = Convert.ToInt32(tbBoatManpower.Text); RegisterTrasportDeviceService registerService = new RegisterTrasportDeviceService(ref NewEntity); MyBoatsAndDevicesWindow ToMyBoatsAndDevicesWindow = new MyBoatsAndDevicesWindow(email); //ToMyBoatsAndDevicesWindow.Show(); ; this.Close(); } catch (Exception ex) { new ExceptionToConsole(ex); } }
private void LoadSelectedBoat() { BoatsDao boatsDao = new BoatsDaoImpl(); BoatsEntity boat = boatsDao.GetBoatsById(Convert.ToInt32(id)); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByBoat(boat); ResponseMessage.Add("BoatName", boat.BoatName); ResponseMessage.Add("BoatImage", boat.BoatImage); ResponseMessage.Add("BoatType", boat.BoatType); ResponseMessage.Add("DailyPrice", Convert.ToString(boat.DailyPrice)); ResponseMessage.Add("WhereIsNowTheBoat", boat.WhereIsNowTheBoat); ResponseMessage.Add("IsLoan", Convert.ToString(boat.IsLoan)); ResponseMessage.Add("MaxPerson", Convert.ToString(boat.MaxPerson)); ResponseMessage.Add("MaxSpeed", Convert.ToString(boat.MaxSpeed)); ResponseMessage.Add("DiveDepth", Convert.ToString(boat.DiveDepth)); ResponseMessage.Add("Consumption", Convert.ToString(boat.Consumption)); ResponseMessage.Add("YearOfManufacture", Convert.ToString(boat.YearOfManufacture)); ResponseMessage.Add("BoatLength", Convert.ToString(boat.BoatLength)); ResponseMessage.Add("BoatWidth", Convert.ToString(boat.BoatWidth)); /*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*/ }
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 LoadMainBoatData() { BoatsDao boatsDao = new BoatsDaoImpl(); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); List <BoatsEntity> myBoats = boatsDao.GetAllBoatsByOwner(member); for (int i = 0; i < myBoats.Count; i++) { ResponseMessage.Add("boatName" + Convert.ToString(i), myBoats[i].BoatName); } for (int i = 0; i < myBoats.Count; i++) { ResponseMessage.Add("boatImage" + Convert.ToString(i), myBoats[i].BoatImage); } for (int i = 0; i < myBoats.Count; i++) { ResponseMessage.Add("boatId" + Convert.ToString(i), Convert.ToString(myBoats[i].BoatId)); } }
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*/ }
private void TryToRegisterWithPermission() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity memberAlreadyInDatabase = membersDao.getMemberByEmail(email); if (memberAlreadyInDatabase != null) { FeedbackMessage = "Ezzel az e-mail címmel már regisztrált valaki!"; ServiceStatus = Status.Error; } else { MembersEntity newMemberEntity = new MembersEntity(); newMemberEntity.MemberName = firstname + " " + lastname; newMemberEntity.Email = email; newMemberEntity.Password = password; newMemberEntity.Country = country; newMemberEntity.City = city; newMemberEntity.Street = street; newMemberEntity.HouseNumber = houseNumber; newMemberEntity.Permission = permission; newMemberEntity.MemberImage = picturePath; //DatabaseContext dbc = new DatabaseContext(); dbc.Members.Add(newMemberEntity); dbc.SaveChanges(); FeedbackMessage = "Sikeres regisztráció!"; ServiceStatus = Status.OK; } // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
private void TryToChangePassword() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(Email); if (!member.Password.Equals(OldPassword)) { FeedbackMessage = "Hibásan adta meg a régi jelszót!"; ServiceStatus = Status.Error; } else { member.Password = Password; dbc.SaveChanges(); FeedbackMessage = "Sikeres jelszó változtatás!"; ServiceStatus = Status.OK; } // it must be a method if (!string.IsNullOrEmpty(FeedbackMessage) && !string.IsNullOrWhiteSpace(FeedbackMessage)) { new PrintMessageBox(FeedbackMessage, ServiceStatus); } }
private void LoadUserData() { MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); 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); }
private void Register_Click(object sender, RoutedEventArgs e) { try { Validator registerValidator = new Validator(); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatName.Text, "Név")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatType.Text, "Típus")); //registerValidator.ValidationComponents.Add(new EmptyFieldValidator(imgBoatPicture.Tag, "fénykép")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatLenght.Text, "Hossz")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatWidth.Text, "Szélesség")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatConsumption.Text, "Fogyasztás")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatPrice.Text, "Ár")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatDept.Text, "Merülési mélység")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatManpower.Text, "Max. Létszám")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatSpeed.Text, "Max. sebesség")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatPlace.Text, "Tartózkodási helye")); registerValidator.ValidationComponents.Add(new EmptyFieldValidator(tbBoatYear.Text, "Gyártási év")); registerValidator.ValidateElements(); BoatsDao boatsDao = new BoatsDaoImpl(); BoatsEntity boatsEntity = new BoatsEntity(); dbc = AliveContext.Context; boatsEntity.BoatId = dbc.Boats.OrderByDescending(u => u.BoatId).FirstOrDefault().BoatId; if (imgBoatPicture.Tag == null) { imgBoatPicture.Tag = "stock_boat_image.png"; } boatsEntity.BoatImage = imgBoatPicture.Tag.ToString(); boatsEntity.BoatLength = Convert.ToInt32(tbBoatLenght.Text); boatsEntity.BoatWidth = Convert.ToInt32(tbBoatWidth.Text); boatsEntity.BoatName = tbBoatName.Text; //boatsEntity.BoatRentals = null; boatsEntity.BoatType = tbBoatType.Text; boatsEntity.Consumption = Convert.ToInt32(tbBoatConsumption.Text); boatsEntity.DailyPrice = Convert.ToInt32(tbBoatPrice.Text); boatsEntity.DiveDepth = Convert.ToInt32(tbBoatDept.Text); MembersDao membersDao = new MembersDaoImpl(); MembersEntity member = membersDao.getMemberByEmail(email); boatsEntity.FKOwner = member; boatsEntity.IsLoan = tbIsLoan.IsChecked ?? false; boatsEntity.MaxPerson = Convert.ToInt32(tbBoatManpower.Text); boatsEntity.MaxSpeed = Convert.ToInt32(tbBoatSpeed.Text); boatsEntity.WhereIsNowTheBoat = tbBoatPlace.Text; boatsEntity.YearOfManufacture = Convert.ToInt32(tbBoatYear.Text); RegisterBoatService registerService = new RegisterBoatService(ref boatsEntity); MyBoatsAndDevicesWindow ToMyBoatsAndDevicesWindow = new MyBoatsAndDevicesWindow(email); //ToMyBoatsAndDevicesWindow.Show(); this.Close(); } catch (Exception ex) { new ExceptionToConsole(ex); } }
public int SalvarUsuario(UserVM objeto) { try { #region Adicionar Novo Usuário //VALIDAÇÃO CADASTRO COM INTEGRAÇÃO GOOGLE E FACEBOOK if (objeto.Password == "Autentication with Google" || objeto.Password == "Autentication with Facebook") { var VerificaUsuarioCadastrado = _repositoryUser.Selecionar(o => o.Email == objeto.Email && o.Password == objeto.Password); if (VerificaUsuarioCadastrado != null) { return((VerificaUsuarioCadastrado.Password == "Autentication with Google") ? (int)RestResponse.ERROR_USUARIO_JA_CADASTRADO_COM_GOOGLE : (int)RestResponse.ERROR_USUARIO_JA_CADASTRADO_COM_FACEBOOK); } } else //VALIDAÇÃO DE CADASTRO - PREENCHIMENTO DO FORMULARIO { var VerificaUsuarioCadastrado = _repositoryUser.Selecionar(o => o.Email == objeto.Email); if (VerificaUsuarioCadastrado != null) { return((int)RestResponse.ERROR_EMAIL_JA_CADASTRADO); } var VerificaUsernameCadastrado = _repositoryUser.Selecionar(o => o.UserName == objeto.UserName); if (VerificaUsernameCadastrado != null) { return((int)RestResponse.ERROR_USERNAME_JA_CADASTRADO); } } var UserEntity = new UserEntity { Email = objeto.Email, Name = objeto.Name, Password = objeto.Password, UserImage = objeto.UserImage.ToString(), UserName = objeto.UserName, UsuarioHabilitado = (int?)EnumUsuarioHabilitado.HABILITADO }; _repositoryUser.Salvar(UserEntity); _repositoryUser.Context.SaveChanges(); #endregion #region Adicionar Novo Membro var MembersEntity = new MembersEntity { Email = objeto.Email, Name = objeto.Name, IdUsuario = UserEntity.Id, AnaliseFinalizada = (int)EnumAnaliseFinalizadaMembro.MEMBRO_PRECISA_ATUALIZAR_REGISTRO }; _repositoryMembers.Salvar(MembersEntity); _repositoryMembers.Context.SaveChanges(); #endregion #region Cadastrar Notificacao - Boas Vindas ao Usuário var notificationWelcomeVM = new NotificationVM { DescricaoNotificacao = "Bem vindo SEPractices4ML! Acompanhe aqui as atividades envolvendo o seu usuario.", IsConcluida = (int?)EnumConclusaoNotificacao.PENDENTE, LevelNotification = (int?)EnumLevelNotification.USER, TipoNotificacao = (int?)EnumTipoNotificaco.BOAS_VINDAS_AO_USUARIO, IdUsuario = UserEntity.Id }; _notificationBll.CadastrarNotificacao(notificationWelcomeVM); #endregion return((int)RestResponse.SUCCESS); } catch (Exception e) { Console.WriteLine(e); return((int)RestResponse.SERVER_ERROR); } }
public void DelMembre() { AllMembers = new ObservableCollection <User>(AllMembers.Concat(SelectedMembersEntity)); MembersEntity = new ObservableCollection <User>(MembersEntity.Except(SelectedMembersEntity)); }
public void AddMembre() { MembersEntity = new ObservableCollection <User>(MembersEntity.Concat(SelectedAllMembers)); AllMembers = new ObservableCollection <User>(AllMembers.Except(SelectedAllMembers)); }