Пример #1
0
        public InterfaceConfiguration AddContract(TypeInfo type, bool internalVisibility)
        {
            if (type == null)
            {
                return(null);
            }

            if (!type.IsInterface)
            {
                return(null);
            }

            if (Contracts.FirstOrDefault(existing => existing.Contract == type.FullName) != null)
            {
                return(null);
            }

            InterfaceConfiguration c = new InterfaceConfiguration
            {
                Parent           = this,
                Contract         = type.FullName,
                Modifier         = internalVisibility ? "internal" : "public",
                ForceAsyncMethod = true,
                ForceSyncMethod  = true,
                Namespace        = type.Namespace
            };

            Contracts.Add(c);
            return(c);
        }
Пример #2
0
        private void CreateContracts()
        {
            for (int i = 1; i <= 10; i++)
            {
                var datumStart = GetRandomDate(new DateTime(2015, 1, 1), true);

                var leverancier = GetRandomItemFromList(Organizations.Where(o => o.OrganizationType == OrganizationType.Supplier).ToList());
                var fabrikant   = GetRandomItemFromList(Organizations.Where(o => o.OrganizationType == OrganizationType.Manufacturer).ToList());
                //var instelling = GetRandomItemFromList(_organizations.Where(o => o.OrganizationType == OrganizationType.Institution).ToList());

                var beheerder     = GetRandomItemFromList(Contacts);
                var ondertekenaar = GetRandomItemFromList(Contacts);

                var auteur        = GetRandomItemFromList(Users);
                var userBeheerder = GetRandomItemFromList(Users);

                var contract = new Contract()
                {
                    Id                     = i,
                    Name                   = "Contract" + i.ToString().PadLeft(3, '0'),
                    Status                 = GetRandomEnum <ContractStatus>(),
                    Revisie                = _random.Next(4).ToString(),
                    DatumStart             = datumStart,
                    DatumEind              = GetRandomDate(datumStart, false),
                    DatumGetekend          = GetRandomDate(datumStart, true),
                    ContractWaarde         = _random.Next(100, 10000),
                    ContractType           = GetRandomEnum <ContractType>(),
                    DocumentUrl            = $"www.somewhereonthenet.com\\document{i.ToString().PadLeft(3, '0')}.pdf",
                    LeverancierId          = leverancier.Id,
                    Leverancier            = leverancier,
                    FabrikantId            = fabrikant.Id,
                    Fabrikant              = fabrikant,
                    ContactBeheerderId     = beheerder.Id,
                    ContactBeheerder       = beheerder,
                    ContactOndertekenaarId = beheerder.Id,
                    ContactOndertekenaar   = ondertekenaar,
                    UserAuteurId           = auteur.Id,
                    UserAuteur             = auteur,
                    UserBeheerderId        = userBeheerder.Id,
                    UserBeheerder          = userBeheerder,
                    Bijlagen               = new List <ContractBijlage>()
                    {
                        CreateRandomBaseModelItem <ContractBijlage>(i)
                    },
                    Componenten = new List <ContractComponent>()
                    {
                        CreateRandomBaseModelItem <ContractComponent>(i)
                    },
                    DocumentType​ = GetRandomEnum <DocumentType>()
                };

                Contracts.Add(contract);
            }
        }
Пример #3
0
        public void AddContracts(List <TemplateContract> contracts)
        {
            var i = 0;

            foreach (TemplateContract contract in contracts)
            {
                var gameContract = new GameContract(contract);
                gameContract.Order    = i++;
                gameContract.Location = GameContractLocation.DrawDeck;
                Contracts.Add(gameContract);
            }
        }
Пример #4
0
 private void InitContracts()
 {
     if (IsNew)
     {
         foreach (Type type in ContractTypes)
         {
             ContractBase contract = Activator.CreateInstance(type, new object[] { Session }) as ContractBase;
             if (contract != null)
             {
                 contract.UserTracking.SetUserInfoGetter(m_userInfoGetter);
                 Contracts.Add(contract);
             }
         }
     }
 }
Пример #5
0
        public IContract Rent(IUser renter, DateTime start, DateTime end, decimal Amount)
        {
            var contract = new Contract
            {
                RenterId     = renter.Id,
                CheckIn      = start,
                CheckOut     = end,
                HolderId     = HouseHolder.Id,
                ContractDate = DateTime.UtcNow,
                ApartmentId  = Id,
                Amount       = Amount
            };

            Contracts.Add(contract);

            return(contract);
        }
Пример #6
0
 private void AddToContracts(Contract contract, string customerClass)
 {
     _currentDispatcher.BeginInvoke((Action)(() =>
     {
         ClassContractFields c = new ClassContractFields
         {
             PropertyNo = contract.PropertyNo,
             CustomerNo = contract.CustomerId,
             Name = contract.Customer.Name,
             Location = contract.Property.Location,
             Property = contract.Property.Description,
             Rent = contract.AgreedRent,
             CustomerClass = customerClass
         };
         Contracts.Add(c);
     }
                                             ));
 }
        public IContract SignContract(IClient client, ITariff selectedTariff)
        {
            var company     = this;
            var passport    = client.Passport;
            var phoneNumber = GetUniquePhoneNumber();
            var tariff      = selectedTariff;
            var Equipment   = new Equipment(new Telephone(), new Port(phoneNumber));            // give personal equipment to new abonent with separate port and port status set as "SwitchedOff"

            var newContract = new Contract(company, passport, phoneNumber, tariff, Equipment);  // initialize new contract

            Contracts.Add(newContract);                                                         // Add new contract in company list

            AddNewClientToCompany(client);                                                      // add new client to list of clients if this client is not on the list

            OnReportBillingSystemOfNewClient(new ContractConclusionEvent(phoneNumber, tariff)); // initialize contract conclusion and invoke it

            return(newContract);
        }
        // Author Kasper
        public void SaveContractExecute(object parameter)
        {
            Contract contractClone = contract.Clone();
            string   message;

            SetStatus();
            if (selectedContract == null)
            {
                contract.AutoAssignId(Contracts);
                if (db.AddContract(contract))
                {
                    db.AddContract(contract);
                    ContractManager.AddContract(contractClone);
                    Contracts.Add(contractClone);
                    NotifyPropertyChanged("Contracts");
                    message = String.Format("Aftale med ID: {0} blev oprettet", contract.ID);
                    db.LogAdd(message);
                    MessageBox.Show(message);
                }
                else
                {
                    message = String.Format("Fejl! Aftale med ID: {0} eksistere allerede", contract.ID);
                    db.LogAdd(message);
                    MessageBox.Show("Fejl! Aftale eksisterer allerede!");
                }
            }
            else if (selectedContract != null)
            {
                db.UpdateContract(contract);
                ContractManager.RemoveContract(selectedContract);
                ContractManager.AddContract(contractClone);
                Contracts.Remove(selectedContract);
                Contracts.Add(contractClone);
                NotifyPropertyChanged("Contracts");
                message = String.Format("Aftale med ID: {0} blev redigeret", contract.ID);
                db.LogAdd(message);
                MessageBox.Show(message);
            }
        }
Пример #9
0
        internal void InternalAdd(XmlQualifiedName name, DataContract dataContract)
        {
            DataContract?dataContractInSet = null;

            if (Contracts.TryGetValue(name, out dataContractInSet))
            {
                if (!dataContractInSet.Equals(dataContract))
                {
                    if (dataContract.UnderlyingType == null || dataContractInSet.UnderlyingType == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.DupContractInDataContractSet, dataContract.StableName.Name, dataContract.StableName.Namespace)));
                    }
                    else
                    {
                        bool typeNamesEqual = (DataContract.GetClrTypeFullName(dataContract.UnderlyingType) == DataContract.GetClrTypeFullName(dataContractInSet.UnderlyingType));
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.DupTypeContractInDataContractSet, (typeNamesEqual ? dataContract.UnderlyingType.AssemblyQualifiedName : DataContract.GetClrTypeFullName(dataContract.UnderlyingType)), (typeNamesEqual ? dataContractInSet.UnderlyingType.AssemblyQualifiedName : DataContract.GetClrTypeFullName(dataContractInSet.UnderlyingType)), dataContract.StableName.Name, dataContract.StableName.Namespace)));
                    }
                }
            }
            else
            {
                Contracts.Add(name, dataContract);

                if (dataContract is ClassDataContract)
                {
                    AddClassDataContract((ClassDataContract)dataContract);
                }
                else if (dataContract is CollectionDataContract)
                {
                    AddCollectionDataContract((CollectionDataContract)dataContract);
                }
                else if (dataContract is XmlDataContract)
                {
                    AddXmlDataContract((XmlDataContract)dataContract);
                }
            }
        }
Пример #10
0
 public void AddContract(Contract contract)
 {
     Contracts.Add(contract);
 }
Пример #11
0
 public void addContract(HourContract contract)
 {
     Contracts.Add(contract);
 }
        /// <summary>
        /// Adds a new contract to the player's registry
        /// </summary>
        public bool Add(uint contractId)
        {
            var datContract = GetContractFromDat(contractId);

            if (datContract == null)
            {
                if (Debug)
                {
                    Console.WriteLine($"{Player.Name}.ContractManager.Add({contractId}): Contract not found in DAT file.");
                }
                return(false);
            }

            if (IsFull)
            {
                if (Player != null)
                {
                    //Player.Session.Network.EnqueueSend(new GameEventWeenieError(Player.Session, WeenieError.ContractError));
                    //what happened here in retail?

                    Player.Session.Network.EnqueueSend(new GameMessageSystemChat($"You currently have the maximum amount of contracts for this character and cannot take on another! You must abandon at least one contract before you can accept the contract for {datContract.ContractName}.", ChatMessageType.Broadcast));
                }
                return(false);
            }

            var existing = GetContract(contractId);

            if (existing == null)
            {
                // add new contract entry
                var info = new CharacterPropertiesContractRegistry
                {
                    CharacterId          = Player.Guid.Full,
                    ContractId           = datContract.ContractId,
                    DeleteContract       = false,
                    SetAsDisplayContract = false,
                };
                if (Debug)
                {
                    Console.WriteLine($"{Player.Name}.ContractManager.Add({contractId}): added contract: {datContract.ContractName}");
                }
                Contracts.Add(info);
                if (Player != null)
                {
                    Player.CharacterChangesDetected = true;
                    Player.Session.Network.EnqueueSend(new GameEventSendClientContractTracker(Player.Session, info));
                }

                RefreshMonitoredQuestFlags();
            }
            else
            {
                if (Debug)
                {
                    Console.WriteLine($"{Player.Name}.ContractManager.Add({contractId}): contract for {datContract.ContractName} already exists in registry.");
                }

                // contracts dupes are also successful without actually duping into registry.
                //return false;
            }

            return(true);
        }
Пример #13
0
 public void AddContract(object attachment)
 {
     Contracts.Add((ContractAttachment)attachment);
 }
        public async void Init()
        {
            CheckUser();
            if (!LocalStorage.IsExist)
            {
                await UserDialogs.Instance.AlertAsync("Please login to continue", "Mech Login", "Ok");

                return;
            }

            IsRefreshing = true;

            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    var client = new HttpClient();

                    var response = await client.GetAsync(EndPoint);

                    if (response.IsSuccessStatusCode)
                    {
                        var content = await response.Content.ReadAsStringAsync();

                        var list = JsonConvert.DeserializeObject <List <Contract> >(content);

                        if (list != null)
                        {
                            Contracts.Clear();
                        }

                        foreach (var contract in list)
                        {
                            if (contract.Mechanic != null)
                            {
                                var contractitem = new ContractItem()
                                {
                                    Id             = contract.Id,
                                    Time           = contract.Time,
                                    IsConfirmed    = contract.PaidByCustomer,
                                    Name           = contract.Mechanic.Name,
                                    Title          = contract.Mechanic.Title,
                                    InitialCharges = contract.InitialCharges,
                                    RatePerKM      = contract.RatePerKM,
                                    RatePerHour    = contract.RatePerHour,
                                    KM             = contract.KM,
                                    ContactNo      = contract.Mechanic.ContactNo,
                                    IsWorkStarted  = contract.IsWorkStarted,
                                    WorkStarted    = contract.WorkStarted,
                                    IsWorkFinished = contract.IsWorkFinished,
                                    WorkFinished   = contract.WorkFinished
                                };
                                Contracts.Add(contractitem);
                            }
                            else if (contract.Customer != null)
                            {
                                var contractitem = new ContractItem()
                                {
                                    Id             = contract.Id,
                                    Time           = contract.Time,
                                    IsConfirmed    = contract.RecievedByMehanic,
                                    Name           = contract.Customer.Name,
                                    Title          = $"{contract.Customer.Vehicle} {contract.Customer.Model}",
                                    InitialCharges = contract.InitialCharges,
                                    RatePerKM      = contract.RatePerKM,
                                    RatePerHour    = contract.RatePerHour,
                                    KM             = contract.KM,
                                    ContactNo      = contract.Customer.ContactNo,
                                    IsWorkStarted  = contract.IsWorkStarted,
                                    WorkStarted    = contract.WorkStarted,
                                    IsWorkFinished = contract.IsWorkFinished,
                                    WorkFinished   = contract.WorkFinished
                                };
                                Contracts.Add(contractitem);
                            }
                        }
                    }
                    IsRefreshing = false;
                }
            }
            catch (Exception ex)
            {
                IsRefreshing = false;
            }

            IsRefreshing = false;
        }
Пример #15
0
 public void AddContract(Contract contract)
 {
     LastDocumentCode++;
     contract.BarCode = LastDocumentCode;
     Contracts.Add(contract);
 }
Пример #16
0
 public void Append(Layout layout)
 {
     ViewModels.Add(layout.ViewModels);
     ActionItems.Add(layout.ActionItems);
     Contracts.Add(layout.Contracts);
 }