コード例 #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            AccidentCode accidentCode = _accidentCodeService.GetAccidentCode(id);

            _accidentCodeService.Delete(accidentCode);
            _accidentCodeService.SaveAccidentCode();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "AccidentCodeID,Description")] AccidentCode accidentCode)
 {
     if (ModelState.IsValid)
     {
         _accidentCodeService.Update(accidentCode);
         _accidentCodeService.SaveAccidentCode();
         return(RedirectToAction("Index"));
     }
     return(View(accidentCode));
 }
コード例 #3
0
        // GET: AccidentCode/Edit/A
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AccidentCode accidentCode = _accidentCodeService.GetAccidentCode(id);

            if (accidentCode == null)
            {
                return(HttpNotFound());
            }
            return(View(accidentCode));
        }
コード例 #4
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 7, Configuration.FieldSeparator),
                       Id,
                       AccidentDateTime.HasValue ? AccidentDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       AccidentCode?.ToDelimitedString(),
                       AccidentLocation,
                       AutoAccidentState?.ToDelimitedString(),
                       AccidentJobRelatedIndicator,
                       AccidentDeathIndicator
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #5
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 13, Configuration.FieldSeparator),
                       Id,
                       AccidentDateTime.HasValue ? AccidentDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       AccidentCode?.ToDelimitedString(),
                       AccidentLocation,
                       AutoAccidentState?.ToDelimitedString(),
                       AccidentJobRelatedIndicator,
                       AccidentDeathIndicator,
                       EnteredBy?.ToDelimitedString(),
                       AccidentDescription,
                       BroughtInBy,
                       PoliceNotifiedIndicator,
                       AccidentAddress?.ToDelimitedString(),
                       DegreeOfPatientLiability.HasValue ? DegreeOfPatientLiability.Value.ToString(Consts.NumericFormat, culture) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
コード例 #6
0
 public void Delete(AccidentCode accidentCode)
 {
     _accidentCodeRepository.Delete(accidentCode);
 }
コード例 #7
0
 public void Update(AccidentCode accidentCode)
 {
     _accidentCodeRepository.Update(accidentCode);
 }
コード例 #8
0
 public void CreateAccidentCode(AccidentCode accidentCode)
 {
     _accidentCodeRepository.Add(accidentCode);
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: tomt-medsphere/PM3
        private static void Main()
        {
            using (var ctx = new Pm3Entities())
            {
                // create and seed the db
                ctx.Database.Initialize(true);

                // load elements to use AccidentCodeService
                var dbf = new DbFactory();
                var acr = new AccidentCodeRepository(dbf);
                var ui  = new UnitOfWork(dbf);
                var acs = new AccidentCodeService(acr, ui);

                // add a code to our table
                if (acs.GetAccidentCode("E") == null)
                {
                    var ac = new AccidentCode
                    {
                        AccidentCodeId = "E",
                        Description    = "E description"
                    };
                    acs.CreateAccidentCode(ac);
                    acs.SaveAccidentCode();
                }
                else
                {
                    AccidentCode accidentCode = acs.GetAccidentCode("E");
                    accidentCode.Description = "Some Other New description for E";
                    acs.Update(accidentCode);
                    acs.SaveAccidentCode();
                }

                // list the codes in the table
                var aclist = acs.GetAccidentCodes();
                foreach (var aci in aclist)
                {
                    Console.WriteLine($"ac: {aci.AccidentCodeId} - {aci.Description}");
                }

                Pm3Entities pe  = new Pm3Entities();
                PrepRule    pr1 = new PrepRule {
                    Description = "test1"
                };
                pr1.RuleMessage = "test1";
                pr1.Warning     = false;
                pr1.HardCoded   = false;

                PrepRule pr2 = new PrepRule();
                pr2.Description = "test2";
                pr2.RuleMessage = "test2";
                pr2.Warning     = false;
                pr2.HardCoded   = false;


                pe.PrepRule.Add(pr1);
                pe.PrepRule.Add(pr2);

                pe.Commit();
            }
            // all done
            Console.WriteLine("Goodbye from PM3!");
            Console.ReadLine();
        }