Example #1
0
 public FrmImport(ImportParam importParam, ImportType importFormType)
 {
     InitializeComponent();
     _ImportFormType = importFormType;
     _BeenRunSuccessfully = false;
     _CountryService = importParam.CountryService;
     _RegionService = importParam.RegionService;
     _StoreService = importParam.StoreService;
     _EmployeeService = importParam.EmployeeService;
     _CanClose = true;
     _NeedFileDialog = isNeedFileDialog();
     if (!_NeedFileDialog)
         setBusinessVolumeParams(importParam, importFormType);
     LocalizeUI();
 }
Example #2
0
        private void import(object param)
        {
            ImportBase  import      = null;
            ImportParam importParam = (ImportParam)param;

            switch (importParam.ImportType)
            {
            case ImportType.Country:
                import = new ImportCountry(importParam.FileName, (ICountryService)importParam.Service[0]);
                break;

            case ImportType.Region:
                import =
                    new ImportRegion(importParam.FileName, (ICountryService)importParam.Service[0],
                                     (IRegionService)importParam.Service[1]);
                break;

            case ImportType.Store:
                import =
                    new ImportStore(importParam.FileName, (ICountryService)importParam.Service[0],
                                    (IRegionService)importParam.Service[1], (IStoreService)importParam.Service[2]);
                break;

            case ImportType.World:
                import = new ImportWorld(importParam.FileName, (IStoreService)importParam.Service[0]);
                break;

            case ImportType.HWGR:
                import = new ImportHWGRdb(importParam.FileName, (IStoreService)importParam.Service[0]);
                break;

            case ImportType.WGR:
                import = new ImportWGRdb2(importParam.FileName, (IStoreService)importParam.Service[0]);
                break;

            case ImportType.WorkingDays:
                import = new ImportYearlyWorkingDays(importParam.FileName, (ICountryService)importParam.Service[0]);
                break;

            case ImportType.Feast:
                import = new ImportFeasts(importParam.FileName, (ICountryService)importParam.Service[0]);
                break;

            case ImportType.Employee:
                import = new ImportEmployee(importParam.FileName, (IEmployeeService)importParam.Service[0]);
                break;

            case ImportType.LongTimeAbsence:
                import = new ImportLongTimeAbsence(importParam.FileName, (IEmployeeService)importParam.Service[0]);
                break;

            case ImportType.Absence:
                import =
                    new ImportAbsence(importParam.FileName,
                                      ((ICountryService)importParam.Service[0]).AbsenceService);
                break;

            case ImportType.TimePlanning:
                import =
                    new ImportTime(importParam.FileName,
                                   ((IEmployeeService)importParam.Service[0]).EmployeeTimeService,
                                   ImportTimeType.Planning);
                break;

            case ImportType.TimeRecording:
                import =
                    new ImportTime(importParam.FileName,
                                   ((IEmployeeService)importParam.Service[0]).EmployeeTimeService,
                                   ImportTimeType.Recording);
                break;

            case ImportType.ActualBusinessVolume:
                import = new ImportBusinessVolume((IStoreService)importParam.Service[0], BusinessVolumeType.Actual);
                break;

            case ImportType.TargetBusinessVolume:
                import = new ImportBusinessVolume((IStoreService)importParam.Service[0], BusinessVolumeType.Target);
                break;

            case ImportType.CashRegisterReceipt:
                import =
                    new ImportBusinessVolume((IStoreService)importParam.Service[0],
                                             BusinessVolumeType.CashRegisterReceipt);
                break;

            default:
                throw new NotSupported();
            }
            try
            {
                if (import != null)
                {
                    import.OnAllComplete         += OnAllComplete;
                    import.OnAllProgressChanged  += OnAllProgressChanged;
                    import.OnMessage             += OnMessage;
                    import.OnTaskComplete        += OnTaskComplete;
                    import.OnTaskProgressChanged += OnTaskProgressChanged;
                    import.Run();
                }
                else
                {
                    if (OnAllComplete != null)
                    {
                        OnAllComplete(this, new CompleteEventArgs(true));
                    }
                }
            }
            catch (Exception ex)
            {
                if (OnMessage != null)
                {
                    OnMessage(this, new MessageEventArgs(ex.Message));
                }
                if (OnAllComplete != null)
                {
                    OnAllComplete(this, new CompleteEventArgs(false));
                }
            }
        }
Example #3
0
 private void setBusinessVolumeParams(ImportParam importParam, ImportType importType)
 {
     string fileName;
     switch (importType)
     {
         case ImportType.ActualBusinessVolume:
             fileName = ImportManager.BusinessVolumeActualFileSearchPattern;
             break;
         case ImportType.TargetBusinessVolume:
             fileName = ImportManager.BusinessVolumeTargetFileSearchPattern;
             break;
         case ImportType.CashRegisterReceipt:
             fileName = ImportManager.CashRegisterReceiptFileSearchPattern;
             break;
         default:
             goto case ImportType.ActualBusinessVolume;
     }
     ServerImportFoldersInfo serverImportFoldersInfo = importParam.StoreService.GetServerImportFoldersInfo();
     addTextToMemo(string.Format(GetLocalized("BVInformation"), serverImportFoldersInfo.SourceFolder, fileName, serverImportFoldersInfo.ImportedFolder));
     _ImportFormType = importType;
 }
Example #4
0
 public FrmImport(ImportParam importParam)
     : this(importParam, ImportType.All)
 {
 }
Example #5
0
        static ClientEnvironment()
        {
            GenuineGlobalEventProvider.GenuineChannelsGlobalEvent +=
                new GenuineChannelsGlobalEventHandler(GenuineGlobalEventProvider_GenuineChannelsGlobalEvent);
            _ImportParam = new ImportParam();
            _ClientVersion = GetClientVersion();
            /*
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);

            _HostConfig = (HostConfigSection)config.Sections["hostSettings"];
            if (_HostConfig == null)
            {
                _HostConfig = new HostConfigSection();
                _HostConfig.SectionInformation.AllowDefinition = ConfigurationAllowDefinition.Everywhere;
                _HostConfig.SectionInformation.AllowExeDefinition = ConfigurationAllowExeDefinition.MachineToLocalUser;
                _HostConfig.SectionInformation.ForceSave = true;
                
                config.Sections.Add("hostSettings", _HostConfig);
                config.Save(ConfigurationSaveMode.Minimal);
            }*/
        }