public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string content = string.Empty; LookingFor lookingFor = (LookingFor)value; switch (lookingFor) { case LookingFor.Dating: content = AppResources.dating; break; case LookingFor.Friends: content = AppResources.friends; break; case LookingFor.Networking: content = AppResources.networking; break; case LookingFor.Relationship: content = AppResources.aRelationship; break; } return(content); }
public bool MatchWith(LookingFor lookingFor) { bool match = false; if (PartnerToMyIdea) { match = lookingFor.IdeasToJoin || lookingFor.JoinOrBeJoined; } if (IdeasToJoin) { match = match || lookingFor.PartnerToMyIdea; } if (JoinOrBeJoined) { match = match || lookingFor.PartnerToMyIdea || IdeasToJoin || JoinOrBeJoined; } if (Investements) { match = match || lookingFor.Financing; } if (Financing) { match = match || lookingFor.Investements; } return match; }
public void DeleteByProfileId(long profileId, LookingFor lookingFor) { var entity = SingleAttached(p => p.ProfileId == profileId && p.Search == (byte)lookingFor); if (entity != null) { Delete(entity); } }
public void AddByProfileId(long profileId, LookingFor lookingFor) { var exist = SingleAttached(p => p.ProfileId == profileId && p.Search == (byte)lookingFor); if (exist == null) { Add(new SearchingFor { Search = (byte)lookingFor, ProfileId = profileId }); } }
public bool DoesLookForExist(LookingFor lkf) { if (lookingFor == null) { return(false); } foreach (var entry in lookingFor) { if (entry == lkf) { return(true); } } return(false); }
private void SeedLookingFor(List <string> list) { using (CatchmeContext context = new CatchmeContext()) { var i = 0; foreach (var item in list) { var lookingFor = new LookingFor(); lookingFor.Name = item; lookingFor.ItemId = i; context.LookingFor.Add(lookingFor); i++; } context.SaveChanges(); } }
private void RefreshTimers() { while (ApplicationRunning) { if (tim1 > 0) { tim1--; if (tim1 == 0) { // ramka nie przyszla Console.WriteLine("FRAME ERROR"); state = LookingFor.BEGIN; } } Thread.Sleep(1); } }
public virtual HashSet <string> GetSelectedFieldsList() { var hs = new HashSet <string>(); if (!String.IsNullOrEmpty(Location.CountryCode)) { hs.Add("Location"); } if (BodyBuild.Count > 0 && BodyBuild.Any(p => p > 0)) { hs.Add("BodyBuild"); } if (EyeColor.Count > 0 && EyeColor.Any(p => p > 0)) { hs.Add("EyeColor"); } if (HairColor.Count > 0 && HairColor.Any(p => p > 0)) { hs.Add("HairColor"); } if (Height.Count > 0 && Height.Any(p => p > 0)) { hs.Add("Height"); } if (Age.Count > 0 && Age.Any(p => p > 0)) { hs.Add("Age"); hs.Add("BirthYear"); } if (LookingFor.Count > 0 && LookingFor.Any(p => p > 0)) { hs.Add("LookingFor"); } if (CountryToGo.Count > 0 && CountryToGo.Any(p => !String.IsNullOrWhiteSpace(p))) { hs.Add("Country"); } if (Language.Count > 0 && Language.Any(p => !String.IsNullOrWhiteSpace(p))) { hs.Add("Language"); } return(hs); }
public void Delete(int?ItemID) { var itemObj = db.ItemDetails.Find(ItemID); //remove picture //remove comment items db.CommentItems.RemoveRange(db.CommentItems.Where(x => x.ItemID == itemObj.ItemID)); //remove wishlist items db.WishListItems.RemoveRange(db.WishListItems.Where(x => x.ItemID == itemObj.ItemID)); //remove booking items db.BookingItems.RemoveRange(db.BookingItems.Where(x => x.ItemID == itemObj.ItemID)); //remove looking fors LookingFor lookingForObj = db.LookingFors.Where(x => x.LookingForID == itemObj.LookingForID).Single(); db.LookingFors.Remove(lookingForObj); //remove room details RoomDetail roomDetailObj = db.RoomDetails.Where(x => x.RoomDetailID == itemObj.RoomDetailID).Single(); db.RoomDetails.Remove(roomDetailObj); //remove lifestyle Lifestyle lifestyleObj = db.Lifestyles.Where(x => x.LifestyleID == itemObj.LifestyleID).Single(); db.Lifestyles.Remove(lifestyleObj); //remove other features OtherFeature otherFeatureObj = db.OtherFeatures.Where(x => x.OtherFeatureID == itemObj.OtherFeatureID).Single(); db.OtherFeatures.Remove(otherFeatureObj); //Remove Item db.ItemDetails.Remove(itemObj); db.SaveChanges(); }
// ramka jest gotowa w rxFrame[] i ma rozmiar rxFrameIdx private void ReceiveFrame() { // pokazywanie samych danych if (rxFrame[0] == 0x02) { string tempMsg = ""; //for (int i = 0; i < rxFrameIdx; i++) for (int i = 7; i < rxFrameIdx - 2; i++) { //TerminalOutput(Byte2HexStr(rxFrame[i])); tempMsg += (char)rxFrame[i]; } tempMsg += '\n'; TerminalOutput(tempMsg); // wysylanie ACK jezeli ramka zaczyna sie na 0x02 byte[] ack = { 0x06 }; Port.Write(ack, 0, 1); } state = LookingFor.BEGIN; }
public void AddSearches(long profileId, LookingFor lookingFor) { _searchingForRepository.AddByProfileId(profileId, lookingFor); }
public void DeleteSearches(long profileId, LookingFor lookingFor) { _searchingForRepository.DeleteByProfileId(profileId, lookingFor); }
public bool DoesLookForExist(LookingFor lkf) { if (lookingFor == null) { return false; } foreach (var entry in lookingFor) { if (entry == lkf) { return true; } } return false; }
private void BuildFrame(byte byteFromQueue) { if (state == LookingFor.BEGIN) { rxFrameIdx = 0; rxFrame[rxFrameIdx++] = byteFromQueue; if (rxFrame[0] != 0x06 && rxFrame[0] != 0x15 && rxFrame[0] != 0x02 && rxFrame[0] != 0x03 && rxFrame[0] != 0x3F) { rxFrameIdx = 0; } else { if (rxFrame[0] == 0x06 || rxFrame[0] == 0x15) { ReceiveFrame(); } else if (rxFrame[0] == 0x02 || rxFrame[0] == 0x03 || rxFrame[0] == 0x3F) { state = LookingFor.LENGTH; StartTimer1(10); } } } else if (state == LookingFor.LENGTH) { rxFrame[rxFrameIdx++] = byteFromQueue; lengthChecker = byteFromQueue; if (rxFrame[0] == 0x3F) { state = LookingFor.BEGIN; StopTimer1(); ReceiveFrame(); } else { state = LookingFor.CC; StartTimer1(10); } } else if (state == LookingFor.CC) { rxFrame[rxFrameIdx++] = byteFromQueue; if (rxFrame[1] != 0x00) { state = LookingFor.DATA; } else { state = LookingFor.CHECKSUM_1; } StartTimer1(10); } else if (state == LookingFor.DATA) { rxFrame[rxFrameIdx++] = byteFromQueue; lengthChecker--; StartTimer1(10); if (lengthChecker == 0) { state = LookingFor.CHECKSUM_1; } } else if (state == LookingFor.CHECKSUM_1) { rxFrame[rxFrameIdx++] = byteFromQueue; StartTimer1(10); state = LookingFor.CHECKSUM_2; } else if (state == LookingFor.CHECKSUM_2) { rxFrame[rxFrameIdx++] = byteFromQueue; StopTimer1(); // sprawdzanie sumy kontrolnej int sum = 0; for (int i = 1; i < rxFrameIdx - 2; i++) { sum += rxFrame[i]; } int checksum = rxFrame[rxFrameIdx - 1]; checksum <<= 8; checksum |= rxFrame[rxFrameIdx - 2]; if (sum == checksum) { Console.WriteLine("Poprawna suma kontrolna: " + sum + "_" + checksum); ReceiveFrame(); } else { Console.WriteLine("Niepoprawna suma kontrolna: " + sum + "_" + checksum); } state = LookingFor.BEGIN; } // w przypadku, gdy ktos bedzie probowal wyslac za dluga ramke, ma zresetowac caly proces if (rxFrameIdx > 168) { rxFrameIdx = 0; StartTimer1(1); } }