示例#1
0
 public TransferOfData(
     ConvertingOfPriceList ConvertingOfPL, ManagementOfPriceList ManagementOfPL,
     ExchangeFTPAndLocalDataBase ExchangeFTPAndLDB)
     : this(ConvertingOfPL, ManagementOfPL, ExchangeFTPAndLDB, "")
 {
     //
 }
示例#2
0
 public TransferOfData(
     ConvertingOfPriceList ConvertingOfPL, ManagementOfPriceList ManagementOfPL,
     ExchangeFTPAndLocalDataBase ExchangeFTPAndLDB, string PathToLogFile)
     : base(PathToLogFile)
 {
     //
     // Initializing Fields Of Transfer
     //
     this.ConvertingOfPL    = ConvertingOfPL;
     this.ManagementOfPL    = ManagementOfPL;
     this.ExchangeFTPAndLDB = ExchangeFTPAndLDB;
     //
 }
        // Initializing Of Fields
        public void InitializingOfFields()
        {
            //
            // Initializing Paths Of Starting Folder And Log File
            //
            string PathOfStartingFolder = System.Windows.Forms.Application.StartupPath;

            this.PathToLogFile        = PathOfStartingFolder + "\\ServerOfTransferOfPriceLists.txt";
            this.EnableScrapingLog    = true;
            this.CountOfRowsInLogFile = 1000;
            //
            this.PathToFileOfSettings = PathOfStartingFolder + "\\Settings.bin";
            //
            // Reading Settings Of Working
            //
            CurrentSettings = new DataTable("Settings");
            DataTable SettingsOfWorking = GettingSettings();

            //
            // Initializing Converting Of PriceList
            //
            try
            {
                Converting = new ConvertingOfPriceList(this.PathToLogFile);
                //
                // Settings Of ConvertingOfPriceList
                //

                /*Converting.PathToFolderOfPriceLists =
                 *  SettingsOfWorking.Rows.Find("PathToFolderOfPriceLists")["Value"].ToString();*/
                Converting.IDOfPharmacy =
                    (int)SettingsOfWorking.Rows.Find("IDOfPharmacy")["Value"];
                Converting.MaskOfFullPriceList =
                    SettingsOfWorking.Rows.Find("MaskOfFullPriceList")["Value"].ToString();
                Converting.MaskOfReceipts =
                    SettingsOfWorking.Rows.Find("MaskOfReceptionOfPriceList")["Value"].ToString();
                Converting.MaskOfDeleting =
                    SettingsOfWorking.Rows.Find("MaskOfDefectionOfPriceList")["Value"].ToString();
                //

                /*Converting.NotDeletingPriceList =
                 *  (bool)SettingsOfWorking.Rows.Find("NotDeletingPriceList")["Value"];*/
                Converting.UseOfIDOfPriceList = (bool)SettingsOfWorking.Rows.Find("UseOfIDOfPriceList")["Value"];
                //
                Converting.ShowingMessages = false;
            }
            catch (Exception E)
            {
                //
                this.RecordingInLogFile(
                    String.Format("ERROR Error At Initializaing ConvertingOfPriceList: {0}", E.Message));
            }
            //
            RecordingInLogFile("Initializing ConvertingOfPriceList");
            //
            // Initializing Reading Of Information Data For MySQL
            //
            try
            {
                Reading =
                    new Reading.ReadingOfDataForMySQL(
                        SettingsOfWorking.Rows.Find("StringOfConnection")["Value"].ToString(),
                        PathOfStartingFolder + "\\", this.PathToLogFile);
                //
                // Settings Of ReadingOfInformationDataForMySQL
                //
                Reading.ShowingMessages = false;
            }
            catch (Exception E)
            {
                //
                this.RecordingInLogFile(
                    String.Format("ERROR Error At Initializaing ReadingOfInformationDataForMySQL: {0}", E.Message));
            }
            //
            RecordingInLogFile("Initializing ReadingOfInformationDataForMySQL");
            //
            // Initializing Management Of PriceList
            //
            try
            {
                Management = new ManagementOfPriceList(
                    SettingsOfWorking.Rows.Find("StringOfConnection")["Value"].ToString(),
                    Reading, this.PathToLogFile);
                //
                // Settings Of ManagementOfPriceList
                //
                Management.LoadingPriceListIsCompleted += new ManagementOfPriceList.ReturnOfEvent(Management_LoadingPriceListIsCompleted);
                Management.ShowingMessages              = false;
                //Management.SizeOfPackageOfUpdating = 1000;
            }
            catch (Exception E)
            {
                //
                this.RecordingInLogFile(
                    String.Format("ERROR Error At Initializaing ManagementOfPriceList: {0}", E.Message));
            }
            //
            RecordingInLogFile("Initializing ManagementOfPriceList");
            //
            // Exchange FTP And Local DataBase
            //
            try
            {
                Exchange = new ExchangeFTPAndLocalDataBase(this.PathToLogFile);
                //
                // Settings Of ExchangeFTPAndLocalDataBase
                //
                Exchange.PathToArchivingProgram = PathOfStartingFolder + "\\Rar.exe";
                Exchange.PathToImportOfFTP      = SettingsOfWorking.Rows.Find("PathOfImportingData")["Value"].ToString();
                Exchange.PathToTMPFolder        = Path.GetDirectoryName(PathOfStartingFolder) + "\\TMP\\";
                Exchange.UsePassive             = (bool)SettingsOfWorking.Rows.Find("UsePassive")["Value"];
                //
                Exchange.ShowingMessages         = false;
                Exchange.IncludedShowingMessages = false;
            }
            catch (Exception E)
            {
                //
                this.RecordingInLogFile(
                    String.Format("ERROR Error At Initializaing ExchangeFTPAndLocalDataBase: {0}", E.Message));
            }
            //
            RecordingInLogFile("Initializing ExchangeFTPAndLocalDataBase");
            //
            // Transfer Of Data
            //
            try
            {
                Transfer = new TransferOfData(Converting, Management, Exchange, this.PathToLogFile);
                //
                // Settings Of TransferOfData
                //
                Transfer.DatesOfTransfer    = Reading.GettingDatesOfTransfer();
                Transfer.PathToSendLogFile  = this.PathToLogFile;
                Transfer.StringOfConnection = SettingsOfWorking.Rows.Find("StringOfConnection")["Value"].ToString();
                Transfer.IDOfDrugstore      = (int)SettingsOfWorking.Rows.Find("IDOfPharmacy")["Value"];
                //
                Transfer.ShowingMessages = false;
                //
                // Creating List Of Settings
                //
                DataSet Settings = new DataSet("SendingData");
                //
                DataTable InformationOfSettings = new DataTable("InformationOfSettings");
                InformationOfSettings.Columns.Add("Key", typeof(string));
                InformationOfSettings.Columns.Add("Value", typeof(object));
                InformationOfSettings.Rows.Add("VersionOfSettings", "1");
                InformationOfSettings.Rows.Add("VersionOfApplication", "1.5.0.0");
                Settings.Tables.Add(InformationOfSettings);
                //
                DataTable ListOfSettings = GettingSettings().Copy();;
                ListOfSettings.TableName = "ListOfSettings";
                Settings.Tables.Add(ListOfSettings);
                //
                Settings.AcceptChanges();
                //
                Transfer.Settings = Settings;
                //
            }
            catch (Exception E)
            {
                //
                this.RecordingInLogFile(
                    String.Format("ERROR Error At Initializaing TransferOfData: {0}", E.Message));
            }
            RecordingInLogFile("Initializing TransferOfData");
            //
            //Transfer.SendingLog();
        }