public async Task <IActionResult> Edit(int id, [Bind("ComplicationID,ComplicationName,ComplicationInfo")] Complication complication)
        {
            if (id != complication.ComplicationID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(complication);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComplicationExists(complication.ComplicationID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(complication));
        }
        public async Task <IActionResult> Create([Bind("ComplicationID,ComplicationName,ComplicationInfo")] Complication complication)
        {
            if (ModelState.IsValid)
            {
                _context.Add(complication);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(complication));
        }
Esempio n. 3
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Procedure;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Procedure.ProcedureStatus>)StatusElement.DeepCopy();
                }
                if (Category != null)
                {
                    dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy();
                }
                if (Code != null)
                {
                    dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
                }
                if (NotPerformedElement != null)
                {
                    dest.NotPerformedElement = (Hl7.Fhir.Model.FhirBoolean)NotPerformedElement.DeepCopy();
                }
                if (ReasonNotPerformed != null)
                {
                    dest.ReasonNotPerformed = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonNotPerformed.DeepCopy());
                }
                if (BodySite != null)
                {
                    dest.BodySite = new List <Hl7.Fhir.Model.CodeableConcept>(BodySite.DeepCopy());
                }
                if (Reason != null)
                {
                    dest.Reason = (Hl7.Fhir.Model.Element)Reason.DeepCopy();
                }
                if (Performer != null)
                {
                    dest.Performer = new List <Hl7.Fhir.Model.Procedure.PerformerComponent>(Performer.DeepCopy());
                }
                if (Performed != null)
                {
                    dest.Performed = (Hl7.Fhir.Model.Element)Performed.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Location != null)
                {
                    dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopy();
                }
                if (Outcome != null)
                {
                    dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopy();
                }
                if (Report != null)
                {
                    dest.Report = new List <Hl7.Fhir.Model.ResourceReference>(Report.DeepCopy());
                }
                if (Complication != null)
                {
                    dest.Complication = new List <Hl7.Fhir.Model.CodeableConcept>(Complication.DeepCopy());
                }
                if (FollowUp != null)
                {
                    dest.FollowUp = new List <Hl7.Fhir.Model.CodeableConcept>(FollowUp.DeepCopy());
                }
                if (Request != null)
                {
                    dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy();
                }
                if (Notes != null)
                {
                    dest.Notes = new List <Hl7.Fhir.Model.Annotation>(Notes.DeepCopy());
                }
                if (FocalDevice != null)
                {
                    dest.FocalDevice = new List <Hl7.Fhir.Model.Procedure.FocalDeviceComponent>(FocalDevice.DeepCopy());
                }
                if (Used != null)
                {
                    dest.Used = new List <Hl7.Fhir.Model.ResourceReference>(Used.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            bool showTree   = false;
            var  _variables = new Dictionary <string, object>();

            while (true)
            {
                Console.Write("> ");
                var line = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(line))
                {
                    return;
                }

                if (line == "#showTree")
                {
                    showTree = !showTree;
                    Console.WriteLine(showTree ? "Showing parse trees." : "Not showing parse trees");
                    continue;
                }
                else if (line == "#cls")
                {
                    Console.Clear();
                    continue;
                }

                var syntaxTree = SyntaxTree.Parse(line);
                var comp       = new Complication(syntaxTree);
                var result     = comp.evaluate(_variables);

                if (showTree)
                {
                    var color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    PrettyPrint(syntaxTree.Root);
                    Console.ResetColor();
                }

                if (!result.Diagnostics.Any())
                {
                    Console.WriteLine(result.Value);
                }
                else
                {
                    foreach (var diagnostic in result.Diagnostics)
                    {
                        Console.WriteLine();

                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine(diagnostic);
                        Console.ResetColor();

                        var prefix = line.Substring(0, diagnostic.Span.Start);
                        var error  = line.Substring(diagnostic.Span.Start, diagnostic.Span.Length);
                        var suffix = line.Substring(diagnostic.Span.End);

                        Console.Write("    ");
                        Console.Write(prefix);

                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.Write(error);
                        Console.ResetColor();

                        Console.Write(suffix);

                        Console.WriteLine();
                    }
                    Console.WriteLine();
                    // Console.ForegroundColor=ConsoleColor.DarkRed;

                    // foreach (var diagnostic in result.Diagnostics)
                    //     Console.WriteLine(diagnostic);

                    // Console.ResetColor();
                }
            }
        }
Esempio n. 5
0
        public static void Initialize(AgrarianContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.VillageCouncils.Any())
            {
                return;   // DB has been seeded
            }

            var villageCounsils = new VillageCouncil[]
            {
                new VillageCouncil {
                    VCName = "Бабин"
                },
                new VillageCouncil {
                    VCName = "Лубни"
                },
                new VillageCouncil {
                    VCName = "Пирятин"
                }
            };

            foreach (VillageCouncil vc in villageCounsils)
            {
                context.VillageCouncils.Add(vc);
            }
            context.SaveChanges();

            var fields = new Field[]
            {
                new Field {
                    FieldName = 11, VCID = 1
                },
                new Field {
                    FieldName = 12, VCID = 1
                },
                new Field {
                    FieldName = 13, VCID = 1
                },
                new Field {
                    FieldName = 14, VCID = 1
                },
                new Field {
                    FieldName = 21, VCID = 2
                },
                new Field {
                    FieldName = 22, VCID = 2
                },
                new Field {
                    FieldName = 23, VCID = 2
                },
                new Field {
                    FieldName = 24, VCID = 2
                },
                new Field {
                    FieldName = 25, VCID = 2
                },
                new Field {
                    FieldName = 31, VCID = 3
                },
                new Field {
                    FieldName = 32, VCID = 3
                }
            };

            foreach (Field f in fields)
            {
                context.Fields.Add(f);
            }
            context.SaveChanges();

            var complications = new Complication[]
            {
                new Complication {
                    ComplicationName = "немає", ComplicationInfo = ""
                },
                new Complication {
                    ComplicationName = "болото", ComplicationInfo = ""
                },
                new Complication {
                    ComplicationName = "ліс", ComplicationInfo = ""
                },
                new Complication {
                    ComplicationName = "рельєф", ComplicationInfo = ""
                }
            };

            foreach (Complication c in complications)
            {
                context.Complications.Add(c);
            }
            context.SaveChanges();

            var shares = new Share[]
            {
                new Share {
                    ShareName = 111, FiledID = 1, ComplicationID = 1, ShareArea = 6.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2345"
                },
                new Share {
                    ShareName = 112, FiledID = 1, ComplicationID = 1, ShareArea = 7.05, ShareRealArea = 7.00, ShareCN = "1234567891:34:345:2346"
                },
                new Share {
                    ShareName = 113, FiledID = 2, ComplicationID = 1, ShareArea = 8.05, ShareRealArea = 8.00, ShareCN = "1234567891:34:345:2347"
                },
                new Share {
                    ShareName = 114, FiledID = 2, ComplicationID = 2, ShareArea = 5.05, ShareRealArea = 4.05, ShareCN = "1234567891:34:345:2348"
                },
                new Share {
                    ShareName = 211, FiledID = 2, ComplicationID = 1, ShareArea = 2.05, ShareRealArea = 1.05, ShareCN = "1234567891:34:345:2349"
                },
                new Share {
                    ShareName = 212, FiledID = 3, ComplicationID = 1, ShareArea = 5.45, ShareRealArea = 3.05, ShareCN = "1234567891:34:345:2323"
                },
                new Share {
                    ShareName = 311, FiledID = 4, ComplicationID = 1, ShareArea = 7.45, ShareRealArea = 7.45, ShareCN = "1234567891:34:345:2324"
                },
                new Share {
                    ShareName = 411, FiledID = 5, ComplicationID = 3, ShareArea = 2.05, ShareRealArea = 2.05, ShareCN = "1234567891:34:345:2325"
                },
                new Share {
                    ShareName = 234, FiledID = 5, ComplicationID = 1, ShareArea = 6.35, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2326"
                },
                new Share {
                    ShareName = 345, FiledID = 6, ComplicationID = 1, ShareArea = 34.5, ShareRealArea = 34.5, ShareCN = "1234567891:34:345:2327"
                },
                new Share {
                    ShareName = 657, FiledID = 7, ComplicationID = 1, ShareArea = 3.05, ShareRealArea = 3.05, ShareCN = "1234567891:34:345:2328"
                },
                new Share {
                    ShareName = 745, FiledID = 8, ComplicationID = 1, ShareArea = 4.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2329"
                },
                new Share {
                    ShareName = 239, FiledID = 9, ComplicationID = 2, ShareArea = 6.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2330"
                },
                new Share {
                    ShareName = 269, FiledID = 9, ComplicationID = 1, ShareArea = 6.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2331"
                },
                new Share {
                    ShareName = 568, FiledID = 9, ComplicationID = 1, ShareArea = 1.05, ShareRealArea = 1.05, ShareCN = "1234567891:34:345:2332"
                },
                new Share {
                    ShareName = 340, FiledID = 10, ComplicationID = 4, ShareArea = 3.05, ShareRealArea = 3.05, ShareCN = "1234567891:34:345:2333"
                },
                new Share {
                    ShareName = 415, FiledID = 10, ComplicationID = 1, ShareArea = 4.05, ShareRealArea = 4.05, ShareCN = "1234567891:34:345:2334"
                },
                new Share {
                    ShareName = 336, FiledID = 10, ComplicationID = 1, ShareArea = 8.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2335"
                },
                new Share {
                    ShareName = 444, FiledID = 10, ComplicationID = 3, ShareArea = 3.05, ShareRealArea = 3.05, ShareCN = "1234567891:34:345:2336"
                },
                new Share {
                    ShareName = 555, FiledID = 11, ComplicationID = 1, ShareArea = 6.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2337"
                },
                new Share {
                    ShareName = 666, FiledID = 11, ComplicationID = 1, ShareArea = 4.05, ShareRealArea = 4.05, ShareCN = "1234567891:34:345:2338"
                },
                new Share {
                    ShareName = 777, FiledID = 11, ComplicationID = 1, ShareArea = 6.05, ShareRealArea = 6.05, ShareCN = "1234567891:34:345:2339"
                }
            };

            foreach (Share sh in shares)
            {
                context.Shares.Add(sh);
            }
            context.SaveChanges();

            var landLords = new LandLord[]
            {
                new LandLord {
                    LLName = "Ткаленко Наталія Павлівна", LLPassID = "1234567891", LLPhone = "+380501234567", LLAdress = "Київ"
                },
                new LandLord {
                    LLName = "Іванчук Віктор Сергійович", LLPassID = "1234567892", LLPhone = "+380502234567", LLAdress = "Київ"
                },
                new LandLord {
                    LLName = "Мельник Іван Степанович", LLPassID = "1234567893", LLPhone = "+380503234567", LLAdress = "ЛЬвів"
                },
                new LandLord {
                    LLName = "Пшенична Любов Олександрівна", LLPassID = "1234567894", LLPhone = "+380504234567", LLAdress = "Львів"
                },
                new LandLord {
                    LLName = "Панасюк Антоніна Ярославівна", LLPassID = "1234567895", LLPhone = "+380505234567", LLAdress = "Тернопіль"
                },
                new LandLord {
                    LLName = "Максимчук Олександр Григорович", LLPassID = "1234567896", LLPhone = "+380506234567", LLAdress = "Тернопіль"
                },
                new LandLord {
                    LLName = "Абрамчук Віталій Ігорович", LLPassID = "1234567897", LLPhone = "+380507234567", LLAdress = "Тернопіль"
                },
                new LandLord {
                    LLName = "Василенко Ігор Васильвоич", LLPassID = "1234567898", LLPhone = "+380508234567", LLAdress = "Суми"
                },
                new LandLord {
                    LLName = "Дивак Галина Володимирівна", LLPassID = "1234567899", LLPhone = "+380509234567", LLAdress = "Суми"
                },
                new LandLord {
                    LLName = "Ковальчук Олег Павлович", LLPassID = "1234567811", LLPhone = "+380501034567", LLAdress = "Суми"
                }
            };

            foreach (LandLord ll in landLords)
            {
                context.LandLords.Add(ll);
            }
            context.SaveChanges();



            var contracts = new Contract[]
            {
                new Contract {
                    LLID = 1, ShareID = 1, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 1, ShareID = 2, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 1, ShareID = 3, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 2, ShareID = 4, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 2, ShareID = 5, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 2, ShareID = 6, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 3, ShareID = 7, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 3, ShareID = 8, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 4, ShareID = 9, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 4, ShareID = 10, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 5, ShareID = 11, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 5, ShareID = 12, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 6, ShareID = 13, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 6, ShareID = 14, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 7, ShareID = 15, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 7, ShareID = 16, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 8, ShareID = 17, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 8, ShareID = 18, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 9, ShareID = 19, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 9, ShareID = 20, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 10, ShareID = 21, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
                new Contract {
                    LLID = 10, ShareID = 22, ContractBegin = DateTime.Parse("2018-09-01"), ContractEnd = DateTime.Parse("2023-09-01")
                },
            };

            foreach (Contract c in contracts)
            {
                context.Contracts.Add(c);
            }
            context.SaveChanges();
        }
Esempio n. 6
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Procedure;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (BodySite != null)
                {
                    dest.BodySite = new List <Hl7.Fhir.Model.CodeableConcept>(BodySite.DeepCopy());
                }
                if (Indication != null)
                {
                    dest.Indication = new List <Hl7.Fhir.Model.CodeableConcept>(Indication.DeepCopy());
                }
                if (Performer != null)
                {
                    dest.Performer = new List <Hl7.Fhir.Model.Procedure.ProcedurePerformerComponent>(Performer.DeepCopy());
                }
                if (Date != null)
                {
                    dest.Date = (Hl7.Fhir.Model.Period)Date.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (OutcomeElement != null)
                {
                    dest.OutcomeElement = (Hl7.Fhir.Model.FhirString)OutcomeElement.DeepCopy();
                }
                if (Report != null)
                {
                    dest.Report = new List <Hl7.Fhir.Model.ResourceReference>(Report.DeepCopy());
                }
                if (Complication != null)
                {
                    dest.Complication = new List <Hl7.Fhir.Model.CodeableConcept>(Complication.DeepCopy());
                }
                if (FollowUpElement != null)
                {
                    dest.FollowUpElement = (Hl7.Fhir.Model.FhirString)FollowUpElement.DeepCopy();
                }
                if (RelatedItem != null)
                {
                    dest.RelatedItem = new List <Hl7.Fhir.Model.Procedure.ProcedureRelatedItemComponent>(RelatedItem.DeepCopy());
                }
                if (NotesElement != null)
                {
                    dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Esempio n. 7
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Procedure;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Procedure.ProcedureStatus>)StatusElement.DeepCopy();
                }
                if (Category != null)
                {
                    dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy();
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (BodySite != null)
                {
                    dest.BodySite = new List <Hl7.Fhir.Model.Procedure.ProcedureBodySiteComponent>(BodySite.DeepCopy());
                }
                if (Indication != null)
                {
                    dest.Indication = new List <Hl7.Fhir.Model.CodeableConcept>(Indication.DeepCopy());
                }
                if (Performer != null)
                {
                    dest.Performer = new List <Hl7.Fhir.Model.Procedure.ProcedurePerformerComponent>(Performer.DeepCopy());
                }
                if (Performed != null)
                {
                    dest.Performed = (Hl7.Fhir.Model.Element)Performed.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Location != null)
                {
                    dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopy();
                }
                if (Outcome != null)
                {
                    dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopy();
                }
                if (Report != null)
                {
                    dest.Report = new List <Hl7.Fhir.Model.ResourceReference>(Report.DeepCopy());
                }
                if (Complication != null)
                {
                    dest.Complication = new List <Hl7.Fhir.Model.CodeableConcept>(Complication.DeepCopy());
                }
                if (FollowUp != null)
                {
                    dest.FollowUp = new List <Hl7.Fhir.Model.CodeableConcept>(FollowUp.DeepCopy());
                }
                if (RelatedItem != null)
                {
                    dest.RelatedItem = new List <Hl7.Fhir.Model.Procedure.ProcedureRelatedItemComponent>(RelatedItem.DeepCopy());
                }
                if (NotesElement != null)
                {
                    dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                }
                if (Device != null)
                {
                    dest.Device = new List <Hl7.Fhir.Model.Procedure.ProcedureDeviceComponent>(Device.DeepCopy());
                }
                if (Used != null)
                {
                    dest.Used = new List <Hl7.Fhir.Model.ResourceReference>(Used.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }