Exemplo n.º 1
0
 private string GetDestPath(string sourcePath)
 {
     FileInfo file = new FileInfo(sourcePath);
     RegistrySettingManager registrySettingManager=new RegistrySettingManager();
     string destPath =Path.Combine(registrySettingManager.InstallLocation,"bin",file.Name);
     return destPath ;
 }
Exemplo n.º 2
0
        public void Update()
        {
            try
            {
                RegistrySettingManager registrySettingManager=new RegistrySettingManager();

                string osVersion=Methods.GetOsVersion();
                int numberOfModules = 1;
                int moduleType = 1;
                int moduleVersion = registrySettingManager.Module1Version;

                HttpWebRequest request = this.SendPostRequest(RscSetting.UpdateServiceAddress,null, _softwareSerial, _hardwareSerial,osVersion
                    , numberOfModules, moduleType,moduleVersion);

                _httpWebRequestState = new WebRequestState(1024);
                _httpWebRequestState.StartTime = DateTime.Now;
                _httpWebRequestState.Request = request;

                if (!Cancel)
                    request.BeginGetResponse(this.ResponseCallback, _httpWebRequestState);
            }
            catch (Exception exp)
            {
                Logger.Log(exp, "Update - Update");
                OnDownloadCompleted(true);
            }
        }
Exemplo n.º 3
0
 private void InstallDone()
 {
     lblStatus.Content = "به روز رسانی با موفقیت نصب شد.";
     StreamReader sr=new StreamReader("version.txt");
     int version = int.Parse(sr.ReadLine());
     RegistrySettingManager registrySettingManager=new RegistrySettingManager();
     registrySettingManager.Module1Version = version;
     registrySettingManager.LastUpdateDate = DateTime.Now;
 }
Exemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Logger.Append = true;
            Logger.Path = @".\Logs\InitializerLog.shd";

            RegistrySettingManager registrySetting=new RegistrySettingManager();
            if(registrySetting.IsServer && !registrySetting.InitDone)
                Application.Run(new Form1());
        }
Exemplo n.º 5
0
        public WindowsService()
        {
            smsTimer = new Timer();
            diffTimer = new Timer();
            fullTimer = new Timer();
            registery = new RegistrySettingManager();
            sqlserverManagment = new SqlServerManagement(registery.SqlServer, registery.SqlServerInstance);

            file.AutoFlush = true;
            file.WriteLine("service newed");
            // timer for sms
            smsTimer.Interval = 12 * 60 * 60 * 1000;//har 12 saat
            smsTimer.AutoReset = true;
            smsTimer.Enabled = true;
            smsTimer.Elapsed += (x, y) => onSmsTimerElapsed();
            // timer for diff backup
            diffTimer.Interval = 60 * 1000;//har 1 daghighe
            diffTimer.AutoReset = true;
            diffTimer.Enabled = true;
            diffTimer.Elapsed += (x, y) => {
                if (registery.AutomaticBackup
                    && registery.LastDiffBackUpTime.HasValue
                    && (DateTime.Now - registery.LastDiffBackUpTime.Value).TotalHours >= registery.DiffBackUpPeriod
                    )
                onDiffTimerElapsed();
            };
            // timer for full backup
            fullTimer.Interval = 60*60*1000;//har 1 saat
            fullTimer.AutoReset = true;
            fullTimer.Enabled = true;
            fullTimer.Elapsed += (x, y) =>
            {
                if (registery.AutomaticBackup
                    && registery.LastFullBackUpTime.HasValue
                    && (DateTime.Now - registery.LastFullBackUpTime.Value).TotalDays == registery.FullBackUpPeriod
                    && DateTime.Parse(registery.FullBackUpTime).TimeOfDay >= DateTime.Now.TimeOfDay)
                    onFullTimerElapsed();
            };

            this.Disposed += (x, y) => { smsTimer.Dispose(); fullTimer.Dispose(); diffTimer.Dispose(); file.Close(); };

            //service setting
            this.ServiceName = "ShayanDentalBackUp";
            this.EventLog.Log = "Application";
            this.CanHandlePowerEvent = true;
            this.CanHandleSessionChangeEvent = true;
            this.CanPauseAndContinue = true;
            this.CanShutdown = true;
            this.CanStop = true;

            file.WriteLine("service new" + DateTime.Now);
        }
Exemplo n.º 6
0
 private void OnInitializeDone(InitializeDoneEventArgs e)
 {
     if (e.Error == -1)
     {
         RegistrySettingManager registrySettingManager=new RegistrySettingManager();
         registrySettingManager.InitDone = true;
         Application.Exit();
     }
     else
     {
         Methods.ShowStandardMsgBox(FormMessageType.Error, "خطا","خطا در مرحله "+e.Error.ToString()+"اتفاق افتاده است.");
     }
 }
Exemplo n.º 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            RegistrySettingManager registrySettingManager=new RegistrySettingManager();

            if(registrySettingManager.InitDone)
                Application.Exit();

            Initialize init=new Initialize();
            init.InitializeDone += init_InitializeDone;
            init.InitializeProgressChanged += init_InitializeProgressChanged;

            init.StartAsync(".",registrySettingManager.SqlServerInstance
                ,Path.Combine(registrySettingManager.InstallLocation,"Database"));
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            /*
            XmlSettingManager sm = new XmlSettingManager("settings.xml");
            Console.WriteLine(sm.NetworkAddress);
               // sm.RvgAddress = "YESS!!!";
            Console.WriteLine(sm.RvgAddress);
            sm.Save();
            Console.ReadLine();
             */

            RegistrySettingManager m=new RegistrySettingManager();

            Console.ReadLine();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            RegistrySettingManager registery = new RegistrySettingManager();
            SqlServerManager sqlserverManagment = new SqlServerManager(registery.SqlServer, registery.SqlServerInstance);

            if (args.Length > 0 && args[0] == "ShayanDentalService")
            {
                if(args[1]=="SMS")
                    new SendSmsReminder();
                else if(args[1]=="Full"){
                    sqlserverManagment.FullBackUp("ShayanDentalDB", registery.FullBackUpFirstPath);
                    //todo copy
                }
                else if (args[2] == "Diff")
                {
                    sqlserverManagment.DifferentialBackUp("ShayanDentalDB", registery.FullBackUpFirstPath);
                    //todo copy
                }
            }
        }