Пример #1
0
        private void applyDic(object sender, EventArgs e)
        {
            txtStatus.Text = string.Empty;

            Cursor.Current = Cursors.WaitCursor;

            if (cboDictionnary.SelectedItem == null || cboEliseServer.SelectedItem == null)
            {
                MessageBox.Show("Incomplet");
            }
            else
            {
                txtStatus.Text = EliseBL.LoadDictionnary(cboDictionnary.SelectedItem.ToString(), cboEliseServer.SelectedItem.ToString());

                bool updateDicStatus = CheckUpdate(txtStatus.Text);

                string dtCreation = (DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()).Replace(':', 'h');

                string dic = cboDictionnary.SelectedItem.ToString().Replace('\\', ' ').Replace('/', ' ').Replace(':', ' ');

                string server = cboEliseServer.SelectedItem.ToString().Replace('\\', ' ').Replace('/', ' ').Replace(':', ' ');

                LogGeneral(server, dic, txtStatus.Text, dtCreation, updateDicStatus);

                LogCurrent(server, dic, dtCreation);
            }
            Cursor.Current = Cursors.Default;
        }
Пример #2
0
        private void LogCurrent(string server, string dic, string dtCreation)
        {
            var snap = EliseBL.CreateSnapshot(cboDictionnary.SelectedItem.ToString(), cboEliseServer.SelectedItem.ToString());

            string path = $@" {ConfigurationManager.AppSettings["logPath"]}/{dic} on {server} at {dtCreation}.txt";

            using (StreamWriter file = new StreamWriter(path, true))
            {
                foreach (string line in snap)
                {
                    file.WriteLine(line);
                }
            }
        }