public static bool search(DetailsCandidate dc) { Dictionary <string, string> d = new Dictionary <string, string>(); List <User> allUser = context.Users.ToList(); foreach (var item in allUser) //מעבר על כל המשתמשים { DetailsCandidate CurrentUser = CandidateUser.LoginCandidate(item); //הבאת כל פרטי המועמד הנוכחי if (CurrentUser.Candidate != null) { if (CurrentUser.Candidate.EnterIn == 2 && CurrentUser.User.Gender == !dc.User.Gender) //אם הוא מין המין הנוגד ןהוא במצב שאפשר לחפש לו { if (SuitAbleCrit(dc, CurrentUser) == true && SuitAbleCrit(CurrentUser, dc) == true) //אם הקריטריונים של שתיהם מתאימים אחד לשני { if (dc.User.Gender == true) { d.Add(dc.User.Tz, CurrentUser.User.Tz); } else { d.Add(CurrentUser.User.Tz, dc.User.Tz); } } } } } AddSuggestToMeetingTable(d, dc.User.Gender); if (d.Count() > 0) { return(true); } return(false); }
public IHttpActionResult hagashatBakasha(DetailsCandidate dc)//מטפל בהגשת בקשת מועמד { BL.SendMail.hagashatBakasha(dc); return(Ok("בקשתך התקבלה בהצלחה")); }
public static void SaveDetailsCandidate(DetailsCandidate dc)// שמירת הנתונים של המועמד { using (shiduchimEntities context = new shiduchimEntities()) { if (ExistUserInSql(dc.User.Password, dc.User.UserName)) { UpdateDB.UpdateUser(Conversions.UserDtoToDal(dc.User)); //save only user int userid = context.Users.FirstOrDefault(u => u.Password == dc.User.Password /*&& u.userName==userName*/).UserId; UpdateDB.UpdateCandidate(Conversions.CandidateDtoToDal(dc.Candidate), userid); UpdateDB.UpdateMechtanim(Conversions.MechutanimListDtoToDAL(dc.Mechutanim), userid); UpdateDB.UpdateChildren(Conversions.childrenListDtoToDAL(dc.Children), userid); //UpdateDB.UpdateDocument(Conversions.DocumentListDtoToDAL( dc.Documents), userid); UpdateDB.UpdateHospitalization(Conversions.HospitalizationListDtoToDAL(dc.Hospitalizations), userid); UpdateDB.UpdateValueListCandidate(Conversions.ValueListCandidateListDtoToDAL(dc.ValueListCandidate), userid); UpdateDB.UpdateMigbalaCandidate(Conversions.MigbalaCandidateListDtoToDAL(dc.MigbalaCandidates), userid); UpdateDB.Updateparents(Conversions.ParentListDtoToDAL(dc.Parents), userid); context.SaveChanges(); } } }
public static void hagashatBakasha(DetailsCandidate dc)//שומרת פרטי מועמד ושולחת מייל לשדכן לקביעת פגישה { string subject = "פגישה עם שדכן"; string text = "מועמד בשם" + dc.User.FirstName + " " + dc.User.LastName + "בעל ת.ז. שמיספרה " + dc.User.Tz + "שלח הגשת בקשה לקביעת פגישת שדכן"; CandidateUser.SaveDetailsCandidate(dc); mail3(text, subject, "*****@*****.**"); }
public static DetailsCandidate LoginCandidate(User user)//בדיקה אם המועמד קיים והחזרת כל פרטיו { using (shiduchimEntities context = new shiduchimEntities()) { if (user.Tz != null) { User u = new User(); u = context.Users.FirstOrDefault(p => p.Tz == user.Tz); if (u == null) { return(null); } user.Password = u.Password; user.UserName = u.UserName; } if (user.UserId != 0) { User u = new User(); u = context.Users.FirstOrDefault(p => p.UserId == user.UserId); if (u == null) { return(null); } user.Password = u.Password; user.UserName = u.UserName; } if (ExistUserInSql(user.Password, user.UserName)) { User currentUser = context.Users.FirstOrDefault(u => u.Password == user.Password && u.UserName == user.UserName); DetailsCandidate detailsCandidate = new DetailsCandidate(); detailsCandidate.User = Conversions.UserDaltoDTo(currentUser); Candidate c = context.Candidates.FirstOrDefault(ch => ch.UserId == currentUser.UserId); if (c != null) { detailsCandidate.Candidate = Conversions.CandidateDalToDto(c); } detailsCandidate.MigbalaCandidates = new List <MigbalaCandidateDTO>(); detailsCandidate.MigbalaCandidates.AddRange(Conversions.MigbalaCandidateListDALToDto(context.MigbalaCandidates.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.Children = new List <childrenDTO>(); detailsCandidate.Children.AddRange(Conversions.childrenListDALToDto(context.Children.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.Parents = new List <ParentDTO>(); detailsCandidate.Parents.AddRange(Conversions.ParentListDALToDto(context.Parents.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.Documents = new List <DocumentDTO>(); detailsCandidate.Documents.AddRange(Conversions.DocumentListDALToDto(context.Documents.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.ValueListCandidate = new List <ValueListCandidateDTO>(); detailsCandidate.ValueListCandidate.AddRange(Conversions.ValueListCandidateListDALToDto(context.ValueListCandidates.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.Hospitalizations = new List <HospitalizationDTO>(); detailsCandidate.Hospitalizations.AddRange(Conversions.HospitalizationListDALToDto(context.Hospitalizations.Where(ch => ch.UserId == currentUser.UserId).ToList())); detailsCandidate.Mechutanim = new List <MechutanimDTO>(); detailsCandidate.Mechutanim.AddRange(Conversions.MechutanimListDALToDto(context.Mechutanims.Where(ch => ch.UserId == currentUser.UserId).ToList())); return(detailsCandidate); } return(null); } }
}//פונקציה לניסוי!!!!!!!!!!!!!!!! public static void FinishCompliteDetails(DetailsCandidate dc) { using (shiduchimEntities context = new shiduchimEntities()) { Candidate c = Conversions.CandidateDtoToDal(dc.Candidate); c.EnterIn = 2; context.Entry(c).State = EntityState.Modified; context.SaveChanges(); } }
public static void finishCompliteDetails(DetailsCandidate dc)//פונקציה המטפלת בסיום השלמת פרטים של המועמד(נשלח ע"י השדכן) { CandidateUser.SaveDetailsCandidate(dc); context.Candidates.FirstOrDefault(p => p.UserId == dc.Candidate.UserId).EnterIn = 2; context.SaveChanges(); if (Search.search(dc) == true) { SendMail.addSuggesrToCandidateMail(dc.User.Mail); } }
public static bool SuitAbleCrit(DetailsCandidate dc, DetailsCandidate CurrentUser) { foreach (var VLC in dc.ValueListCandidate.Where(o => o.isSelf == false)) //מעבר על הקריטריונים של המועמד שמחפסים לו שידוך { if (getKindCriteron(VLC.CriteriaId) == 3) //אם זה ערך מספרי { var hisVLC = CurrentUser.ValueListCandidate.FirstOrDefault(p => p.CriteriaId == VLC.CriteriaId && p.isSelf == true); if (hisVLC.selfValue < VLC.satisfacMinValue || hisVLC.selfValue > VLC.satisfacMaxValue) { return(false); } } else if (VLC.CriteriaId == 32)//אם זה סוג מגבלה { foreach (var mig in CurrentUser.MigbalaCandidates) { if (mig.KindMigbala == VLC.ValueListId) { return(false); } } } else if (getKindCriteron(VLC.CriteriaId) == 1)//אם זה ערך מרשימת ערכים { List <ValueListCandidateDTO> currentUserVL = CurrentUser.ValueListCandidate.Where(p => p.CriteriaId == VLC.CriteriaId && p.isSelf == true).ToList(); if (currentUserVL.FirstOrDefault(p => p.ValueListId == VLC.ValueListId) != null && VLC.isInclude == false || currentUserVL.FirstOrDefault(p => p.ValueListId == VLC.ValueListId) == null && VLC.isInclude == true) { return(false); } } else if (getKindCriteron(VLC.CriteriaId) == 2)//אם זה ערך בוליאני { if (VLC.selfBool != CurrentUser.ValueListCandidate.FirstOrDefault(p => p.CriteriaId == VLC.CriteriaId && p.isSelf == true).satisfacBool) { return(false); } } } return(true); }
public IHttpActionResult saveDetailsCandidate(DetailsCandidate dc)//שמירת כל פרטי המועמד { BL.CandidateUser.SaveDetailsCandidate(dc); return(Ok("success")); }
public IHttpActionResult addDetailCandidate(DetailsCandidate dCandidate) { BL.CandidateUser.SaveDetailsCandidate(dCandidate); return(Ok("success")); }
public IHttpActionResult finishCompliteDetails(DetailsCandidate dc)//מטפל בסיום השלמת פרטים (אחרי שהשדכןמסים את השלמת הפרטים) { BL.matchMaker.finishCompliteDetails(dc); return(Ok("success")); }