private bool NeedDeleteStringAddress(StringAddress stringAddress, IEnumerable <AddressData> advAddresses)
 {
     return(!advAddresses.Any(
                sa =>
                sa.Value == stringAddress.Description &&
                sa.OrderBy == stringAddress.OrderBy));
 }
Exemplo n.º 2
0
        public void GoTest()
        {
            FacadeApplicationLayerMaster m_Master = new FacadeApplicationLayerMaster();
            string m_MasterToString  = m_Master.ToString();
            GuardedDataProvider m_gp = new GuardedDataProvider("GoTest", m_Master);
            string m_gpToString      = m_gp.ToString();

            Assert.AreEqual(m_gpToString, m_MasterToString, "ToString error");
            StringAddress m_address = new StringAddress("DummyAddress");

            Assert.IsFalse(m_gp.Connected, "State error");
            m_gp.ConnectReq(m_address);
            Assert.IsTrue(m_gp.Connected, "State error");
            FacadeBlockDescription m_block = new FacadeBlockDescription(int.MaxValue, 100, short.MaxValue);
            IReadValue             m_readVal;

            switch (m_gp.ReadData(m_block, int.MaxValue, out m_readVal, byte.MaxValue))
            {
            case AL_ReadData_Result.ALRes_DatTransferErrr:
            case AL_ReadData_Result.ALRes_DisInd:
                Assert.Fail("incorrect return value from ReadData");
                break;

            case AL_ReadData_Result.ALRes_Success:
                Assert.IsNotNull(m_readVal, "ReadData returned null");
                m_readVal.ReturnEmptyEnvelope();
                break;
            }
            Assert.IsTrue(m_gp.Connected, "State error");
            IWriteValue m_writeVal = m_gp.GetEmptyWriteDataBuffor(m_block, int.MaxValue);

            m_writeVal.WriteValue(int.MaxValue, 0);
            switch (m_gp.WriteData(ref m_writeVal, byte.MaxValue))
            {
            case AL_ReadData_Result.ALRes_DatTransferErrr:
            case AL_ReadData_Result.ALRes_DisInd:
                Assert.Fail("incorrect return value from ReadData");
                break;

            case AL_ReadData_Result.ALRes_Success:
                Assert.IsNull(m_writeVal, "WriteData has not returned the envelope to a pool");
                break;
            }
            Assert.IsTrue(m_gp.Connected, "State error");
            m_gp.DisReq();
            Assert.IsFalse(m_gp.Connected, "State error");
            m_gp.Dispose();
        }
Exemplo n.º 3
0
        public StringAddress SetStringAddress(StringAddress stringAddress, bool isActual, DbTransaction dbTran)
        {
            SetStringAddress(
                dbTran: dbTran,
                stringId: stringAddress.StringId,
                addressId: stringAddress.AddressId,
                cityId: stringAddress.CityId,
                metroId: stringAddress.MetroId,
                street: stringAddress.Street,
                house: stringAddress.House,
                corps: stringAddress.Corps,
                building: stringAddress.Building,
                description: stringAddress.Description,
                orderBy: stringAddress.OrderBy,
                isActual: isActual);

            return(stringAddress);
        }
Exemplo n.º 4
0
        public StringAddress Create(int stringId, Address address, int orderBy)
        {
            var stringAddress = new StringAddress
            {
                StringId    = stringId,
                AddressId   = address.Id,
                CityId      = address.CityId,
                MetroId     = address.MetroId,
                Street      = address.Street,
                House       = address.House,
                Corps       = address.Corps,
                Building    = address.Building,
                Description = address.Description,
                OrderBy     = orderBy
            };

            return(stringAddress);
        }
 private void DeleteStringAddress(StringAddress stringAddress, DbTransaction dbTran)
 {
     _repository.SetStringAddress(stringAddress, isActual: false, dbTran);
     _context.Entry(stringAddress).Reload();
 }