Ejemplo n.º 1
0
 /// <summary>
 /// Selection changed
 /// </summary>
 private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     isNew = false;
     try
     {
         string id = (string)comboBox1.SelectedValue;
         IntelliScraper.Db.intelliScraperProjectFtpSetting f = (from x in Factory.Instance.i.Project.FtpSetting where x.id == id select x).FirstOrDefault();
         currentFtp = f;
         if (f != null)
         {
             txtDomain.Text = f.domain;
             txtFptServerString.Text = f.ftpServerString;
             txtNewId.Text = f.id;
             txtPassword.Text = f.pass;
             txtUserName.Text = f.user;
             chkAuthenticate.IsChecked = f.authenticate;
         }
     }
     catch (Exception ex)
     {
         MainWindow.main.Status = "Error : " + ex.Message;
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            p.hide();
            try
            {

                if (validate())
                {
                    //Add
                    if (isNew)
                    {
                        if (!string.IsNullOrEmpty(txtNewId.Text) && !string.IsNullOrEmpty(txtFptServerString.Text))
                        {

                            IntelliScraper.Db.intelliScraperProjectFtpSetting f = new IntelliScraper.Db.intelliScraperProjectFtpSetting();
                            f.domain = txtDomain.Text;
                            f.ftpServerString = txtFptServerString.Text;
                            f.id = txtNewId.Text;
                            f.pass = txtPassword.Text;
                            f.user = txtUserName.Text;
                            f.authenticate = (bool)chkAuthenticate.IsChecked;

                            Factory.Instance.i.Project.FtpSetting.Add(f);
                            Factory.Instance.Save();
                            load();
                            MainWindow.main.Status = "Added!";
                        }
                        else
                        {
                            MessageBox.Show("Id & FptServerString mandatory!");
                            return;
                        }
                    }
                    //update
                    else
                    {
                        string id = (string)comboBox1.SelectedValue;
                        IntelliScraper.Db.intelliScraperProjectFtpSetting f = (from x in Factory.Instance.i.Project.FtpSetting where x.id == id select x).FirstOrDefault();

                        f.domain = txtDomain.Text;
                        f.ftpServerString = txtFptServerString.Text;
                        f.id = txtNewId.Text;
                        f.pass = txtPassword.Text;
                        f.user = txtUserName.Text;
                        f.authenticate = (bool)chkAuthenticate.IsChecked;
                        Factory.Instance.Save();
                        load();
                        MainWindow.main.Status = "Updated!";
                    }
                }
                else p.showCannotSave(button1);
               
            }
            catch (Exception ex)
            {
                MainWindow.main.Status = "Error : " + ex.Message;
            }
        }