Exemplo n.º 1
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     this.jobSettingsBindingSource.EndEdit();
     _clone.Clone(_current);
     this.jobSettingsBindingSource.EndEdit();
     this.DialogResult = DialogResult.Cancel;
 }
Exemplo n.º 2
0
        public async Task <bool> SaveAsync(JobSettings jobSettings)
        {
            var jobDto = jobSettings.Clone <JobSettingsDto>();

            using (var connection =
                       new SqlConnection(ConnectionString))
            {
                if (jobSettings.Id > 0)
                {
                    return(await connection.UpdateAsync(jobDto));
                }
                return(await connection.InsertAsync(jobDto) > 0);
            }
        }
Exemplo n.º 3
0
        public bool Save(JobSettings jobSettings)
        {
            var jobDto = jobSettings.Clone <JobSettingsDto>();

            using (var connection =
                       new SqlConnection(ConnectionString))
            {
                if (jobSettings.Id > 0)
                {
                    return(connection.Update(jobDto));
                }
                return(connection.Insert(jobDto) > 0);
            }
        }
Exemplo n.º 4
0
 public void SetCurrent(JobSettings settings)
 {
     _current = settings;
     _current.Clone(_clone);
     this.jobSettingsBindingSource.DataSource = _current;
     if (_current.Schedule == null)
     {
         _current.Schedule = new Never();
     }
     if (_current.Parameter == null)
     {
         _current.Parameter = new List <KeyValue>();
     }
     this.ScheduleComboBoxEdit.EditValueChanged -=
         new System.EventHandler(this.ScheduleComboBoxEdit_EditValueChanged);
     ScheduleComboBoxEdit.EditValue = null;
     ScheduleComboBoxEdit.EditValue = _current.Schedule.GetType().Name;
     LoadScheduleLayout(_current.Schedule);
     this.ScheduleComboBoxEdit.EditValueChanged += new System.EventHandler(this.ScheduleComboBoxEdit_EditValueChanged);
     keyValueBindingSource.DataSource            = _current;
     keyValueBindingSource.DataMember            = "Parameter";
     this.Text = _current.Key + @" Edit";
 }