public void Handle(SourceDeviceCreateCommand command)
        {
            var entity = _entities.Get <Device>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Device()
                {
                    ID = command.Id,
                    CommissionedDate           = command.CommissionedDate,
                    commissioningCertID        = command.commissioningCertID,
                    deviceTypeID               = command.deviceTypeID,
                    EquipmentIDNumber          = command.EquipmentIDNumber,
                    FactoryShipmentFrom        = command.FactoryShipmentFrom,
                    FactoryShipmentTo          = command.FactoryShipmentTo,
                    ModelNumber                = command.ModelNumber,
                    ProductLineID              = command.ProductLineID,
                    RadiationBoardSerialNumber = command.RadiationBoardSerialNumber,
                    RequiresIBQCTests          = command.RequiresIBQCTests,
                    roomID = command.roomID,
                    SalesLicenceFileReferenceNumber = command.SalesLicenceFileReferenceNumber,
                    SalesLicenceNumber = command.SalesLicenceNumber,
                    SerialNo           = command.SerialNo,
                    submodalityID      = command.submodalityID,

                    Deleted = command.Deleted
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
        public void Handle(SourceCountryUpdateCommand command)
        {
            var entity = _entities.Get <Country>()
                         .SingleOrDefault(p => p.ISOCode == command.Id);

            if (entity == null)
            {
                entity = new Country()
                {
                    ISOCode     = command.Id,
                    CurrencyID  = command.CurrencyId,
                    CountryName = command.CountryName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.CurrencyID  = command.CurrencyId;
                entity.CountryName = command.CountryName;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
        public void Handle(SourceCustomerCreateCommand command)
        {
            var entity = _entities.Get <Customer>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Customer()
                {
                    ID                   = command.Id,
                    CustomerRef          = command.CustomerRef,
                    AccountRef           = command.AccountRef,
                    customerLocalityID   = command.customerLocalityID,
                    CustomerName         = command.CustomerName,
                    CustomerNameFriendly = command.CustomerNameFriendly,
                    customerTypeID       = command.customerTypeID,
                    Deleted              = command.Deleted,
                    IsGovernment         = command.IsGovernment,
                    IsInternational      = command.IsInternational,
                    managementCompanyID  = command.managementCompanyID,
                    PractiscId           = command.PractiscId,
                    RegistrationNo       = command.RegistrationNo,
                    VATNo                = command.VATNo
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
        public void Handle(SourceRoomUpdateCommand command)
        {
            var entity = _entities.Get <Room>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Room()
                {
                    ID           = command.Id,
                    departmentID = command.DepartmentId,
                    RoomNo       = command.RoomNo
                };
                _entities.Create(entity);
            }
            else
            {
                entity.ID           = command.Id;
                entity.departmentID = command.DepartmentId;
                entity.RoomNo       = command.RoomNo;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
        public void Handle(SourceCurrencyUpdateCommand command)
        {
            var entity = _entities.Get <Currency>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Currency()
                {
                    ID     = command.Id,
                    Symbol = command.Symbol,
                    DefaultRateOfExchange = command.DefaultRateOfExchange,
                    CurrencyName          = command.CurrencyName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.CurrencyName = command.CurrencyName;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
        public void Handle(SourceSiteCreateCommand command)
        {
            var entity = _entities.Get <Site>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Site()
                {
                    ID = command.Id,
                    marketSegmentID = command.MarketSegmentId,
                    customerID      = command.CustomerId,
                    RegistrationNo  = command.RegistrationNumber,
                    SiteRef         = command.SiteRef,
                    SiteName        = command.SiteName,
                    supportBranchID = command.SupportBranchId,
                    VATNo           = command.VATNumber,
                    Deleted         = command.Deleted
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
        public void Handle(SourceCustomerLocalityUpdateCommand command)
        {
            var entity = _entities.Get <CustomerLocality>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new CustomerLocality()
                {
                    ID = command.Id,

                    CustomerLocalityName = command.CustomerLocalityName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.CustomerLocalityName = command.CustomerLocalityName;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
        public void Handle(QuoteCalculationItemSaveCommand command)
        {
            var entity = _entities.Get <QuoteCalculationItem>().SingleOrDefault(p => p.ID == command.ID);

            if (entity == null)
            {
                entity = new QuoteCalculationItem()
                {
                    ID = command.ID,
                    QuoteCalculationID = command.QuoteCalculationID,
                    YearNo             = command.YearNo,
                    ROEPortionAmount   = command.ROEPortionAmount,
                    ZARPortionAmount   = command.ZARPortionAmount,
                    ROE           = command.ROE,
                    IncrPerc      = command.IncrPerc,
                    AmountInclVAT = command.AmountInclVAT,
                    AmountExclVAT = command.AmountExclVAT
                };
                _entities.Create(entity);
            }
            else
            {
                entity.QuoteCalculationID = command.QuoteCalculationID;
                entity.YearNo             = command.YearNo;
                entity.ROEPortionAmount   = command.ROEPortionAmount;
                entity.ZARPortionAmount   = command.ZARPortionAmount;
                entity.ROE           = command.ROE;
                entity.IncrPerc      = command.IncrPerc;
                entity.AmountExclVAT = command.AmountExclVAT;
                entity.AmountInclVAT = command.AmountInclVAT;
            }

            _entities.SaveChanges();
            command.ID = entity.ID;
        }
Exemple #9
0
        public void Handle(SourceProductLineUpdateCommand command)
        {
            var entity = _entities.Get <ProductLine>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new ProductLine()
                {
                    ID              = command.Id,
                    supplierID      = command.SupplierId,
                    ProductLineName = command.ProductLineName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.ProductLineName = command.ProductLineName;
                entity.supplierID      = command.SupplierId;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
        public void Handle(SourceDepartmentUpdateCommand command)
        {
            var entity = _entities.Get <Department>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Department()
                {
                    ID = command.Id,
                    hospitalDepartmentID = command.hospitalDepartmentID,
                    ResponsibleUserName  = command.ResponsibleUserName,
                    siteID  = command.siteID,
                    Deleted = command.Deleted
                };
                _entities.Create(entity);
            }
            else
            {
                entity.hospitalDepartmentID = command.hospitalDepartmentID;
                entity.ResponsibleUserName  = command.ResponsibleUserName;
                entity.siteID  = command.siteID;
                entity.Deleted = command.Deleted;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
Exemple #11
0
        public void Handle(SourceSubModalityUpdateCommand command)
        {
            var entity = _entities.Get <SubModality>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new SubModality()
                {
                    ID                    = command.Id,
                    modalityID            = command.ModalityId,
                    ProductClassification = command.ProductClassification,
                    SubModalityName       = command.SubModalityName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.SubModalityName       = command.SubModalityName;
                entity.modalityID            = command.ModalityId;
                entity.ProductClassification = command.ProductClassification;
            }
            int rowsAffected = _entities.SaveChanges();

            if (rowsAffected > 0)
            {
            }
        }
Exemple #12
0
        public void Handle(SourceModalityCreateCommand command)
        {
            var entity = _entities.Get <Modality>()
                         .SingleOrDefault(p => p.ID.ToString() == command.Id);

            if (entity == null)
            {
                entity = new Modality()
                {
                    ID           = command.Id,
                    ModalityName = command.ModalityName
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
        public void Handle(SourceSupplierCreateCommand command)
        {
            var entity = _entities.Get <Supplier>()
                         .SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Supplier()
                {
                    ID           = command.Id,
                    SupplierName = command.SupplierName
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
        public void Handle(QuoteSaveCommand command)
        {
            var entity = _entities.Get <Quote>().SingleOrDefault(p => p.ID == command.ID);

            if (entity == null)
            {
                entity = new Quote()
                {
                    ID             = command.ID,
                    CreateDate     = DateTime.Now,
                    CustomerID     = command.CustomerID,
                    DeviceID       = command.DeviceID,
                    TenderNo       = command.TenderNo,
                    QuoteRef       = command.QuoteRef,
                    SellingPrice   = command.SellingPrice,
                    BaseContractID = command.BaseContractID,
                    ROE            = command.ROE,
                    ROEDate        = command.ROEDate,
                    VAT            = command.VAT,
                    ContractTerm   = command.ContractTerm,
                    Deleted        = command.Deleted
                };
                _entities.Create(entity);
            }
            else
            {
                entity.CustomerID     = command.CustomerID;
                entity.DeviceID       = command.DeviceID;
                entity.TenderNo       = command.TenderNo;
                entity.QuoteRef       = command.QuoteRef;
                entity.BaseContractID = command.BaseContractID;
                entity.SellingPrice   = command.SellingPrice;
                entity.ROE            = command.ROE;
                entity.ROEDate        = command.ROEDate;
                entity.VAT            = command.VAT;
                entity.ContractTerm   = command.ContractTerm;
                entity.Deleted        = command.Deleted;
            }

            _entities.SaveChanges();
            command.ID = entity.ID;
        }
        public void Handle(TestSaveCommand command)
        {
            var entity = _entities.Get <Test>().SingleOrDefault(p => p.ID == command.Id);

            if (entity == null)
            {
                entity = new Test()
                {
                    ID    = command.Id,
                    Test1 = command.TestName
                };
                _entities.Create(entity);
            }
            else
            {
                entity.Test1 = command.TestName;
            }

            _entities.SaveChanges();
        }
        public void Handle(QuoteCalculationSaveCommand command)
        {
            var entity = _entities.Get <QuoteCalculation>().SingleOrDefault(p => p.ID == command.ID);

            if (entity == null)
            {
                entity = new QuoteCalculation()
                {
                    ID                     = command.ID,
                    QuoteID                = command.QuoteID,
                    ContractTypeID         = command.ContractTypeID,
                    SellingPricePerc       = command.SellingPricePerc,
                    SellingPricePercAmount = command.SellingPricePercAmount,
                    BasePrice              = command.BasePrice,
                    ROEPortion             = command.ROEPortion,
                    ZARPortion             = command.ZARPortion,
                    ROEPortionAmount       = command.ROEPortionAmount,
                    ZARPortionAmount       = command.ZARPortionAmount
                };
                _entities.Create(entity);
            }
            else
            {
                entity.QuoteID                = command.QuoteID;
                entity.ContractTypeID         = command.ContractTypeID;
                entity.SellingPricePerc       = command.SellingPricePerc;
                entity.SellingPricePercAmount = command.SellingPricePercAmount;
                entity.BasePrice              = command.BasePrice;
                entity.ROEPortion             = command.ROEPortion;
                entity.ZARPortion             = command.ZARPortion;
                entity.ROEPortionAmount       = command.ROEPortionAmount;
                entity.ZARPortionAmount       = command.ZARPortionAmount;
            }

            _entities.SaveChanges();
            command.ID = entity.ID;
        }