public async Task <IActionResult> PostHealthDeclarationAsync([FromBody] HealthDeclaration request) { //EntityTypeId=2 עובדים //EntityTypeId=11 מבקרים //מבקר בינתיים יכול להיות ריק // אם הוא לא מקושר לטבלת מבקרים var entity = request; entity.Date = DateTime.Now.Date; var response = await HealthService.CreateHealthDeclarationAsync(entity); var Alert = new Alerts(); Alert.EntityId = request.EntityId; Alert.EntityTypeId = request.EntityTypeId; // עובדים Alert.AlertTypeId = 7; //הצהרת בריאות Alert.SiteId = request.SiteId; var responseAlert = await AlertService.GetAlertAsync(Alert); if (responseAlert.Model != null) { responseAlert.Model.AlertStatusId = 2;//נקרא await AlertService.UpdateAlertAsync(responseAlert.Model); } return(response.ToHttpResponse()); }
private static void FillHealthDeclaration() { var donor = new Donor(Guid.NewGuid(), false, BloodType.ABn); var bloodDonation = bloodBank.StartBloodDonation(donor); var questionaire = AnswerQuestionaire(donor); var healthDeclaration = new HealthDeclaration(questionaire); bloodDonation.AddHealthDeclaration(healthDeclaration); if (questionaire.IsBlocked) { Console.WriteLine("You can not give blood:"); Console.WriteLine(questionaire.BlockReason); bloodBank.AbortDonation(bloodDonation); throw new Exception(); } }
private static void FillInMedicine(HealthDeclaration healthDeclaration) { while (true) { } }
public static EmployeeResponse ToEntity(this Employee request, PhoneMail phone, Docs docsFaceImage, Docs docsCopyPassport, Docs docsCopyofID, EquipmenAtSite equipmenAtSite, SiteEmployee siteEmployee, EmplyeePicture emplyeePicture = null, HealthDeclaration healthDeclaration = null) => new EmployeeResponse { EmployeeId = request.EmployeeId, IdentificationTypeId = request.IdentificationTypeId, IdentityNumber = request.IdentityNumber, PassportCountryId = request.PassportCountryId, FirstName = request.FirstName, LastName = request.LastName, FirstNameEn = request.FirstNameEn, LastNameEn = request.LastNameEn, OrganizationId = request.OrganizationId, BirthDate = request.BirthDate, GenderId = request.GenderId, Citizenship = request.Citizenship, UserInsert = request.UserInsert, DateInsert = request.DateInsert, UserUpdate = request.UserUpdate, DateUpdate = request.DateUpdate, State = request.State, Address = request.Address, Gender = request.Gender, IdentificationType = request.IdentificationType, Organization = request.Organization, PassportCountry = request.PassportCountry, EmployeeTraining = request.EmployeeTraining.Count > 0 ? new TrainingResponse((request.EmployeeTraining.Max(x => x.DateTo).Value.Date - DateTime.Now.Date).Days, "תדריך בטיחות") : new TrainingResponse(0, "תדריך בטיחות"), EmployeeAuthtorization = request.EmployeeAuthtorization.Count > 0 ? new TrainingResponse((request.EmployeeAuthtorization.Max(x => x.DateTo).Value.Date - DateTime.Now.Date).Days, "אישור עבודה בגובה"): new TrainingResponse(0, "אישור עבודה בגובה"), EmployeeWorkPermit = request.IdentificationTypeId == 1 || request.IdentificationTypeId == null ? new TrainingResponse(100, "היתר עבודה") :request.EmployeeWorkPermit.Count > 0 ? new TrainingResponse((request.EmployeeWorkPermit.Max(x => x.DateTo).Value.Date - DateTime.Now.Date).Days, "היתר עבודה"): new TrainingResponse(0, "היתר עבודה"), phonMail = phone, ProffesionType = request.EmployeeProffesionType.Count > 0? request.EmployeeProffesionType.First().ProffesionType:null, picturePath = docsFaceImage == null ? null: docsFaceImage.DocumentPath, IdentityFilePath = docsCopyofID == null ? null : docsCopyofID.DocumentPath, PassportFilePath = docsCopyPassport == null ? null : docsCopyPassport.DocumentPath, isEmployeeEntry = equipmenAtSite != null,//אם יש כניסה לאתר SiteId = siteEmployee == null ? null : siteEmployee.SiteId, EmployeePicture = emplyeePicture, HealthDeclaration = healthDeclaration, isHealthDeclaration = healthDeclaration == null ? false : true };
public static EmployeeResponse ToEntity(this HealthDeclaration request) => new EmployeeResponse { FirstName = request.FullName };
// get public async Task <SingleResponse <HealthDeclaration> > GetHealthDeclarationAsync(HealthDeclaration healthDeclaration) { var response = new SingleResponse <HealthDeclaration>(); response.Model = await DbContext.GetHealthDeclarationAsync(healthDeclaration).FirstOrDefaultAsync(); return(response); }
// POST public async Task <SingleResponse <HealthDeclaration> > CreateHealthDeclarationAsync(HealthDeclaration healthDeclaration) { var response = new SingleResponse <HealthDeclaration>(); DbContext.Add(healthDeclaration, UserInfo); await DbContext.SaveChangesAsync(); response.Model = healthDeclaration; return(response); }
public static IQueryable <EmployeeResponse> GetVisitHealthDeclarationAsync(this MastpenBitachonDbContext dbContext, HealthDeclaration entity) { var query = from h in dbContext.HealthDeclaration.Where(item => item.EntityId == null) .Where(item => item.EntityTypeId == null) .Where(item => item.SiteId == entity.SiteId) .Where(item => item.Date == DateTime.Now.Date) select h.ToEntity(); return(query); }
public static IQueryable <HealthDeclaration> GetHealthDeclarationAsync(this MastpenBitachonDbContext dbContext, HealthDeclaration entity) => dbContext.HealthDeclaration.Where(item => item.EntityId == entity.EntityId) .Where(item => item.EntityTypeId == entity.EntityTypeId) .Where(item => item.Date == DateTime.Now.Date).AsQueryable();