public async static Task <List <Group> > checkOpenGroupAndConfirm(string phone) { var d = 0; List <Group> groups = await GroupS.getAllGroupUseUsewr(phone);//כל הקבוצות שהמשתמש רשום עליהם List <Group> send = new List <Group>(); foreach (var item in groups) { if (item.Status == true && item.DateBeginTrip <= DateTime.Now && item.DateEndTrip >= DateTime.Now) { foreach (var item1 in item.OkUsers) { UserProfile user = await conectDB.getUser(item1.UserPhoneGroup); if (user.Phone == phone) { d = 1; } } if (d == 0) { send.Add(item); } } } return(send); }
public async static Task <bool> sendHelpMessage(string phone) { var allGroup = await conectDB.getAllGroup(); var fromUser = await conectDB.getUser(phone); var group = allGroup.Where(p => p.Users.Find(pp => pp.UserPhoneGroup == phone) != null).ToList(); foreach (var item in group) { foreach (var item1 in item.ListManagment) { var user = await conectDB.getUser(item1.PhoneManagment); await conectDB.setNewErrorToUser(user, item.ErrorMessage.Find(ppp => ppp.CodeError == 8), item); await GroupS.sendEmail(fromUser, user, item, item.ErrorMessage.Find(ppp => ppp.CodeError == 8).MessageError); } } return(true); }