Ejemplo n.º 1
0
        // GET: CaseRecords/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            CaseRecord caseRecord;

            if (id == null)
            {
                //return NotFound();
                caseRecord = new CaseRecord();
                _context.Add(caseRecord);
                await _context.SaveChangesAsync();

                caseRecord = await _context.CaseRecords.FindAsync(caseRecord.CaseRecordId);
            }
            else
            {
                caseRecord = await _context.CaseRecords.FindAsync(id);

                //caseRecord = await _context.CaseRecords.Include(p => p.LabCases).FirstOrDefaultAsync(p => p.CaseRecordId == id);
            }

            if (caseRecord == null)
            {
                return(NotFound());
            }
            ViewData["DiagId"]    = new SelectList(_context.Diags.Where(p => p.Deleted != true || p.DiagId == caseRecord.DiagId), "DiagId", "NameDiag", caseRecord.DiagId);
            ViewData["DoctorsId"] = new SelectList(_context.Doctors.Where(p => p.Deleted != true || p.DoctorId == caseRecord.DoctorsId), "DoctorId", "Doctor", caseRecord.DoctorsId);
            ViewData["LabId"]     = new SelectList(_context.Labs.Where(p => p.Deleted != true), "LabId", "LabName");
            return(View(caseRecord));
        }
Ejemplo n.º 2
0
        public DigestTestCases ( )        
        {
            const int LABEL_ROW = 1;
            const int FIELD_FILE_NAME = ArrayInfo.ARRAY_FIRST_ELEMENT;
            const int FIELD_EXPECTED_DIGEST = FIELD_FILE_NAME + MagicNumbers.PLUS_ONE;
            const int TOTAL_FIELDS = FIELD_EXPECTED_DIGEST + MagicNumbers.PLUS_ONE;

            const string TEST_CASE_FILENAME = @"DigestMD5TestCases.TXT";

            try
            {
                string [ ] astrCases = Utl.LoadTextFileFromEntryAssembly ( TEST_CASE_FILENAME );
                   
                int intNRecords = astrCases.Length;

                if ( intNRecords > LABEL_ROW )
                {   // File contains detail records.
                    _lstCaseRecords = new List<CaseRecord> ( intNRecords - LABEL_ROW );

                    for ( int intRecordNumber = LABEL_ROW ; intRecordNumber < intNRecords ; intRecordNumber++ )
                    {   // Skipping the label row, which is for human consumption, populate the list from the data records.
                        string [ ] astrFields = astrCases [ intRecordNumber ].Split ( new char [ ] { SpecialCharacters.TAB_CHAR } );

                        if ( astrFields.Length == TOTAL_FIELDS )
                        {
                            CaseRecord cr = new CaseRecord ( );
                            cr.strFileName = astrFields [ FIELD_FILE_NAME ];
                            cr.strDigest = astrFields [ FIELD_EXPECTED_DIGEST ];
                            _lstCaseRecords.Add ( cr );
                        }
                        else
                        {
                            throw new ArgumentException (
                                string.Format (
                                INVALID_RECORD ,
                                TEST_CASE_FILENAME ,
                                intRecordNumber ) );
                        }   // if ( astrFields.Length == EXPECTED_FIELD_COUNT )
                    }   // for ( int intRecordNumber = LABEL_ROW ; intRecordNumber < intNRecords ; intNRecords++ )
                }
                else
                {   // File is empty.
                    throw new ArgumentException ( 
                        string.Format (
                            EMPTY ,
                            TEST_CASE_FILENAME ) );
                }   // if ( intNRecords > LABEL_ROW )
            }
            catch
            {
                throw;
            }
        }   // public DigestTestCases
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("CaseRecordId,DiagId,DoctorsId,Fio,DateBirth,Sex,Contacts,Adds,Job,CompDiag,NumCase,DetectCaseY,DetectFormationY,DetectDetails,Complaints,Obesity,DisorderCarbo,ArterHypert,DisorderPcm,Visual,Igh,Operation,Postoper,SvzkNpvaA,SvzkPnvA,SvzkLnvA,SvzkNpvbA,SvzkNpvaK,SvzkPnvK,SvzkLnvK,SvzkNpvbK")] CaseRecord caseRecord)
        {
            if (ModelState.IsValid)
            {
                _context.Add(caseRecord);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DiagId"]    = new SelectList(_context.Diags, "DiagId", "NameDiag", caseRecord.DiagId);
            ViewData["DoctorsId"] = new SelectList(_context.Doctors, "DoctorId", "Doctor", caseRecord.DoctorsId);
            return(View(caseRecord));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseRecordId,DiagId,DoctorsId,Fio,DateBirth,Sex,Contacts,Adds,Job,CompDiag,NumCase,DetectCaseY,DetectFormationY,DetectDetails,Complaints,Obesity,DisorderCarbo,ArterHypert,DisorderPcm,Visual,Igh,Operation,Postoper,SvzkNpvaA,SvzkPnvA,SvzkLnvA,SvzkNpvbA,SvzkNpvaK,SvzkPnvK,SvzkLnvK,SvzkNpvbK")] CaseRecord caseRecord)
        {
            if (id == 0)
            {
                id = caseRecord.CaseRecordId;
            }
            else
            {
                if (id != caseRecord.CaseRecordId)
                {
                    return(NotFound());
                }
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caseRecord);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CaseRecordExists(caseRecord.CaseRecordId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Home"));
            }
            ViewData["DiagId"]    = new SelectList(_context.Diags, "DiagId", "NameDiag", caseRecord.DiagId);
            ViewData["DoctorsId"] = new SelectList(_context.Doctors, "DoctorId", "Doctor", caseRecord.DoctorsId);
            return(View(caseRecord));
        }