private void buttonSave_Click(object sender, EventArgs e) { if (externalSeries == null || hmet == null) { MessageBox.Show("can not save. please try loading data"); return; } string cbtt = textBoxcbtt.Text.Trim().ToUpper(); string pcode = textBoxPcode.Text.Trim().ToUpper(); string fileName = FileUtility.GetTempFileName(".txt"); //"update" + DateTime.Now.ToString("yyyyMMMdd") + ".txt"; int counter = WriteArchivesImportFile(cbtt, pcode, fileName, GetSourceType()); labelStatus.Text = "Saved " + counter + " records to file " + fileName; Application.DoEvents(); if (counter == 0) { return; } Login login = new Login(); bool admin = Login.AdminPasswordIsValid(); if (!admin) { MessageBox.Show("You must enter the administrator password in the setup tab for this feature to work"); } if (admin && login.ShowDialog() == DialogResult.OK) { try { var un = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); Cursor = Cursors.WaitCursor; Application.DoEvents(); var results = HydrometEditsVMS.SaveDailyData(login.Username, login.Password, fileName, HydrometDataUtility.CreateRemoteFileName(login.Username, TimeInterval.Daily), false, false); TimeSeriesEditor.ShowVmsStatus(results); textBoxLastUpdate.Text = DateTime.Now.ToShortDateString() + " " + un; this.buttonSaveCsv_Click(this, EventArgs.Empty); } finally { Cursor = Cursors.Default; Logger.WriteLine("done.", "ui"); } } }
private void SaveToVMS(string fileName, Login login) { try { var un = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); Cursor = Cursors.WaitCursor; Application.DoEvents(); var results = HydrometEditsVMS.SaveDailyData(login.Username, login.Password, fileName, HydrometDataUtility.CreateRemoteFileName(login.Username, TimeInterval.Daily), false, false); TimeSeriesEditor.ShowVmsStatus(results); textBoxLastUpdate.Text = DateTime.Now.ToShortDateString() + " " + un; this.buttonSaveCsv_Click(this, EventArgs.Empty); } finally { Cursor = Cursors.Default; Logger.WriteLine("done.", "ui"); } }