private void bSaveScheduleEvent_Click(object sender, EventArgs e) { // TODO: check if all data are available and valid ScheduleEvent schEv = new ScheduleEvent(); // SQL if (!this.sql.ConnectionString.ConnectionString.Equals("")) // check if is connected ??? schEv.SQLConnectionString = this.sql.ConnectionString.ConnectionString; if (this.lbTables.SelectedIndex >= 0) schEv.SQLTable = this.lbTables.SelectedItem.ToString(); // FTP if (!this.tbFTPAdress.Text.Equals("")) schEv.FTPAddress = this.tbFTPAdress.Text; if (!this.tbFTPUserName.Text.Equals("")) schEv.FTPLogin = this.tbFTPUserName.Text; if (!this.tbFTPUserPass.Text.Equals("")) schEv.FTPPassword = this.tbFTPUserPass.Text; if (!this.tbFTPRemotePath.Text.Equals("")) schEv.FTPRemotePath = this.tbFTPRemotePath.Text; //if(this.ftp.IsValid) schEv.Interval = uint.Parse(this.tbInterval.Text); schEv.XMLFileName = this.tbXMLFileName.Text; /* * Check if any schedule event is ... */ if (this.lbScheduleEvents.SelectedIndex < 0) { /* * ... not selected, then create new one */ lbScheduleEvents.Items.Add(schEv); this.events.Add(schEv); this.events.Save(); } else { /* * ... slected then, update it */ int index = lbScheduleEvents.SelectedIndex; lbScheduleEvents.Items[index] = schEv; this.events[index] = schEv; this.events.Save(); } Console.WriteLine(schEv.ToString()); }
public ScheduleEventWrapper(ScheduleEvent schedEvent) : base() { this.attemptCounter = 0; this.sql_connectionString = schedEvent.SQLConnectionString; this.sql_table = schedEvent.SQLTable; this.ftp_address = schedEvent.FTPAddress; this.ftp_login = schedEvent.FTPLogin; this.ftp_password = schedEvent.FTPPassword; this.ftp_remotePath = schedEvent.FTPRemotePath; this.xml_fileName = schedEvent.XMLFileName; this.interval = schedEvent.Interval; }