Пример #1
0
        public IHttpActionResult PutSickLeave(int id, SickLeave sickLeave)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sickLeave.EmployeeId)
            {
                return(BadRequest());
            }

            db.Entry(sickLeave).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SickLeaveExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        private void Button_Save_Click(object sender, RoutedEventArgs e)
        {
            if (CheckDataCorrectness())
            {
                if (patient._PESEL == 0)
                {
                    patient._PESEL  = Convert.ToInt64(Input_PESELBox.Text);
                    patient._NIP    = Convert.ToInt64(Input_NIPBox.Text);
                    patient.Street  = Input_AddressBox.Text;
                    patient.Name    = Input_PatientFirstNameBox.Text;
                    patient.Surname = Input_PatientLastNameBox.Text;
                    patient.Gender  = Input_PatientGenderList.Text;
                    if (sickLeaveClass == null)
                    {
                        sickLeaveClass = new Classes.SickLeave(patient, this.Input_SickLeaveTypeList.Text, this.Input_SymptomsBox.Text, Convert.ToDateTime(this.Input_DateFromPicker.Text), Convert.ToDateTime(this.Input_DateToPicker.Text));
                    }

                    NavigationService.Navigate(new SickLeaveSendingPage(sickLeaveClass, false));
                }
                else
                {
                    if (sickLeaveClass == null)
                    {
                        sickLeaveClass = new Classes.SickLeave(patient, this.Input_SickLeaveTypeList.Text, this.Input_SymptomsBox.Text, Convert.ToDateTime(this.Input_DateFromPicker.Text), Convert.ToDateTime(this.Input_DateToPicker.Text));
                    }

                    NavigationService.Navigate(new SickLeaveSendingPage(sickLeaveClass, true));
                }
            }
        }
 /// <summary>
 /// Defines the table
 /// </summary>
 public static void DefineTables(Document document, SickLeave sickLeaveClass)
 {
     //document.LastSection.AddParagraph("Zwolnienie lekarskie", "Heading2");
     Paragraph paragraph = document.LastSection.AddParagraph();
     paragraph.Format.Alignment = ParagraphAlignment.Center;
     paragraph.AddFormattedText("Zwolnienie lekarskie", "Heading2");
     CreateTable(document, sickLeaveClass);
 }
Пример #4
0
        public ActionResult RejectSickLeave(int?id)
        {
            SickLeave payroll = db.SickLeaves.Find(id);

            payroll.Status          = Data_Access_Layer.Entities.Enums.Status.Reject;
            db.Entry(payroll).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #5
0
        public ActionResult DoctorSickLeave([FromForm] SickLeave sl)
        {
            var      patients = PatientTable.GetPatientById(patientId);
            DateTime time     = DateTime.Now.Date;
            string   date     = time.ToString("yyyy-MM-dd");

            SickLeaveTable.InsertD(patients[0].Id, Properties.UserId, sl.Days, sl.Description, date);

            return(RedirectToAction("Visit", "Doctor", new { id = Properties.VisitId }));
        }
Пример #6
0
 public static SickLeaveDTO GetSickLeaveDto(SickLeave sickLeave)
 {
     return(new SickLeaveDTO()
     {
         Id = sickLeave.Id,
         UserId = sickLeave.UserId,
         StartTime = sickLeave.StartTime,
         EndTime = sickLeave.EndTime
     });
 }
Пример #7
0
        public IHttpActionResult GetSickLeave(int id)
        {
            SickLeave sickLeave = db.SickLeaves.Find(id);

            if (sickLeave == null)
            {
                return(NotFound());
            }

            return(Ok(sickLeave));
        }
Пример #8
0
        public IHttpActionResult PostSickLeave(SickLeave sickLeave)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SickLeaves.Add(sickLeave);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = sickLeave.EmployeeId }, sickLeave));
        }
Пример #9
0
        public IHttpActionResult DeleteSickLeave(int id)
        {
            SickLeave sickLeave = db.SickLeaves.Find(id);

            if (sickLeave == null)
            {
                return(NotFound());
            }

            db.SickLeaves.Remove(sickLeave);
            db.SaveChanges();

            return(Ok(sickLeave));
        }
        /// <summary>
        /// Tworzy dokument 
        /// </summary>
        /// <param name="sickLeave">Klasa SickLeave przechowująca aktualnie wystawiane zwolnienie</param>
        /// <returns>Zwraca dokument</returns>
        public static Document CreateDocument(SickLeave sickLeave)
        {
            // Create a new MigraDoc document
            Document document = new Document();
            document.Info.Title = "Zwolnienie lekarskie";
            document.Info.Author = MainWindow.ReturnCurrentUser().ReturnName();

            DefineStyles(document);

            DefineContentSection(document);

            DefineTables(document, sickLeave);

            return document;
        }
Пример #11
0
        private void btnADD_Click(object sender, EventArgs e)
        {
            if (CARDHOLDERID == 0)
            {
                errorProvider1.SetError(cboxCARDHOLDER, "Please, choose the worker.");
                cboxCARDHOLDER.Focus();
                cboxCARDHOLDER.TextChanged += (s, ex) => { errorProvider1.SetError(cboxCARDHOLDER, ""); };
                return;
            }
            else
            {
                errorProvider1.SetError(cboxCARDHOLDER, "");
            }

            if (_context.SickLeaves.Where(j => j.Date == dateTimePicker1.Value.Date && j.CardholderID == CARDHOLDERID).Select(s => s.SickLeaveID).Count() != 0)
            {
                errorProvider1.SetError(dateTimePicker1, "Sick leave date has been already set. Please choose another date.");
                dateTimePicker1.Focus();
                dateTimePicker1.ValueChanged += (s, ex) => { errorProvider1.SetError(dateTimePicker1, ""); };
                return;
            }
            else
            {
                errorProvider1.SetError(dateTimePicker1, "");
            }


            try
            {
                var newSickLeave = new SickLeave();
                newSickLeave.CardholderID = CARDHOLDERID;
                newSickLeave.Date         = dateTimePicker1.Value.Date;

                _context.SickLeaves.AddObject(newSickLeave);
                _context.SaveChanges();

                MessageBox.Show("Sick leave has been successfully added.", "Successful",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                ListaSICKLEAVE         = _context.SickLeaves.OrderBy(o => o.Date).ToList();
                dgSICKLEAVE.DataSource = ListaSICKLEAVE.Where(j => j.CardholderID == CARDHOLDERID).ToList();
            }
            catch
            {
                MessageBox.Show("Something went wrong. Please try again or contact your administrator.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Пример #12
0
        public async Task <IActionResult> EmployeeSickLeave(SickLeave model)
        {
            if (ModelState.IsValid)
            {
                model.Id        = 0;
                model.HRManager = await _userManager.GetUserAsync(User);

                model.DateOfAction = DateTime.Now;
                await _context.SickLeaves.AddAsync(model);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(model));
        }
        public SickLeaveSendingPage(SickLeave sickLeave, bool send = true)
        {
            InitializeComponent();
            this.sickLeave = sickLeave;


            User user = MainWindow.ReturnCurrentUser();

            if (send)
            {
                new Thread(() => Send(user)).Start();
            }
            else
            {
                Reporter.AddRaport(user.ReturnName(), "Wystawienie zwolnienia bez wysyłania", null);
                createPDF();
            }
        }
Пример #14
0
 public static void UpdateSickLeaveFromDto(SickLeave sickLeaveToUpdate, SickLeaveForCreationDTO sickLeaveWithUpdatedValues)
 {
     sickLeaveToUpdate.UserId    = sickLeaveWithUpdatedValues.UserId;
     sickLeaveToUpdate.StartTime = sickLeaveWithUpdatedValues.StartTime;
     sickLeaveToUpdate.EndTime   = sickLeaveWithUpdatedValues.EndTime;
 }
Пример #15
0
 public static void InsertData(int doctorId, SickLeave sickleave)
 {
     Properties.dbContext.ExecuteQuery($@"INSERT INTO SickLeave (PatientId, DoctorId, Days, Description, Date) 
                                              VALUES ('" + sickleave.PatientId + "','" + doctorId + "','" +
                                       sickleave.Days + "','" + sickleave.Description + "',Now());");
 }
        /// <summary>
        /// Tworzy tabelki
        /// </summary>
        /// <param name="document"></param>
        /// <param name="sickLeaveClass"></param>
        public static void CreateTable(Document document, SickLeave sickLeaveClass)
        {
            Table table = new Table();
            table.Borders.Width = 0.75;

            Column column = table.AddColumn(Unit.FromCentimeter(5));
            //column.Format.Alignment = ParagraphAlignment.Center;

            table.AddColumn(Unit.FromCentimeter(10));

            Row row = table.AddRow();

            Cell cell = row.Cells[0];
            cell = row.Cells[0];
            cell.AddParagraph("Imię");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Patient.Name);

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Nazwisko");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Patient.Surname);

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Pesel");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Patient._PESEL.ToString());

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Płeć");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Patient.Gender);

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("NIP");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Patient._NIP.ToString());

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Miejsce zameldowania");
            cell = row.Cells[1];
            string hauseNumberToAdd = "";
            if (sickLeaveClass.Patient.HouseNumber != 0)
            {
                hauseNumberToAdd = sickLeaveClass.Patient.HouseNumber.ToString();
            }
            cell.AddParagraph($"{sickLeaveClass.Patient.Street} {hauseNumberToAdd} \n{sickLeaveClass.Patient.PostCode} {sickLeaveClass.Patient.City}");

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Typ zwolnienia");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.SickLeaveType);

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Powód zwolnienia (Objawy)");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.Symptoms);

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Zwolniony od");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.StartDate.ToShortDateString());

            row = table.AddRow();
            cell = row.Cells[0];
            cell.AddParagraph("Zwolniony do");
            cell = row.Cells[1];
            cell.AddParagraph(sickLeaveClass.EndDate.ToShortDateString());

            document.LastSection.Add(table);
        }
Пример #17
0
 public void DeleteSickLeave(SickLeave sickLeave)
 {
     _context.SickLeaves.Remove(sickLeave);
     SaveChanges();
 }
Пример #18
0
 public void AddSickLeave(SickLeave sickLeave)
 {
     _context.SickLeaves.Add(sickLeave);
     SaveChanges();
 }