public void AddNewPerson(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(Name.Text))
            {
                MessageBox.Show("Неприпустиме значення імені!");
                return;
            }

            if (Date.SelectedDate == null || Date.SelectedDate.Value > DateTime.Today)
            {
                MessageBox.Show("Помилка! Неприпустима дата!");
                return;
            }

            int code = int.Parse(Code.Text);

            if (this.checkIfCodeIsUsed(code))
            {
                MessageBox.Show("Помилка! У базі вже існує особа з таким Кодом ЄДРПОУ!");
                return;
            }

            JuridicalPerson newPerson = new JuridicalPerson(JuridicalPerson.MaxId++, Name.Text, Date.SelectedDate.Value, code);

            string date  = Tools.ConvertDayTimeToSqlDate(Date.SelectedDate.Value);
            string query = "INSERT INTO JuridicalPersons (Id, Name, RegistrationDate, RegistrationCode) VALUES (" + newPerson.Id + ", '" + newPerson.Name + "', '" + date + "', " + newPerson.RegistrationCode + ");";

            Tools.ExecuteQuery(query);

            ((App)Application.Current).JuridicalPersons.Add(newPerson);
        }
Exemple #2
0
 public bool UpdateClient(int id, [FromBody] JuridicalPerson inst)
 {
     //var tmp = from dc in jc.JuridicalPersons
     //          where dc.PersonId == inst.PersonId
     //          select dc;
     //var t = tmp.Count() > 0 ? tmp.First() : null;
     //if (t != null)
     //{
     //    t.PersonFullTitle = inst.PersonFullTitle;
     //    t.TaxpayIdentNum = inst.TaxpayIdentNum;
     //    return true;
     //}
     //else
     //    return false;
     if (id == inst.PersonId)
     {
         jc.Entry(inst).State = EntityState.Modified;
         jc.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void readAllJuridicalPersonsFromDatabase(SQLiteCommand sqlite_cmd, out SQLiteDataReader sqlite_datareader)
        {
            sqlite_datareader = sqlite_cmd.ExecuteReader();

            try
            {
                sqlite_cmd.CommandText = "SELECT * FROM JuridicalPersons";

                while (sqlite_datareader.Read())
                {
                    DateTime dateTime = Extensions.Tools.GetDateTimeFromSql(sqlite_datareader["RegistrationDate"].ToString());

                    JuridicalPerson newPerson = new JuridicalPerson(int.Parse(sqlite_datareader["Id"].ToString()), sqlite_datareader["Name"].ToString(), dateTime, int.Parse(sqlite_datareader["RegistrationCode"].ToString()));

                    ((App)Application.Current).JuridicalPersons.Add(newPerson);
                }

                if (((App)Application.Current).JuridicalPersons.Count > 0)
                {
                    JuridicalPerson.MaxId = ((App)Application.Current).JuridicalPersons[((App)Application.Current).JuridicalPersons.Count - 1].Id + 1;
                }
            }
            catch (Exception e)
            {
                Logger.Log.Info(e.ToString());
            }
        }
Exemple #4
0
        public void Init()
        {
            clientType = new ClientType("Тестовый тип клиента")
            {
                Id = 1
            };
            serviceProgram = new ClientServiceProgram("Тестовая программа")
            {
                Id = 2
            };
            region = new ClientRegion("Тестовый регион")
            {
                Id = 3
            };
            legal = new LegalForm("ООО", EconomicAgentType.JuridicalPerson)
            {
                Id = 5
            };
            juridicalPerson = new JuridicalPerson(legal)
            {
                Id = 6
            };
            client = new Client("Тестовый клиент", clientType, ClientLoyalty.Customer, serviceProgram, region, 5)
            {
                Id = 4
            };
            clientOrganization = new ClientOrganization("Тестовая организация клиента", "Тестовая организация клиента", juridicalPerson)
            {
                Id = 7
            };
            var employee = new Employee("Иван", "Рюрикович", "Васильевич", new EmployeePost("Царь"), null);

            user = new User(employee, "И.В. Грозный", "ivanvas", "ivanvas", new Team("Тестовая команда", null), null);
        }
Exemple #5
0
        public IActionResult Post([FromBody] JuridicalPerson org)
        {
            if (org == null)
            {
                return(BadRequest());
            }

            if (ModelState.IsValid)
            {
                var existingOrg = db.JuridicalPersons
                                  .FirstOrDefault(x => x.Id == org.Id);

                if (existingOrg == null)
                {
                    db.Add(org);
                }
                else
                {
                    db.Entry(existingOrg).CurrentValues.SetValues(org);
                }
                db.SaveChanges();
                return(Ok(org));
            }
            else
            {
                return(BadRequest(ModelState.Values.Select(a => a.Errors.Select(z => z.ErrorMessage))));
            }
        }
        public void Init()
        {
            storage = new Storage("Тестовое место хранения", StorageType.DistributionCenter)
            {
                Id = 1
            };
            writeoffReason = new WriteoffReason("Тестовая причина списания")
            {
                Id = 2
            };

            var juridicalLegalForm = new LegalForm("ООО", EconomicAgentType.JuridicalPerson)
            {
                Id = 3
            };
            var juridicalPerson = new JuridicalPerson(juridicalLegalForm)
            {
                Id = 4
            };
            var juridicalPerson2 = new JuridicalPerson(juridicalLegalForm)
            {
                Id = 15
            };

            accountOrganization = new AccountOrganization("Тестовое юридическое лицо", "Тестовое юридическое лицо", juridicalPerson)
            {
                Id = 5
            };

            var provider = new Provider("Тестовый поставщик", new ProviderType("Тестовый тип поставщика"), ProviderReliability.Medium, 5)
            {
                Id = 6
            };
            var providerOrganization = new ProviderOrganization("Организация поставщика", "Организация поставщика", juridicalPerson2);
            var articleGroup         = new ArticleGroup("Тестовая группа", "Тестовая группа");
            var measureUnit          = new MeasureUnit("шт.", "Штука", "123", 0)
            {
                Id = 1
            };
            var customDeclarationNumber = new String('0', 25);

            article          = new Article("Тестовый товар А", articleGroup, measureUnit, true);
            providerContract = new ProviderContract(accountOrganization, providerOrganization, "Договор", "4645", DateTime.Now, DateTime.Now);
            provider.AddProviderContract(providerContract);

            user              = new User(new Employee("Иван", "Иванов", "Иванович", new EmployeePost("Менеджер"), null), "Иванов Иван", "ivanov", "pa$$w0rd", new Team("Тестовая команда", null), null);
            receiptWaybill    = new ReceiptWaybill("123АБВ", DateTime.Today.AddDays(1), storage, accountOrganization, provider, 1234.5M, 0M, new ValueAddedTax("18%", 18), providerContract, customDeclarationNumber, user, user, DateTime.Now);
            receiptWaybillRow = new ReceiptWaybillRow(article, 100, 1234.5M, receiptWaybill.PendingValueAddedTax);
            receiptWaybill.AddRow(receiptWaybillRow);

            writeoffWaybill = new WriteoffWaybill("123", DateTime.Today, storage, accountOrganization, writeoffReason, user, user, DateTime.Now);

            priceLists = new List <ArticleAccountingPrice>()
            {
                new ArticleAccountingPrice(article, 10M)
            };
        }
Exemple #7
0
        public void DeleteCient(int id)
        {
            JuridicalPerson tmp = GetClient(id);

            if (tmp != null)
            {
                jc.JuridicalPersons.Remove(tmp);
                jc.SaveChanges();
            }
        }
Exemple #8
0
        public void Init()
        {
            numberA = "98";

            var legalForm = new LegalForm("ООО", EconomicAgentType.JuridicalPerson);

            juridicalPersonA = new JuridicalPerson(legalForm);
            juridicalPersonB = new JuridicalPerson(legalForm);
            juridicalPersonC = new JuridicalPerson(legalForm);
            juridicalPersonD = new JuridicalPerson(legalForm);

            senderOrganizationA   = new AccountOrganization("Тестовое юридическое лицо A", "Тестовое юридическое лицо A", juridicalPersonA);
            senderOrganizationB   = new AccountOrganization("Тестовое юридическое лицо B", "Тестовое юридическое лицо B", juridicalPersonB);
            receiverOrganizationC = new AccountOrganization("Тестовое юридическое лицо C", "Тестовое юридическое лицо C", juridicalPersonC);
            receiverOrganizationD = new AccountOrganization("Тестовое юридическое лицо D", "Тестовое юридическое лицо D", juridicalPersonD);

            storageA = new Storage("Тестовое хранилище A", StorageType.DistributionCenter)
            {
                Id = 1
            };
            storageB = new Storage("Тестовое хранилище B", StorageType.TradePoint)
            {
                Id = 2
            };

            articleGroup = new ArticleGroup("Тестовая группа", "Тестовая группа");
            measureUnit  = new MeasureUnit("шт.", "Штука", "123", 0)
            {
                Id = 1
            };
            articleA      = new Article("Тестовый товар A", articleGroup, measureUnit, true);
            articleB      = new Article("Тестовый товар B", articleGroup, measureUnit, true);
            articleC      = new Article("Тестовый товар C", articleGroup, measureUnit, true);
            valueAddedTax = new ValueAddedTax("18%", 18);

            receiptWaybillRowA1 = new ReceiptWaybillRow(articleA, 300, 3000, new ValueAddedTax("18%", 18));
            receiptWaybillRowA2 = new ReceiptWaybillRow(articleA, 400, 4000, new ValueAddedTax("18%", 18));
            receiptWaybillRowB  = new ReceiptWaybillRow(articleB, 20, 250, new ValueAddedTax("18%", 18));
            receiptWaybillRowC  = new ReceiptWaybillRow(articleC, 20, 250, new ValueAddedTax("18%", 18));

            rowA1_1 = new MovementWaybillRow(receiptWaybillRowA1, 60, valueAddedTax);
            rowA1_2 = new MovementWaybillRow(receiptWaybillRowA1, 22, valueAddedTax);
            rowA2_1 = new MovementWaybillRow(receiptWaybillRowA2, 40, valueAddedTax);
            rowA2_2 = new MovementWaybillRow(receiptWaybillRowA2, 55, valueAddedTax);
            rowB    = new MovementWaybillRow(receiptWaybillRowB, 15, valueAddedTax);
            rowC    = new MovementWaybillRow(receiptWaybillRowC, 18, valueAddedTax);

            priceLists = new List <ArticleAccountingPrice>()
            {
                new ArticleAccountingPrice(articleA, 100), new ArticleAccountingPrice(articleB, 200),
                new ArticleAccountingPrice(articleC, 300)
            };

            user = new User(new Employee("Иван", "Иванов", "Иванович", new EmployeePost("Менеджер"), null), "Иванов Иван", "ivanov", "pa$$w0rd", new Team("Тестовая команда", null), null);
        }
Exemple #9
0
        public IActionResult Delete(int id)
        {
            var org = new JuridicalPerson()
            {
                Id = id
            };

            db.JuridicalPersons.Remove(org);
            db.SaveChanges();
            return(Ok());
        }
Exemple #10
0
        public void Init()
        {
            var juridicalLegalForm = new LegalForm("ООО", EconomicAgentType.JuridicalPerson);
            var physicalLegalForm  = new LegalForm("ООО", EconomicAgentType.PhysicalPerson);

            juridicalPerson = new JuridicalPerson(juridicalLegalForm)
            {
                Id                 = 1,
                CashierName        = "Кассиров В.В.",
                DirectorName       = "Директоров В.В.",
                DirectorPost       = "Главный директор",
                INN                = "123456789",
                KPP                = "2020202020",
                MainBookkeeperName = "Главбухова А.А.",
                OGRN               = "12345",
                OKPO               = "5431"
            };

            physicalPerson = new PhysicalPerson(physicalLegalForm)
            {
                Id        = 2,
                INN       = "234567890",
                OGRNIP    = "23456",
                OwnerName = "Физиков Ф.Ф.",
                Passport  = new ValueObjects.PassportInfo
                {
                    Series         = "18 00",
                    Number         = "689689",
                    IssuedBy       = "Центральным РОВД г. Волгограда",
                    IssueDate      = DateTime.Parse("04.04.2001"),
                    DepartmentCode = "342-001"
                }
            };

            accountOrganization = new AccountOrganization("short_Name", "full_Name", juridicalPerson)
            {
                Id = 21
            };
            clientOrganization = new ClientOrganization("Короткое имя", "Длинное имя", physicalPerson)
            {
                Id = 22
            };
            providerOrganization = new ProviderOrganization("Краткое имя", "Полное имя", juridicalPerson)
            {
                Id = 23
            };

            provider = new Provider("Тестовый поставщик", new ProviderType("Тестовый тип поставщика"), ProviderReliability.Medium, 5);
            provider.AddContractorOrganization(providerOrganization);

            client = new Client("Тестовый клиент", new ClientType("Тестовый тип клиента"), ClientLoyalty.Follower,
                                new ClientServiceProgram("Программа"), new ClientRegion("Волгоград"), (byte)3);
        }
        public void AccountOrganization_NotNullMustNotBeEqualToNull()
        {
            var jp   = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson));
            var org1 = new AccountOrganization("Тест", "Тест", jp)
            {
                Id = 5
            };
            AccountOrganization orgNull = null;
            bool areEqual = (org1 == orgNull);

            Assert.IsFalse(areEqual);
        }
        private bool checkIfPersonIsBusy(JuridicalPerson person)
        {
            for (int i = 0; i < ((App)Application.Current).TaxesPayedByJurPersons.Count; i++)
            {
                var item = ((App)Application.Current).TaxesPayedByJurPersons[i];

                if (item.PayerId == person.Id)
                {
                    return(true);
                }
            }

            return(false);
        }
        public void AccountOrganization_MustNotBeEqualToNonAccountOrganization()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест1", "Тест1", jp1)
            {
                Id = 5
            };
            DateTime nonAccountOrganization = new DateTime(2007, 12, 5);

            Assert.IsFalse(org1.Equals(nonAccountOrganization));
        }
        public void AccountOrganization_MustNotBeEqualToNull()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест1", "Тест1", jp1)
            {
                Id = 5
            };
            AccountOrganization accountOrganizationNull = null;

            Assert.IsFalse(org1.Equals(accountOrganizationNull));
            Assert.IsFalse(org1.Equals(null));
        }
        public void AccountOrganization_2CallsOfGetHashCode_MustReturnSameValues()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 5
            };

            var hashCode1 = org1.GetHashCode();
            var hashCode2 = org1.GetHashCode();

            Assert.IsTrue(hashCode1 == hashCode2);
        }
        public void AccountOrganization_Storage_Additon_And_Removing_Must_Be_Ok()
        {
            var storage = new Storage("Склад", StorageType.DistributionCenter);
            var jp      = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson));
            var org     = new AccountOrganization("Тест", "Тест", jp);

            org.AddStorage(storage);

            Assert.AreEqual(1, org.StorageCount);
            Assert.AreEqual(1, storage.AccountOrganizationCount);

            org.RemoveStorage(storage);

            Assert.AreEqual(0, org.StorageCount);
            Assert.AreEqual(0, storage.AccountOrganizationCount);
        }
        public void AccountOrganization_Deletion_Not_Added_Storage_Must_Throw_Exception()
        {
            try
            {
                var storage = new Storage("Склад", StorageType.DistributionCenter);
                var jp      = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson));
                var org     = new AccountOrganization("Тест", "Тест", jp);

                org.RemoveStorage(storage);

                Assert.Fail("Исключение не вызвано.");
            }
            catch (Exception ex)
            {
                Assert.AreEqual("Данное место хранения не связано с этой организацией. Возможно, оно было удалено.", ex.Message);
            }
        }
Exemple #18
0
        public void Able_to_create_instance()
        {
            var expectedFullName = "John Smith";
            var expectedAddress  = AddressMockBuilder.BuildGermany();
            var expectedPaysVAT  = true;

            var actual = new JuridicalPerson(
                expectedFullName,
                expectedAddress,
                expectedPaysVAT);

            actual.Id.Should().NotBeEmpty();
            actual.FullName.Should().Be(expectedFullName);
            actual.Address.Should().Be(expectedAddress);
            actual.PaysVAT.Should().Be(expectedPaysVAT);
            actual.InEU.Should().Be(true);
        }
Exemple #19
0
        public JuridicalPerson GetClient(int id)
        {
            //var tmp = from dc in jc.JuridicalPersons
            //          where dc.PersonId == id
            //          select dc;
            //return tmp.Count() > 0 ? tmp.First() : null;
            JuridicalPerson jurpers = jc.JuridicalPersons.Find(id);

            if (jurpers != null)
            {
                return(jurpers);
            }
            else
            {
                return(null);
            }
        }
        public void AccountOrganization_DifferentIds_MustHaveDifferent_HashCodes()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 5
            };
            var org2 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 6
            };

            Assert.IsFalse(org1.GetHashCode() == org2.GetHashCode());
        }
        public void AccountOrganization_DocumentsNumber_Must_Add_New_Year_Automatic_And_Set_Numbers_To_0()
        {
            var jp  = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson));
            var org = new AccountOrganization_Accessor("Тест", "ТестТест", jp);

            var lastNumbers = org.GetLastDocumentNumbers(2012);

            Assert.IsNotNull(lastNumbers);
            Assert.AreEqual(0, lastNumbers.ChangeOwnerWaybillLastNumber);
            Assert.AreEqual(0, lastNumbers.ExpenditureWaybillLastNumber);
            Assert.AreEqual(0, lastNumbers.MovementWaybillLastNumber);
            Assert.AreEqual(0, lastNumbers.ReceiptWaybillLastNumber);
            Assert.AreEqual(0, lastNumbers.ReturnFromClientWaybillLastNumber);
            Assert.AreEqual(0, lastNumbers.WriteoffWaybillLastNumber);
            Assert.AreEqual(2012, lastNumbers.Year);
            Assert.AreEqual(org, lastNumbers.AccountOrganization);
        }
Exemple #22
0
        public void Init()
        {
            // инициализация IoC
            IoCInitializer.Init();

            var juridicalLegalForm = new LegalForm("ООО", EconomicAgentType.JuridicalPerson);
            var juridicalPerson1   = new JuridicalPerson(juridicalLegalForm)
            {
                Id = 1
            };

            accountOrganization = new AccountOrganization("Тестовая собственная организация", "Тестовая собственная организация", juridicalPerson1)
            {
                Id = 1
            };

            var juridicalPerson2 = new JuridicalPerson(juridicalLegalForm)
            {
                Id = 2
            };

            clientOrganization = new ClientOrganization("Тестовая организация клиента", "Тестовая организация клиента", juridicalPerson2)
            {
                Id = 2
            };

            clientContractRepository = Mock.Get(IoCContainer.Resolve <IClientContractRepository>());
            dealRepository           = Mock.Get(IoCContainer.Resolve <IDealRepository>());

            dealIndicatorService = Mock.Get(IoCContainer.Resolve <IDealIndicatorService>());
            expenditureWaybillIndicatorService = Mock.Get(IoCContainer.Resolve <IExpenditureWaybillIndicatorService>());
            storageService = Mock.Get(IoCContainer.Resolve <IStorageService>());
            clientContractIndicatorService = Mock.Get(IoCContainer.Resolve <IClientContractIndicatorService>());
            taskRepository = Mock.Get(IoCContainer.Resolve <ITaskRepository>());

            dealServiceMock = new Mock <DealService>(dealRepository.Object, clientContractRepository.Object, taskRepository.Object, dealIndicatorService.Object,
                                                     expenditureWaybillIndicatorService.Object, storageService.Object, clientContractIndicatorService.Object);

            dealService = dealServiceMock.Object;

            user = new Mock <User>();
            user.Setup(x => x.GetPermissionDistributionType(It.IsAny <Permission>())).Returns(PermissionDistributionType.All);

            clientContractIndicatorService.Setup(x => x.CalculateCashPaymentLimitExcessByPaymentsFromClient(It.IsAny <ClientContract>())).Returns(0);
        }
        public void AccountOrganization_DifferentIdMustNotBeEqual()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 5
            };
            var org2 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 6
            };
            bool areEqual = (org1 == org2);

            Assert.IsFalse(areEqual);
        }
        public void AccountOrganization_DifferentIdMustHaveEqualsFalse()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 5
            };
            var org2 = new AccountOrganization("Тест", "Тест", jp1)
            {
                Id = 6
            };

            Assert.IsFalse(org1.Equals(org2));
            Assert.IsFalse(org2.Equals(org1));
        }
Exemple #25
0
        public void Able_to_create_instance_with_persistence_constructor()
        {
            var expectedId       = Guid.NewGuid();
            var expectedFullName = "John Smith";
            var expectedAddress  = AddressMockBuilder.BuildMontenegro();
            var expectedPaysVAT  = true;

            var actual = new JuridicalPerson(
                expectedId,
                expectedFullName,
                expectedAddress,
                expectedPaysVAT);

            actual.Id.Should().Be(expectedId);
            actual.FullName.Should().Be(expectedFullName);
            actual.Address.Should().Be(expectedAddress);
            actual.PaysVAT.Should().Be(expectedPaysVAT);
            actual.InEU.Should().Be(false);
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            Tax tax = null;

            foreach (var item in ((App)Application.Current).Taxes)
            {
                if (item.TaxName == TaxNamesBox.autoTextBox.Text)
                {
                    tax = item;
                }
            }

            if (!this.checkIfTaxIsValid(tax))
            {
                return;
            }

            JuridicalPerson jurPerson = null;

            foreach (var item in ((App)Application.Current).JuridicalPersons)
            {
                if (item.Name == PayersNamesBox.autoTextBox.Text)
                {
                    jurPerson = item;
                }
            }

            if (jurPerson == null)
            {
                MessageBox.Show("Юридичної особи з такою назвою не існує!");
                return;
            }

            TaxPayedByJuridicalPerson newTax = new TaxPayedByJuridicalPerson(TaxPayedByJuridicalPerson.MaxId++, tax.TaxId, jurPerson.Id, tax.TaxName, jurPerson.Name, PayDate.SelectedDate.Value, int.Parse(Amount.Text));

            string date  = Extensions.Tools.ConvertDayTimeToSqlDate(PayDate.SelectedDate.Value);
            string query = "INSERT INTO TaxesPayedByJurPersons (Id, TaxId, PayerId, TaxName, PayerName, OnPayedDate, Amount) VALUES (" + newTax.Id + ", " + newTax.TaxId + ", " + newTax.PayerId + ", '" + newTax.TaxName + "', '" + newTax.PayerName + "', '" + date + "', " + newTax.Amount + ");";

            Extensions.Tools.ExecuteQuery(query);

            ((App)Application.Current).TaxesPayedByJurPersons.Add(newTax);
        }
        public void AccountOrganization_SameIds_MustHaveEqual_HashCodes()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест1", "Тест1", jp1)
            {
                Id = 5
            };
            var jp2 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 2
            };
            var org2 = new AccountOrganization("Тест", "Тест2", jp2)
            {
                Id = 5
            };

            Assert.IsTrue(org1.GetHashCode() == org2.GetHashCode());
        }
        public void AccountOrganization_ZeroIds_DifferentValues_ShouldHaveDifferent_HashCodes()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест1", "Тест1", jp1)
            {
                Id = 0
            };
            var jp2 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 2
            };
            var org2 = new AccountOrganization("Тест2", "Тест2", jp2)
            {
                Id = 0
            };

            Assert.IsFalse(org1.GetHashCode() == org2.GetHashCode());
        }
Exemple #29
0
        public void Init()
        {
            clientType = new ClientType("Тестовый тип клиента")
            {
                Id = 1
            };
            serviceProgram = new ClientServiceProgram("Тестовая программа")
            {
                Id = 2
            };
            region = new ClientRegion("Тестовый регион")
            {
                Id = 3
            };
            client = new Client("Тестовый клиент", clientType, ClientLoyalty.Customer, serviceProgram, region, 5)
            {
                Id = 4
            };
            user = new User(new Employee("Иван", "Иванов", "Иванович", new EmployeePost("Менеджер"), null), "Иванов Иван", "ivanov", "pa$$w0rd", new Team("Тестовая команда", null), null);

            var juridicalLegalForm = new LegalForm("ООО", EconomicAgentType.JuridicalPerson);

            juridicalPerson = new JuridicalPerson(juridicalLegalForm)
            {
                Id = 1
            };
            accountOrganization = new AccountOrganization("Тестовое юридическое лицо", "Тестовое юридическое лицо", juridicalPerson)
            {
                Id = 1
            };
            clientOrganization = new ClientOrganization("Тестовая организация клиента", "Тестовая организация клиента", new JuridicalPerson(juridicalLegalForm)
            {
                Id = 2
            })
            {
                Id = 3
            };
            contract = new ClientContract(accountOrganization, clientOrganization, "12", "1", DateTime.Now, DateTime.Now);
        }
        public void AccountOrganization_SameIdMustBeEqual()
        {
            var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 1
            };
            var org1 = new AccountOrganization("Тест1", "Тест1", jp1)
            {
                Id = 5
            };
            var jp2 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson))
            {
                Id = 2
            };
            var org2 = new AccountOrganization("Тест", "Тест2", jp2)
            {
                Id = 5
            };
            bool areEqual = (org1 == org2);

            Assert.IsTrue(areEqual);
        }