예제 #1
0
        public void ParseOwnersAndPath(string line)
        {
            if (string.IsNullOrEmpty(line) ||
                (line.StartsWith("#") && !(line.IndexOf(CodeOwnerEntry.MissingFolder, StringComparison.OrdinalIgnoreCase) >= 0)))
            {
                return;
            }

            line = ParsePath(line);

            //remove any comments from the line, if any.
            // this is the case when we have something like @user #comment
            int commentIndex = line.IndexOf("#");

            if (commentIndex >= 0)
            {
                line = line.Substring(0, commentIndex).Trim();
            }

            foreach (string author in SplitLine(line, OwnerSeparator).ToList())
            {
                if (!string.IsNullOrWhiteSpace(author))
                {
                    Owners.Add(author.Trim());
                }
            }
        }
예제 #2
0
 public void AddOwner(IClient client)
 {
     if (!Owners.Contains(client))
     {
         Owners.Add(client);
     }
 }
예제 #3
0
        private void LoadResources()
        {
            Licenses.Clear();
            Licenses.Add(string.Empty, Strings.Common_ChooseALicense);
            SelectedLicense = string.Empty;
            foreach (var line in _git.GetLicenses())
            {
                Licenses.Add(line, line);
            }
            Owners.Clear();
            var user = _storage.GetUser();

            if (user != null)
            {
                Owners.Add(new Ownership(user.Username, user.FullName, OwnershipTypes.User));
            }
            Task.Run(async() =>
            {
                var owners = await _web.GetUserOrginizationsAsync();
                await ThreadingHelper.SwitchToMainThreadAsync();

                foreach (var owner in owners)
                {
                    Owners.Add(owner);
                }
            });
        }
 private void AddOwner(object sender, RoutedEventArgs e)
 {
     Owners.Add(new Owner()
     {
         Name = "New Owner"
     });
 }
예제 #5
0
        public Owner Split(Owner owner, int nom, int den)
        {
            int n = owner.Share.Numerator,
                d = owner.Share.Denominator;

            var n1 = n * nom;
            var d1 = d * den;

            var n2 = n * d1 - n1 * d;
            var d2 = d1 * d;

            (n1, d1) = Reduce(n1, d1);
            (n2, d2) = Reduce(n2, d2);
            owner.Share.Numerator   = n2;
            owner.Share.Denominator = d2;

            var newOwner = new Owner
            {
                Share = new Share
                {
                    Numerator   = n1,
                    Denominator = d1,
                }
            };

            Owners.Add(newOwner);
            if (n2 == 0)
            {
                Owners.Remove(owner);
            }
            return(newOwner);
        }
예제 #6
0
 /// <summary>
 /// Listen to the event on this object
 /// </summary>
 /// <param name="owner">Object to subscribe to</param>
 public void Listen(T owner)
 {
     Assert.Argument(owner, nameof(owner)).NotNull();
     Owners.Add(owner);
     if (_subscriptions > 0)
     {
         _event.AddEventHandler(owner, _eventHandler);
     }
 }
예제 #7
0
 /// <summary>
 /// Listen to the event on this object
 /// </summary>
 /// <param name="owner">Object to subscribe to</param>
 /// <param name="replacementSender">Replace sender in the callback with this object if it is not null</param>
 public void Listen(T owner, object replacementSender = null)
 {
     Owners.Add(owner);
     replacementSenders.Add(replacementSender);
     if (subscriptions > 0)
     {
         @event.AddEventHandler(owner, eventHandler);
     }
 }
예제 #8
0
 public Intersection(Track owner, Coord coordinates)
 {
     if (Owners == null)
     {
         Owners = new List <Track>();
     }
     Owners.Add(owner);
     Coordinates = coordinates;
 }
예제 #9
0
        public void EnsureOwner(string id)
        {
            if (Owners.Count(owner => owner.Id == id) != 0)
            {
                return;
            }

            Owners.Add(new Owner {
                Id = id
            });
            SaveChanges();
        }
예제 #10
0
 public bool LogIn(string name, string password)
 {
     if (!string.IsNullOrEmpty(Password) && password == Password && !Owners.Contains(name))
     {
         Owners.Add(name);
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #11
0
        protected DMHorse(Mobile owner)
        {
            if (owner == null)
            {
                return;
            }

            Blessed = true;
            Owners.Add(owner);
            Owner = owner;
            Name  = string.Format("{0}'s Horse", owner.Name);
            Rider = Owner;
        }
예제 #12
0
 public void AddOwner(ICustomer owner)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("No owner specified");
     }
     if (Owners.Contains(owner))
     {
         throw new ArgumentException("Owner already registered for bank account.");
     }
     Owners.Add(owner);
     owner.AddBankAccount(this);
 }
예제 #13
0
        public void ParseOwnersAndPath(string line)
        {
            if (string.IsNullOrEmpty(line) || line.StartsWith('#'))
            {
                return;
            }

            line = ParsePath(line);

            foreach (string author in SplitLine(line, OwnerSeparator).ToList())
            {
                if (!string.IsNullOrWhiteSpace(author))
                {
                    Owners.Add(author.Trim());
                }
            }
        }
예제 #14
0
        private void LoadResources()
        {
            Owners.Clear();
            var user = _storage.GetUser();

            Owners.Add(new Ownership(user.Username, user.FullName, OwnershipTypes.User));
            SelectedOwner = Owners[0];
            Task.Run(async() =>
            {
                var owners = await _web.GetUserOrginizationsAsync();
                await ThreadingHelper.SwitchToMainThreadAsync();

                foreach (var owner in owners)
                {
                    Owners.Add(owner);
                }
            });

            GitIgnores.Add(string.Empty, Strings.Common_ChooseAGitIgnore);
            SelectedGitIgnore = string.Empty;
            foreach (var line in _git.GetGitIgnores())
            {
                GitIgnores.Add(line, $"{line} - .gitignore");
            }

            Licenses.Add(string.Empty, Strings.Common_ChooseALicense);
            SelectedLicense = string.Empty;
            foreach (var line in _git.GetLicenses())
            {
                Licenses.Add(line, line);
            }
            string defaultnamespace = _storage.GetUser().Username;

            foreach (var path in _web.GetNamespacesPathList())
            {
                Namespaces.Add(path.id.ToString(), $"{path.name} - {path.full_path}");
                if (path.full_path == defaultnamespace)
                {
                    SelectedNamespaces = path.id.ToString();
                }
            }
        }
예제 #15
0
        public void AddAccount(string ownerName, string accountName)
        {
            var owner = Owners.Where(w => w.Name == ownerName).FirstOrDefault();

            if (owner == null)
            {
                owner = new AccountOwner {
                    Name = ownerName, Accounts = new List <Models.Account>()
                };
                Owners.Add(owner);
            }
            if (owner.Accounts == null)
            {
                owner.Accounts = new List <Account>();
            }

            owner.Accounts.Add(new Account
            {
                Name      = accountName,
                OwnerName = ownerName,
                Entries   = new List <AccountEntry>()
            });
        }
예제 #16
0
 public void AddOwner(Owner owner)
 {
     Owners.Add(owner);
 }
예제 #17
0
 public void AddOwner(string name)
 {
     Owners.Add(new AccountOwner {
         Name = name, Accounts = new List <Models.Account>()
     });
 }
 public void AddOwner(HouseOwner owner)
 {
     Owners.Add(owner);
 }
예제 #19
0
        private void Parse()
        {
            BureauScore = RawExperianLtd.CommercialDelphiScore.HasValue
                                ? RawExperianLtd.CommercialDelphiScore.Value
                                : 0;

            if (RawExperianLtd.CommercialDelphiCreditLimit.HasValue)
            {
                CreditLimit = RawExperianLtd.CommercialDelphiCreditLimit.Value;
            }

            CompanyName = RawExperianLtd.CompanyName;

            AddressLine1 = RawExperianLtd.OfficeAddress1;
            AddressLine2 = RawExperianLtd.OfficeAddress2;
            AddressLine3 = RawExperianLtd.OfficeAddress3;
            AddressLine4 = RawExperianLtd.OfficeAddress4;
            PostCode     = RawExperianLtd.OfficeAddressPostcode;

            if (Owners == null)
            {
                Owners = new SortedSet <string>();
            }

            if (!string.IsNullOrWhiteSpace(RawExperianLtd.RegisteredNumberOfTheCurrentUltimateParentCompany))
            {
                Owners.Add(RawExperianLtd.RegisteredNumberOfTheCurrentUltimateParentCompany.Trim());
            }

            ExistingBusinessLoans = 0;

            var oErrors = new List <string>();

            foreach (var oKid in RawExperianLtd.Children)
            {
                if (oKid.GetType() == typeof(ExperianLtdShareholders))
                {
                    ExperianLtdShareholders obj = (ExperianLtdShareholders)oKid;

                    if (!string.IsNullOrWhiteSpace(obj.RegisteredNumberOfALimitedCompanyWhichIsAShareholder))
                    {
                        Owners.Add(obj.RegisteredNumberOfALimitedCompanyWhichIsAShareholder.Trim());
                    }
                }
                else if (oKid.GetType() == typeof(ExperianLtdCaisMonthly))
                {
                    ExperianLtdCaisMonthly obj = (ExperianLtdCaisMonthly)oKid;

                    if (obj.NumberOfActiveAccounts.HasValue)
                    {
                        ExistingBusinessLoans += obj.NumberOfActiveAccounts.Value;
                    }
                }
                else if (oKid.GetType() == typeof(ExperianLtdErrors))
                {
                    ExperianLtdErrors obj = (ExperianLtdErrors)oKid;

                    if (!string.IsNullOrWhiteSpace(obj.ErrorMessage))
                    {
                        oErrors.Add(obj.ErrorMessage);
                    }
                }
            }             // for

            if (oErrors.Count > 0)
            {
                Error += string.Join("", oErrors);
            }

            IncorporationDate = RawExperianLtd.IncorporationDate;

            IsDataExpired = LastCheckDate.HasValue &&
                            (DateTime.UtcNow - LastCheckDate.Value).TotalDays >= CurrentValues.Instance.UpdateCompanyDataPeriodDays;
        } // Parse
예제 #20
0
        public void LoadSpec(string pathToNuspec)
        {
            var doc = Util.GetXmlDocumentForFile(pathToNuspec);

            foreach (XmlNode metadata in doc.GetElementsByTagName("metadata")[0])
            {
                var text = metadata.InnerText.Trim();
                switch (metadata.Name.ToLower())
                {
                case "id":          Id = text; break;

                case "version":     VersionText = text; break;

                case "title":       Title = text; break;

                case "description": Description = text; break;

                case "language":    Language = text; break;

                case "licenseurl":  LicenseUrl = text; break;

                case "projecturl":  ProjectUrl = text; break;

                case "iconurl":     IconUrl = text; break;

                case "created":  Created = DateTime.Parse(text); break;

                case "modified": Modified = DateTime.Parse(text); break;

                case "requirelicenseacceptance":
                    RequireLicenseAcceptance = bool.Parse(text); break;

                case "authors":
                    if (text.Contains(","))
                    {
                        foreach (var author in text.Split(','))
                        {
                            Authors.Add(author.Trim());
                        }
                    }
                    else
                    {
                        foreach (XmlNode authorNode in metadata.ChildNodes)
                        {
                            Authors.Add(authorNode.InnerText);
                        }
                    }
                    break;

                case "owners":
                    if (text.Contains(","))
                    {
                        foreach (var owner in text.Split(','))
                        {
                            Owners.Add(owner.Trim());
                        }
                    }
                    else
                    {
                        foreach (XmlNode ownerNode in metadata.ChildNodes)
                        {
                            Owners.Add(ownerNode.InnerText);
                        }
                    }
                    break;

                case "tags":
                    char separator = metadata.InnerText.Contains(",") ? ',' : ' ';
                    foreach (var tag in metadata.InnerText.Trim().Split(separator))
                    {
                        Tags.Add(tag.Trim());
                    }
                    break;

                default:
                    Console.WriteLine("Unknown <metadata> element: {0}", metadata.Name);
                    break;
                }
            }
            foreach (XmlNode dependencyNode in doc.GetElementsByTagName("dependency"))
            {
                var dependency = new PackageDependency();
                foreach (XmlAttribute attr in dependencyNode.Attributes)
                {
                    switch (attr.Name.ToLower())
                    {
                    case "id":         dependency.Id = attr.Value; break;

                    case "version":    dependency.VersionText = attr.Value; break;

                    case "minversion": dependency.MinVersionText = attr.Value; break;

                    case "maxversion": dependency.MaxVersionText = attr.Value; break;

                    default:
                        Console.WriteLine("Unknown <dependency> attribute: {0}", attr.Name);
                        break;
                    }
                }
                Dependencies.Add(dependency);
            }
        }
예제 #21
0
 public void Create(Owner o)
 {
     Owners.Add(o);
     SaveChanges();
 }
예제 #22
0
파일: Shop.cs 프로젝트: shachafn/wsep192
 public void AddShopOwner(ShopOwner shopOwner)
 {
     Owners.Add(shopOwner);
 }
예제 #23
0
 public static void RegisterOwner(Owner owner)
 {
     Owners.Add(owner);
 }