Exemple #1
0
        public JsonResult GetMedia(int id)
        {
            var folder = Umbraco.TypedMedia(id);

            if (folder != null)
            {
                if (folder.ContentType.Alias != "Folder")
                {
                    if (folder.Parent != null)
                    {
                        id     = folder.Parent.Id;
                        folder = Umbraco.TypedMedia(folder.Parent.Id);
                    }
                    else
                    {
                        id = -1;
                    }
                }

                if (id != -1)
                {
                    PopulateParents(folder);
                }
            }

            using (var db = DatabaseContext.Database)
            {
                var sql = "SELECT MIN(n.id) as id ,MIN(n.parentID) as parentId ,MIN(n.sortOrder) as sortOrder,MIN(n.text) as text,MIN(cmsContent.contentType) as contentType,MIN(cast(cmsPropertyData.dataNtext as varchar(max))) as src1, MIN(cast(cmsPropertyData.dataNvarchar as varchar(max))) as src2 FROM umbracoNode as n " +
                          "INNER JOIN cmsContent ON n.id=cmsContent.nodeId  " +
                          "RIGHT JOIN cmsPropertyData ON n.id=cmsPropertyData.contentNodeId " +
                          "WHERE nodeObjectType = 'B796F64C-1F99-4FFB-B886-4BF4BC011A9C' AND  " +
                          "trashed = 0 AND " +
                          "(cmsPropertyData.propertytypeid = 6 OR cmsPropertyData.propertytypeid = 27 OR cmsPropertyData.propertytypeid = 24)  AND " +
                          "(cmsContent.contentType = 1031 OR cmsContent.contentType = 1032 OR cmsContent.contentType = 1033) AND " +
                          "parentId = " + id + " GROUP BY n.id";

                var items = db.Fetch <CanvasMedia>(sql);

                return(Json(new { items = items, history = Parents.OrderBy(x => x.level) }));
            }
        }
Exemple #2
0
        /// <summary>
        /// To set up a SharePoint hierarchy of web apps, site collections and webs, this method sets up the hierarchy tree
        /// </summary>
        /// <param name="parentOfThisParent">the parent container of this parent in the sharepoint hierarchy</param>
        /// <param name="parent">SharePoint container to add to hierarchy</param>
        /// <param name="hasChildren">if this container itself has children, new entry is created in hierarchy collection</param>
        private void AddParentToHierarchyAndParentsList(Guid parentOfThisParent, FeatureParent parent, bool hasChildren)
        {
            if (parent == null)
            {
                return;
            }

            // add to parents list
            Parents.Add(parent);

            //if (SharePointParentHierarchy.ContainsKey(parentOfThisParent))
            //{
            SharePointParentHierarchy[parentOfThisParent].Add(parent);
            //}


            if (hasChildren)
            {
                SharePointParentHierarchy.Add(parent.Id, new List <FeatureParent>());
            }
        }
        private void DetachParent(Parents parents)
        {
            switch (parents)
            {
            case Parents.Father:
                SelectedFather = null;
                break;

            case Parents.Mother:
                SelectedMother = null;
                break;

            case Parents.Other:
                OtherParentText = null;
                SelectedOther   = null;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(parents), parents, null);
            }
        }
        /// <summary> Method adds a minimally reported aggregation as a parent of this </summary>
        /// <param name="ParentCode"> Aggregation code for this minimally reported aggregation </param>
        /// <param name="ParentName"> Full name for this minimally reported aggregation </param>
        /// <param name="ParentShortName"> Shortened name for this minimally reported aggregation </param>
        public void Add_Parent_Aggregation(string ParentCode, string ParentName, string ParentShortName)
        {
            // Create the object
            Item_Aggregation_Minimal parentAggregation = new Item_Aggregation_Minimal(ParentCode, ParentName, ParentShortName);

            // If the list is currently null, create it
            if (Parents == null)
            {
                Parents = new List <Item_Aggregation_Minimal> {
                    parentAggregation
                };
            }
            else
            {
                // If this does not exist, add it
                if (!Parents.Contains(parentAggregation))
                {
                    Parents.Add(parentAggregation);
                }
            }
        }
        public virtual bool RemoveFromParent(GroupNode <T> parent, bool cleanupIfFloating)
        {
            // try to remove this node from the given parent.
            if (!parent.RemoveChild(this))
            {
                return(false);
            }

            // if we don't have any parents left, we're floating free: recurse down, and
            // remove all children from this node. (This retains children that are also
            // children of other nodes, not just this one).
            if (cleanupIfFloating && Parents.Count() == 0)
            {
                foreach (GroupNode <T> child in _children.ToList())
                {
                    child.RemoveFromParent(this, cleanupIfFloating);
                }
            }

            return(true);
        }
Exemple #6
0
        public bool UpdateParents(Parents parents)
        {
            bool          isSave     = false;
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();
            string qrey = "UPDATE  parents SET fatherName='" + parents.FatherName + "', motherName='" +
                          parents.MotherName + "' WHERE id='" + parents.Id + "'   ";



            SqlCommand command      = new SqlCommand(qrey, connection);
            int        rowsEffected = command.ExecuteNonQuery();

            if (rowsEffected > 0)
            {
                isSave = true;
            }
            connection.Close();
            return(isSave);
        }
        public IActionResult OnPost(int kidId)
        {
            if (Program.loggedUser == false)
            {
                return(RedirectToPage("./NotFound"));
            }

            Kid = kindergardenData.GetKidById(kidId);
            if (Kid == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            Kid.Status = Statuses.Odbien;
            kindergardenData.Commit();
            MailHelper mailHelper = new MailHelper(Configuration);
            Parents    parent     = kindergardenData.GetParentById((int)Kid.ParentId);

            mailHelper.SendApplicationDenied(parent.Email, parent.ImeTatko + " " + parent.ImeMajka + " " + Kid.LastName);
            return(RedirectToPage("./ListApplications"));
        }
        public void UpdateProbabilities()
        {
            Node[]     parents     = Parents.ToArray();
            string[]   parentNames = new string[0];
            string[][] outcomes    = new string[][] { Definitions };

            bool hasEventParent = false;

            foreach (Node parent in parents)
            {
                if (parent.Type == NodeType.Event)
                {
                    hasEventParent = true;
                }
                Array.Resize(ref parentNames, parentNames.Length + 1);
                parentNames[parentNames.Length - 1] = parent.Name;
                Array.Resize(ref outcomes, outcomes.Length + 1);
                outcomes[outcomes.Length - 1] = parent.Definitions;
            }

            var conditionCombinations   = CartesianCompute.CartesianProduct(outcomes);
            HashSet <Probability> probs = new HashSet <Probability>();

            foreach (var comb in conditionCombinations)
            {
                string[]    combArr = comb.ToArray();
                Probability prob    = null;
                if (hasEventParent)
                {
                    prob = new Probability(new string[] { combArr[0] }, new Node[] { owner }, combArr.Skip(1).ToArray(), parents);
                }
                else
                {
                    prob = new Probability(combArr, new Node[] { owner }.Concat(parents).ToArray(), new string[0], new Node[0]);
                }
                Console.WriteLine("Probability: " + prob.ToString());
                probs.Add(prob);
            }
            probabilities = probs.ToArray();
        }
Exemple #9
0
        /// <summary>
        /// Processes the parent nodes. Since a parent may contain a parent, there may be
        /// a recursive call to self.
        /// </summary>
        /// <param name="reader">XmlTextReader</param>
        /// <param name="listParents">Parents</param>
        private void ProcessParent(XmlTextReader reader, Parents listParents)
        {
            string nodeName = string.Empty;
            bool   bParent  = true;
            Parent p        = new Parent();

            while (bParent && reader.Read())
            {
                nodeName = reader.Name;
                switch (reader.NodeType)
                {
                case XmlNodeType.Text:
                    p.ParentName = reader.Value.Trim();
                    break;

                case XmlNodeType.Element:
                    if (nodeName.Equals("IdentName"))
                    {
                        nodeName = ProcessIdentityNode(reader, p.ListPairedValues);
                    }
                    // Parent containing parent, may also occur after processing the identities
                    if (nodeName.Equals("Parent"))
                    {
                        ProcessParent(reader, p.ListParents);
                    }
                    else if (nodeName.Equals("EndParent"))
                    {
                        // this may occur after processing the identities. Will either be a new parent (above) or finished the parent
                        bParent = false;
                        listParents.Add(p);
                    }
                    break;

                case XmlNodeType.EndElement:
                    bParent = false;
                    listParents.Add(p);
                    break;
                }
            }
        }
Exemple #10
0
 public void FillParentsAndChildren()
 {
     foreach (var item in ParentChildrenRelation)
     {
         // if he is a parent
         if (item.ParentInformation == this.Name || item.ParentInformation == this.Birthday)
         {
             if (!Childs.Contains(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First()))
             {
                 Childs.Add(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First());
             }
         }
         // if he is a child
         if (item.ChildInformatio == this.Name || item.ChildInformatio == this.Birthday)
         {
             if (!Parents.Contains(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First()))
             {
                 Parents.Add(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First());
             }
         }
     }
 }
        public ActionResult UpdateInfo(Parents parents)
        {
            string id       = Request.Cookies.Get("parents").Value;
            string fileName = Path.GetFileNameWithoutExtension(parents.ImageFile.FileName);

            parents.ImagePath = id + fileName + System.IO.Path.GetExtension(parents.ImageFile.FileName);
            fileName          = "~/ParentsImage/" + id + fileName + System.IO.Path.GetExtension(parents.ImageFile.FileName);
            parents.ImageFile.SaveAs(Server.MapPath(fileName));
            try
            {
                if (ModelState.IsValid)
                {
                    parents.updateInfo(id);
                    return(RedirectToAction("Index"));
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }
Exemple #12
0
        internal PaymentMethodMapping()
        {
            Fields.Add("Id", new FieldMapping {
                PropertyName = "UniqueId"
            });
            Fields.Add("Nome", new FieldMapping {
                PropertyName = "Name"
            });
            Fields.Add("IsRiBa", new FieldMapping {
                PropertyName = "IsBankReceipt"
            });

            Parents.Add(
                "CodicePagamentoPA",
                new DataRelationMapping
            {
                PropertyName      = "ModalitaPagamentoPA",
                ParentColumn      = "CodicePagamentoPA",
                UpstreamTransform = (key, row, obj) => PAHelpers.ModalitaPagamentoPA[(string)row[key]],
                ChildProperty     = "Code"
            });
        }
Exemple #13
0
        public void AddNewUserParent(string nameMather, string surnameMather, string PatrMathe, string nameFather, string surnameFather, string PatrFather, string phoneMathe, string phoneFather, string email, string password, int code)// добавление нового пользователя родитель
        {
            Parents tmp = new Parents();

            using (EducationSystemContext esc = new EducationSystemContext())
            {
                tmp.NameMather       = nameMather;
                tmp.SurnameFather    = surnameMather;
                tmp.PatronymicMather = PatrMathe;
                tmp.NameFather       = nameFather;
                tmp.SurnameFather    = surnameFather;
                tmp.PatronymicFather = PatrFather;
                tmp.PhoneFather      = phoneFather;
                tmp.PhoneMathe       = phoneMathe;
                tmp.Email            = email;
                tmp.Password         = password;
                esc.Parents.Add(tmp);
                esc.SaveChanges();
                esc.Database.ExecuteSqlRaw("UPDATE [Pupils] Set [IDParent]={0} where [IDPupil]={0}", tmp.Idparent, code);
                esc.SaveChanges();
            }
        }
        public void AddParent(Person person)
        {
            if (Parents == null)
            {
                Parents = new List <Person>(ParentLimit)
                {
                    person
                };
            }
            else if (Parents.Count < ParentLimit && !Parents.Contains(person))
            {
                // Same gender parents are allowed now
                //if (Parents.Any(x => x.Gender == person.Gender))
                //    throw new Exception("same gender Parents are disallowed.");

                Parents.Add(person);
            }
            else
            {
                throw new Exception("Parents are already full");
            }
        }
Exemple #15
0
        /// <summary>
        /// Calculates the possible values the cell can have.
        /// </summary>
        /// <returns></returns>
        public bool CalculatePossibilities()
        {
            _possibilities = new List <int>();
            int        capacity   = ((SilverSudokuSection)Parents.GetSections()[0]).NumCells;
            List <int> impossible = new List <int>();

            foreach (SilverSudokuSection section in Parents)
            {
                foreach (SudokuCell sCell in section.GetCells())
                {
                    int number = sCell.Value;
                    //Debug.WriteLine(string.Format("rij: {0}, kolom: {1}, waarde: {2}",sCell.Key.RowIndex, sCell.Key.ColumnIndex, sCell.Value.ToString()));
                    //      if (number > 0)
                    {
                        if (!impossible.Contains(number))
                        {
                            impossible.Add(number);
                        }
                    }
                }
            }
            impossible.Sort();
            for (int i = 0; i < capacity; i++)
            {
                if (!impossible.Contains(i))
                {
                    _possibilities.Add(i);
                }
            }
            if (_p == null)
            {
                _p = new ValueCollection(_possibilities);
            }
            else
            {
                _p.cells = _possibilities;
            }
            return(HasSolution);
        }
 private void FixTheBaseVersionSourceOfMergeMessageStrategyIfReleaseBranchWasMergedAndDeleted(IEnumerable <Versions> baseVersions)
 {
     if (ReleaseBranchExistsInRepo())
     {
         return;
     }
     foreach (var baseVersion in baseVersions)
     {
         if (baseVersion.Version?.Source.Contains(MergeMessageVersionStrategy.MergeMessageStrategyPrefix) == true &&
             baseVersion.Version.Source.Contains("Merge branch") &&
             baseVersion.Version.Source.Contains("release"))
         {
             var parents = baseVersion.Version.BaseVersionSource !.Parents.ToList();
             baseVersion.Version = new BaseVersion(
                 baseVersion.Version.Source,
                 baseVersion.Version.ShouldIncrement,
                 baseVersion.Version.SemanticVersion,
                 this.repositoryStore.FindMergeBase(parents[0], parents[1]),
                 baseVersion.Version.BranchNameOverride);
         }
     }
 }
        public void GraphWithSelfEdges()
        {
            Random rnd = new Random();

            for (int i = 0; i < 10; ++i)
            {
                for (int j = 0; j < i * i; ++j)
                {
                    AdjacencyGraph g = new AdjacencyGraph(new QuickGraph.Providers.VertexAndEdgeProvider(), true);
                    RandomGraph.Graph(g, i, j, rnd, true);

                    BreadthFirstSearchAlgorithm bfs = new BreadthFirstSearchAlgorithm(g);
                    bfs.InitializeVertex += new VertexHandler(this.InitializeVertex);
                    bfs.DiscoverVertex   += new VertexHandler(this.DiscoverVertex);
                    bfs.ExamineEdge      += new EdgeHandler(this.ExamineEdge);
                    bfs.ExamineVertex    += new VertexHandler(this.ExamineVertex);
                    bfs.TreeEdge         += new EdgeHandler(this.TreeEdge);
                    bfs.NonTreeEdge      += new EdgeHandler(this.NonTreeEdge);
                    bfs.GrayTarget       += new EdgeHandler(this.GrayTarget);
                    bfs.BlackTarget      += new EdgeHandler(this.BlackTarget);
                    bfs.FinishVertex     += new VertexHandler(this.FinishVertex);

                    Parents.Clear();
                    Distances.Clear();
                    m_CurrentDistance = 0;
                    m_SourceVertex    = RandomGraph.Vertex(g, rnd);

                    foreach (IVertex v in g.Vertices)
                    {
                        Distances[v] = int.MaxValue;
                        Parents[v]   = v;
                    }
                    Distances[SourceVertex] = 0;
                    bfs.Compute(SourceVertex);

                    CheckBfs(g, bfs);
                }
            }
        }
Exemple #18
0
    public override string ToString()
    {
        var sb = new StringBuilder();

        sb.AppendLine(Name);

        sb.AppendLine("Company:");
        if (Company != null)
        {
            sb.AppendLine(Company.ToString());
        }

        sb.AppendLine("Car:");
        if (Car != null)
        {
            sb.AppendLine(Car.ToString());
        }

        sb.AppendLine("Pokemon:");
        if (Pokemons.Count > 0)
        {
            sb.AppendLine(string.Join(Environment.NewLine, Pokemons.Select(p => p.ToString())));
        }

        sb.AppendLine("Parents:");
        if (Parents.Count > 0)
        {
            sb.AppendLine(string.Join(Environment.NewLine, Parents.Select(par => par.ToString())));
        }

        sb.AppendLine("Children:");
        if (Childrens.Count > 0)
        {
            sb.AppendLine(string.Join(Environment.NewLine, Childrens.Select(c => c.ToString())));
        }

        return(sb.ToString());
    }
Exemple #19
0
    public override string ToString()
    {
        var sb = new StringBuilder();

        sb.AppendLine($"{Name}");

        sb.AppendLine("Company:");
        if (Company != null)
        {
            sb.AppendLine($"{Company.Name} {Company.Department} {Company.Salary}");
        }

        sb.AppendLine("Car:");
        if (Car != null)
        {
            sb.AppendLine($"{Car.Model} {Car.Speed}");
        }

        sb.AppendLine("Pokemon:");
        if (Pokemons.Count > 0)
        {
            Pokemons.ForEach(c => sb.AppendLine($"{c.Name} {c.Type}"));
        }

        sb.AppendLine("Parents:");
        if (Parents.Count > 0)
        {
            Parents.ForEach(c => sb.AppendLine($"{c.Name} {c.Birthday}"));
        }

        sb.AppendLine("Children:");
        if (Children.Count > 0)
        {
            Children.ForEach(c => sb.AppendLine($"{c.Name} {c.Birthday}"));
        }

        return(sb.ToString());
    }
Exemple #20
0
        // Call if the Father and Mother are modified
        // TODo Mit Gerry die Function in Automapper verschieben
        // => Initial PatientParent List PatientParent in Automapper
        public void AddPatientParents()
        {
            if (Father != null)
            {
                Parents.Add(Father);
            }
            if (Mother != null)
            {
                Parents.Add(Mother);
            }
            foreach (Parent parent in Parents)
            {
                if (!PatientParents.Any(row => row.Parent.Id == parent.Id && row.Parent.Id != 0))
                {
                    PatientParents.Add(new PatientParent()
                    {
                        Parent = parent, Patient = this
                    });
                }
            }


            //if (Father != null)
            //{
            //    Parents.Add(Father);
            //}
            //if (Mother != null)
            //{
            //    Parents.Add(Mother);
            //}
            //foreach (Parent parent in Parents)
            //{
            //    if (!PatientParents.Any(row => row.Parent.Id == parent.Id && row.Parent.Id != 0))
            //    {
            //        PatientParents.Add(new PatientParent() { Parent = parent, Patient = this });
            //    }
            //}
        }
Exemple #21
0
        public ImmutableArray <Object> ExtractComponents(params TypeInfo[] componentTypes)
        {
            if (componentTypes == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(componentTypes));
            }

            if (!componentTypes.Any())
            {
                throw Logger.Fatal.ArgumentEmptySequence(nameof(componentTypes));
            }

            if (!componentTypes.Last().IsAssignableFrom(ValueType.GetTypeInfo()))
            {
                throw Logger.Fatal.ArgumentFormat(
                          nameof(componentTypes),
                          SR.NestedResoveResult_LastComponentTypeMustBeAssignableFromT,
                          componentTypes.Last(),
                          ValueType
                          );
            }

            var array = new Object[componentTypes.Length];

            using (var enumerator = Parents.GetEnumerator())
            {
                var atEnd = false;

                for (var i = 0; !atEnd && (i < array.Length - 1); i++)
                {
                    array[i] = NextOfType(enumerator, componentTypes[i], out atEnd);
                }

                array[array.Length - 1] = Value;
            }

            return(array.ToImmutableArray());
        }
        public IActionResult OnPost([Bind] Kid kidUpdate)
        {
            var found = false;

            kidUpdate.AplicationDate = DateTime.Now;
            kidUpdate.KindergardenId = Kid.KindergardenId;
            try
            {
                Parents parentFound = _context.Parents.Where(p => p.Email == Parent.Email).First();
                if (parentFound != null)
                {
                    if (parentFound.kids == null)
                    {
                        parentFound.kids = new List <Kid>();
                    }
                    parentFound.kids.Add(kidUpdate);
                    found = true;
                    _context.SaveChanges();
                }
            } catch (Exception e)
            {
                found = false;
                //
            }
            if (found == false)
            {
                Parent.kids = new List <Kid> {
                    kidUpdate
                };
                _context.Add(Parent);
                _context.SaveChanges();
            }
            Saved = true;
            MailHelper mailHelper = new MailHelper(Configuration);

            mailHelper.SendApplicationReceived(kidUpdate.Parent.Email, kidUpdate.Parent.ImeTatko + " " + kidUpdate.Parent.ImeMajka + " " + kidUpdate.LastName);
            return(Page());
        }
Exemple #23
0
        public override bool RemoveFromParent(GroupNode <Element> parent, bool cleanup)
        {
            bool result = base.RemoveFromParent(parent, cleanup);

            // if we're cleaning up after removal (eg. being deleted), and we're actually floating
            // (ie. this node doesn't exist anywhere else), remove the associated element (if any)
            if (cleanup && !Parents.Any())
            {
                if (Element != null)
                {
                    VixenSystem.Elements.RemoveElement(Element);
                    foreach (var source in Properties.ToArray())
                    {
                        Properties.Remove(source.Descriptor.TypeId);
                    }
                    Element = null;
                }
                VixenSystem.Nodes.ClearElementNode(Id);
            }

            OnChanged(this);
            return(result);
        }
Exemple #24
0
        public Parents GetRecentAddedData()
        {
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();

            string        qrey    = "SELECT TOP(1) * from dbo.parents order by id Desc";
            SqlCommand    command = new SqlCommand(qrey, connection);
            SqlDataReader reader  = command.ExecuteReader();
            var           parents = new Parents();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    parents.Id         = Convert.ToInt32(reader["Id"]);
                    parents.FatherName = Convert.ToString(reader["fatherName"]);
                    parents.MotherName = Convert.ToString(reader["motherName"]);
                }
            }
            connection.Close();
            return(parents);
        }
 private void ProcessParentData(ProccessStatusReq psr, XElement epLog, Parents listParents)
 {
     foreach (Parent p in listParents)
     {
         var parentLog = psr.GetElementsSelf(epLog, p.ParentName);
         GetIdentityValues(psr, parentLog, p.ListPairedValues);
         if (p.ListParents.Count > 0)
         {
             if (parentLog.Count > 0)
             {
                 // if no values have been set for the device no need to recurs
                 if (!parentLog[0].IsEmpty)
                 {
                     ProcessParentData(psr, parentLog[0], p.ListParents);
                 }
             }
             //else
             //{
             //	MessageBox.Show("Improperly formatted XML data. The parentLog is hosed at: " + p.ParentName);
             //}
         }
     }
 }
        protected override void OnStateUpdated(ViewStates state)
        {
            if (this._parentsRetriever == null) //this function may endups being called before instance is fully constructed
            {
                return;
            }

            var parent = this.RetrieveParent(this.CurrentItem);

            if (State == ViewStates.Creating ||
                State == ViewStates.UpdatingCreate ||
                State == ViewStates.UpdatingViewing ||
                State == ViewStates.Updating)
            {
                Parents = this._parentsRetriever();
            }

            if (parent != null && Parents.Count() > 0)
            {
                var itemParent = Parents.First(cat => cat.Id.Equals(parent.Id));
                this.SetParent(this.CurrentItem, itemParent);
            }
        }
        internal FeeMapping()
        {
            Fields.Add("Id", new FieldMapping {
                PropertyName = "UniqueId"
            });
            Fields.Add("Nome", new FieldMapping {
                PropertyName = "Name"
            });
            Fields.Add("Importo", new FieldMapping {
                PropertyName = "Amount"
            });

            Parents.Add(
                "IdCausaleIVA",
                new DataRelationMapping
            {
                ParentColumn  = "Codice",
                ChildProperty = "Code",
                PropertyName  = "Vat",
                ChildType     = typeof(Vat),
                RelationName  = "FK_CausaliIVA_Spese"
            });
        }
Exemple #28
0
        /// <summary>後続する</summary>
        /// <param name="parents">先行</param>
        public void Succeed(IEnumerable <INetworkable> parents)
        {
            Contract.Requires(!parents.Contains(this));
            Contract.Requires(!parents.SelectMany(a => a.Ancestors).Contains(this));

            if (parents.IsNullOrEmpty())
            {
                return;
            }
            if (parents.All(a => Parents.Contains(a)))
            {
                return;
            }
            Parents = Parents.Union(parents);
            if (parents.All(a => a.Parents.Contains(this)))
            {
                return;
            }
            foreach (var parent in parents)
            {
                parent.Precede(this);
            }
        }
 public Character(CharacterName characterName, Age age, Parents parents, Mother mother, Father father, Appearance appearance, Race race, LifeEvents lifeEvents, Childhood childhood, Adolescence adolescence, Adulthood adulthood, OldAge elder, Profession profession, RelationshipStatus relationshipStatus, Stats stats, Role role, Demeanor demeanor, Gender gender, PlaceOfResidence placeOfResidence, NullChatMenuComponent nullChatMenuComponent)
 {
     this.characterName         = characterName;
     this.age                   = age;
     this.parents               = parents;
     this.mother                = mother;
     this.father                = father;
     this.appearance            = appearance;
     this.race                  = race;
     this.lifeEvents            = lifeEvents;
     this.childhood             = childhood;
     this.adolescence           = adolescence;
     this.adulthood             = adulthood;
     this.elder                 = elder;
     this.profession            = profession;
     this.relationshipStatus    = relationshipStatus;
     this.stats                 = stats;
     this.role                  = role;
     this.demeanor              = demeanor;
     this.gender                = gender;
     this.placeOfResidence      = placeOfResidence;
     this.nullChatMenuComponent = nullChatMenuComponent;
 }
Exemple #30
0
        // This method is called to ensure that the score is higher than a given score.
        // E.g. the score needs to be higher that the score of its children.
        public int EnsureScoreIsAbove(int minimalScore)
        {
            if (minimalScore <= Score)
            {
                return(Score);
            }

            Score = minimalScore;

            if (!Parents.Any())
            {
                return(Score);
            }

            int maxScore = Score;

            var processed = new HashSet <RevisionGraphRevision>();

            var stack = new Stack <RevisionGraphRevision>();

            stack.Push(this);
            processed.Add(this);
            while (stack.Count > 0)
            {
                var revision = stack.Pop();

                foreach (var parent in revision.Parents.Where(r => r.Score < maxScore + 1 && !processed.Contains(r)))
                {
                    parent.Score = maxScore + 1;
                    maxScore     = parent.Score;
                    processed.Add(parent);
                    stack.Push(parent);
                }
            }

            return(maxScore);
        }