Пример #1
0
 private void CreateSnapShotButton_Click(object sender, EventArgs e)
 {
     
     string HoseFilePath = string.Empty;
     string HnxFilePath = string.Empty;
     #region Error Infomation   
     if (NameFilecomboBox.Text == string.Empty)
     {
         MessageBox.Show(Properties.Resources.NameFiletextBox, Properties.Resources.ErrorInfoTitle);
         NameFilecomboBox.Focus();
         return;
     }
     if (NameCelltextBox.Text == string.Empty)
     {
         MessageBox.Show(Properties.Resources.NameCelltextBox, Properties.Resources.ErrorInfoTitle);
         NameCelltextBox.Focus();
         return;
     }
     if (SnapShotFileTextBox.Text == string.Empty)
     {
         MessageBox.Show(Properties.Resources.SnapShotFileTextBox, Properties.Resources.ErrorInfoTitle);
         SnapShotFileTextBox.Focus();
         return;
     }
     if (NameFolderHOSEtextBox.Text == string.Empty)
     {
         MessageBox.Show(Properties.Resources.NameFolderHOSEtextBox, Properties.Resources.ErrorInfoTitle);
         NameFolderHOSEtextBox.Focus();
         return;
     }
     if (NameFolderHNXtextBox.Text == string.Empty)
     {
         MessageBox.Show(Properties.Resources.NameFolderHNXtextBox, Properties.Resources.ErrorInfoTitle);
         NameFolderHNXtextBox.Focus();
         return;
     }            
     #endregion
     string fileNameSnapShot = NameFilecomboBox.Text + ".xls";
     string CellNameSnapShot = NameCelltextBox.Text;            
     try
     {              
             HoseFilePath = NameFolderHOSEtextBox.Text + "\\";
             HnxFilePath = NameFolderHNXtextBox.Text + "\\";
         Vfs.WebCrawler.Destination.Utility.UploadService.Info("Start creating SnapShot");
         Vfs.WebCrawler.Destination.Business.SnapShotService snapShotService = new SnapShotService();
         snapShotService.CreateSnapShot(this.SnapShotFileTextBox.Text, HoseFilePath, HnxFilePath, fileNameSnapShot,CellNameSnapShot);
         Vfs.WebCrawler.Destination.Utility.UploadService.Info("End of creating SnapShot");
     }
     catch(Exception ex)
     {
         Vfs.WebCrawler.Destination.Utility.UploadService.Error(ex.Message);
     }            
 }
Пример #2
0
        private void CreateSnapShotButton_Click(object sender, EventArgs e)
        {
            string HoseFilePath = string.Empty;
            string HnxFilePath = string.Empty;
            #region Error Infomation
            if (NameFilecomboBox.Text == string.Empty)
            {
                MessageBox.Show(Properties.Resources.NameFiletextBox, Properties.Resources.ErrorInfoTitle);
                NameFilecomboBox.Focus();
                return;
            }
            if (NameCelltextBox.Text == string.Empty)
            {
                MessageBox.Show(Properties.Resources.NameCelltextBox, Properties.Resources.ErrorInfoTitle);
                NameCelltextBox.Focus();
                return;
            }
            if (SnapShotFileTextBox.Text == string.Empty)
            {
                MessageBox.Show(Properties.Resources.SnapShotFileTextBox, Properties.Resources.ErrorInfoTitle);
                SnapShotFileTextBox.Focus();
                return;
            }
            if (NameFolderHOSEtextBox.Text == string.Empty)
            {
                MessageBox.Show(Properties.Resources.NameFolderHOSEtextBox, Properties.Resources.ErrorInfoTitle);
                NameFolderHOSEtextBox.Focus();
                return;
            }
            if (NameFolderHNXtextBox.Text == string.Empty)
            {
                MessageBox.Show(Properties.Resources.NameFolderHNXtextBox, Properties.Resources.ErrorInfoTitle);
                NameFolderHNXtextBox.Focus();
                return;
            }
            #endregion
            string fileNameSnapShot = NameFilecomboBox.Text + ".xls";
            string CellNameSnapShot = NameCelltextBox.Text;
            try
            {
                HoseFilePath = NameFolderHOSEtextBox.Text + "\\";
                HnxFilePath = NameFolderHNXtextBox.Text + "\\";
                Vfs.WebCrawler.Destination.Utility.UploadService.Info("Start creating SnapShot");
                Vfs.WebCrawler.Destination.Business.SnapShotService snapShotService = new SnapShotService();
                snapShotService.NameSheet = ApplicationHelper.NameSheet;
                snapShotService.CreateSnapShot(this.SnapShotFileTextBox.Text, HoseFilePath, HnxFilePath, fileNameSnapShot, CellNameSnapShot);
                Vfs.WebCrawler.Destination.Utility.UploadService.Info("End of creating SnapShot");
            }
            catch (Exception ex)
            {
                Vfs.WebCrawler.Destination.Utility.UploadService.Error(ex.Message);
            }
            #region Copy

            string fileSoureHOSE, fileTargetHOSE, fileSoureHNX, fileTargetHNX;

            fileSoureHOSE = ApplicationHelper.GetSourceFolerHOSE;
            fileTargetHOSE = ApplicationHelper.GetTargetFolerHOSE;

            fileSoureHNX = ApplicationHelper.GetSourceFolerHNX;
            fileTargetHNX = ApplicationHelper.GetTargetFolerHNX;

            try
            {
                Console.WriteLine("--------HOSE-------");
                ApplicationHelper.CopyDirectory(fileSoureHOSE, fileTargetHOSE);
                Console.WriteLine("--------HNX--------");
                ApplicationHelper.CopyDirectory(fileSoureHNX, fileTargetHNX);
            }
            catch
            {
                Console.WriteLine("Ko the copy");
            }
            #endregion
        }
        public void SetUp()
        {
            sut = new SnapShotService();

            bus = MockRepository.GenerateMock<IBus>();
            eventConvertor = MockRepository.GenerateMock<IEventConvertor>();

            var entityRepository = new InMemoryEntityRepository();
            domainRepository = new DomainRepository(new DomainEventStorageService(entityRepository, new DateTimeService()), bus, eventConvertor);
        }