Exemple #1
0
        private static void AddInPartnerUpdates(IPartnerDAO partnerDao, IStoreDAO storeDao, SyncModel syncModel, int fromVersion)
        {
            // Get all the partners that have changed since the last sync with this specific cloud server
            List <AndroAdminDataAccess.Domain.Partner> partners = (List <AndroAdminDataAccess.Domain.Partner>)partnerDao.GetAfterDataVersion(fromVersion);

            foreach (AndroAdminDataAccess.Domain.Partner partner in partners)
            {
                // Add the partner
                Partner syncPartner = new Partner()
                {
                    Id         = partner.Id,
                    ExternalId = partner.ExternalId,
                    Name       = partner.Name
                };

                syncModel.Partners.Add(syncPartner);

                // Get the partner DAO
                IACSApplicationDAO acsApplicationDao = AndroAdminDataAccessFactory.GetACSApplicationDAO();
                if (SyncHelper.ConnectionStringOverride != null)
                {
                    acsApplicationDao.ConnectionStringOverride = SyncHelper.ConnectionStringOverride;
                }

                // Get all the applications that have changed for this partner since the last sync with this specific cloud server
                IList <AndroAdminDataAccess.Domain.ACSApplication> acsApplications = acsApplicationDao.GetByPartnerAfterDataVersion(partner.Id, fromVersion);
                foreach (AndroAdminDataAccess.Domain.ACSApplication acsApplication in acsApplications)
                {
                    // Add the application
                    Application syncApplication = new Application()
                    {
                        Id = acsApplication.Id,
                        ExternalApplicationId = acsApplication.ExternalApplicationId,
                        Name = acsApplication.Name,
                        ExternalDisplayName = acsApplication.ExternalApplicationName
                    };
                    syncPartner.Applications.Add(syncApplication);

                    // Get all the application stores that have changed for this application since the last sync with this specific cloud server
                    StringBuilder siteIds = new StringBuilder();
                    IList <AndroAdminDataAccess.Domain.Store> acsApplicationStores = storeDao.GetByACSApplicationId(acsApplication.Id);
                    foreach (AndroAdminDataAccess.Domain.Store store in acsApplicationStores)
                    {
                        if (siteIds.Length > 0)
                        {
                            siteIds.Append(",");
                        }

                        siteIds.Append(store.AndromedaSiteId.ToString());
                    }

                    syncApplication.Sites = siteIds.ToString();
                }
            }
        }
Exemple #2
0
        public static string TryGetExportSyncXml(int fromVersion, int masterVersion, out string syncXml)
        {
            SyncModel syncModel = new SyncModel();

            // The current data version
            syncModel.FromDataVersion = fromVersion;
            syncModel.ToDataVersion   = masterVersion;

            // Get the store DAO
            IStoreDAO storeDao = AndroAdminDataAccessFactory.GetStoreDAO();
            // Get the partner DAO
            IPartnerDAO partnerDao = AndroAdminDataAccessFactory.GetPartnerDAO();
            // Get the store payment provider DAO
            IStorePaymentProviderDAO storePaymentProviderDao = AndroAdminDataAccessFactory.GetStorePaymentProviderDAO();

            //get the list of hosts, host types and connections based on version.
            //var a = AndroAdminDataAccessFactory.gethost

            if (SyncHelper.ConnectionStringOverride != null)
            {
                storeDao.ConnectionStringOverride   = SyncHelper.ConnectionStringOverride;
                partnerDao.ConnectionStringOverride = SyncHelper.ConnectionStringOverride;
                storePaymentProviderDao.ConnectionStringOverride = SyncHelper.ConnectionStringOverride;
            }

            AndroAdminSyncHelper.AddInStoreUpdates(storeDao, syncModel, fromVersion);

            AndroAdminSyncHelper.AddInPartnerUpdates(partnerDao, storeDao, syncModel, fromVersion);

            AndroAdminSyncHelper.AddInStorePaymentProviders(storePaymentProviderDao, syncModel, fromVersion);

            AndroAdminSyncHelper.AddInHubTasks(syncModel, fromVersion);

            //Menu updates as pushed on by MyAndromeda.
            AndroAdminSyncHelper.AddinMenuUpdates(syncModel, fromVersion);

            //Host V2 changes
            AndroAdminSyncHelper.AddInHostV2List(syncModel, fromVersion);

            AndroAdminSyncHelper.AddInStoreDevices(syncModel, fromVersion);
            // Serialize the sync model to XML

            ////add delivery areas to sync model
            //AndroAdminSyncHelper.AddDeliveryAreas(syncModel, fromVersion);

            //add postcodeSectors to sync model
            AndroAdminSyncHelper.AddPostCodeSectors(syncModel, fromVersion);

            AndroAdminSyncHelper.AddLoyalty(syncModel, fromVersion);

            syncXml = SerializeHelper.Serialize <SyncModel>(syncModel);

            return(string.Empty);
        }
        public ThongKeTonKho()
        {
            InitializeComponent();
            _storeDao = new StoreDAOImpl();
            var currentDate  = DateUtil.GetCurrentDateTime();
            var currentMonth = DateUtil.GetDateTimeAsDdmmyyyy(currentDate).Substring(3);

            txtFromDate.Text = "01/" + currentMonth;
            txtToDate.Text   = DateUtil.GetDateTimeAsDdmmyyyy(currentDate);
            btnThucHien_Click(null, null);
        }
Exemple #4
0
        public NhapXuatKho(ImportExportType type)
        {
            this.importExportType = type;
            this.storeType        = type.name;
            InitializeComponent();

            _storeDao = new StoreDAOImpl();

            var allMaterialDtos = _storeDao.GetAllMaterial();

            foreach (var materialDto in allMaterialDtos)
            {
                materialComboBox.Items.Add(materialDto);
            }

            txtStoreDate.Text = DateUtil.GetDateTimeAsDdmmyyyy(DateTime.Now);
            listStoreDto      = new List <StoreDto>();
        }
Exemple #5
0
        private static void AddInStoreUpdates(IStoreDAO storeDao, SyncModel syncModel, int fromVersion)
        {
            // Get all the stores that have changed since the last sync with this specific cloud server
            var stores    = storeDao.GetAfterDataVersion(fromVersion);// as List<AndroAdminDataAccess.Domain.Store>;
            var etdStores = storeDao.GetEdtAfterDataVersion(fromVersion);

            foreach (AndroAdminDataAccess.Domain.Store store in stores)
            {
                // Sync store opening times
                List <TimeSpanBlock> openingHours = new List <TimeSpanBlock>();
                if (store.OpeningHours != null)
                {
                    foreach (AndroAdminDataAccess.Domain.TimeSpanBlock timeSpanBlock in store.OpeningHours)
                    {
                        openingHours.Add(
                            new TimeSpanBlock()
                        {
                            Day        = timeSpanBlock.Day,
                            EndTime    = timeSpanBlock.EndTime,
                            OpenAllDay = timeSpanBlock.OpenAllDay,
                            StartTime  = timeSpanBlock.StartTime
                        });
                    }
                }

                // Add the store
                Store syncStore = new Store()
                {
                    AndromedaSiteId        = store.AndromedaSiteId,
                    ExternalSiteId         = store.ExternalSiteId,
                    ExternalSiteName       = store.ExternalSiteName,
                    StoreStatus            = store.StoreStatus.Status,
                    Phone                  = store.Telephone,
                    TimeZone               = store.TimeZone,
                    TimeZoneInfoId         = store.TimeZoneInfoId,
                    UiCulture              = store.UiCulture,
                    StorePaymentProviderId = store.PaymentProvider == null ? string.Empty : store.PaymentProvider.Id.ToString(),
                    Address                = new Address()
                    {
                        Id        = store.Address.Id,
                        Org1      = store.Address.Org1,
                        Org2      = store.Address.Org2,
                        Org3      = store.Address.Org3,
                        Prem1     = store.Address.Prem1,
                        Prem2     = store.Address.Prem2,
                        Prem3     = store.Address.Prem3,
                        Prem4     = store.Address.Prem4,
                        Prem5     = store.Address.Prem5,
                        Prem6     = store.Address.Prem6,
                        RoadNum   = store.Address.RoadNum,
                        RoadName  = store.Address.RoadName,
                        Locality  = store.Address.Locality,
                        Town      = store.Address.Town,
                        County    = store.Address.County,
                        State     = store.Address.State,
                        PostCode  = store.Address.PostCode,
                        DPS       = store.Address.DPS,
                        Lat       = store.Address.Lat,
                        Long      = store.Address.Long,
                        CountryId = store.Address.Country.Id
                    },
                    OpeningHours = openingHours
                };

                syncModel.Stores.Add(syncStore);
            }

            foreach (var store in etdStores)
            {
                if (syncModel.StoreEdt == null)
                {
                    syncModel.StoreEdt = new List <StoreEdt>();
                }

                syncModel.StoreEdt.Add(new StoreEdt()
                {
                    AndromedaSiteId          = store.AndromedaSiteId,
                    EstimatedTimeForDelivery = store.EstimatedDeliveryTime.GetValueOrDefault(45),
                    EstimatedCollectionTime  = store.EstimatedCollectionTime
                });
            }
        }
        public TraCuuNhapXuatKho()
        {
            InitializeComponent();

            _storeDao = new StoreDAOImpl();
        }