/// <summary> /// Get all Jobs from XML, if XML is empty then open Create Job form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_Load(object sender, EventArgs e) { try { Log.WriteMessage("Form Load Starts, Get the list of Jobs!"); GetInventoryJobs(); if (GridView.Rows.Count == 0) { GridView.Visible = false; Log.WriteMessage("Pops up Create New Job form!"); FormJobSettings objFormJobSettings = new FormJobSettings(true, "SQL Azure Database"); objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; objFormJobSettings.ShowDialog(); } Log.WriteMessage("Form Load Completed!"); } catch (Exception ex) { Log.WriteError(ex.Message); if (ex.InnerException != null) { Log.WriteError("Inner Exception: " + ex.InnerException.Message); } Log.WriteError(ex.StackTrace); } }
/// <summary> /// Open form to create new job. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sQLDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { try { FormJobSettings objFormJobSettings = new FormJobSettings(true, "SQL Azure Database"); objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; objFormJobSettings.ShowDialog(); } catch (Exception ex) { Log.WriteError(ex.Message); Log.WriteError(ex.StackTrace); if (ex.InnerException != null) { Log.WriteError("Inner Exception: " + ex.InnerException.Message); } JobStatus.Text = "Error - " + ex.Message; } }
/// <summary> /// Opens the Edit form if job is not running. /// </summary> /// <param name="IsClone">bool, indicates whether data to be edited for cloned job or existing job</param> private void EditJobDetails(bool IsClone) { if (GridView.SelectedRows.Count > 0) { DataGridViewRow drSelected = GridView.SelectedRows[0]; if (drSelected.Cells[Helper.JOBSTATUS].Value.ToString() == "Stopped" || drSelected.Cells[Helper.JOBSTATUS].Value.ToString() == "Failed") { if (IsClone) { MessageBox.Show("Cloning will copy all the fields except Job name & Destination dataset name.\nSource table(s) also need to be selected explicitly!", "Live Feed", MessageBoxButtons.OK, MessageBoxIcon.Information); } Cursor.Current = Cursors.WaitCursor; FormJobSettings objFormJobSettings; objFormJobSettings = new FormJobSettings(IsClone, "SQL Azure Database", drSelected.Cells[Helper.JOBNAME].Value.ToString(), drSelected.Cells[Helper.JOBINTERVAL].Value.ToString(), drSelected.Cells[Helper.JOBDATASET].Value.ToString()); Cursor.Current = Cursors.Default; if (IsClone) { objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; } else //For Edit { objFormJobSettings.EditJobDetails += FormJobSettings_EditJobDetails; } objFormJobSettings.ShowDialog(); } else { JobStatus.Text = "Job with running state cannot be modified / cloned!"; } } else { JobStatus.Text = "No Jobs is selected to edit!"; } }
/// <summary> /// Open form to create new job. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sQLDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { try { FormJobSettings objFormJobSettings = new FormJobSettings(true, "SQL Azure Database"); objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; objFormJobSettings.ShowDialog(); } catch (Exception ex) { Log.WriteError(ex.Message); Log.WriteError(ex.StackTrace); if (ex.InnerException != null) Log.WriteError("Inner Exception: " + ex.InnerException.Message); JobStatus.Text = "Error - " + ex.Message; } }
/// <summary> /// Get all Jobs from XML, if XML is empty then open Create Job form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_Load(object sender, EventArgs e) { try { Log.WriteMessage("Form Load Starts, Get the list of Jobs!"); GetInventoryJobs(); if (GridView.Rows.Count == 0) { GridView.Visible = false; Log.WriteMessage("Pops up Create New Job form!"); FormJobSettings objFormJobSettings = new FormJobSettings(true, "SQL Azure Database"); objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; objFormJobSettings.ShowDialog(); } Log.WriteMessage("Form Load Completed!"); } catch (Exception ex) { Log.WriteError(ex.Message); if (ex.InnerException != null) Log.WriteError("Inner Exception: " + ex.InnerException.Message); Log.WriteError(ex.StackTrace); } }
/// <summary> /// Opens the Edit form if job is not running. /// </summary> /// <param name="IsClone">bool, indicates whether data to be edited for cloned job or existing job</param> private void EditJobDetails(bool IsClone) { if (GridView.SelectedRows.Count > 0) { DataGridViewRow drSelected = GridView.SelectedRows[0]; if (drSelected.Cells[Helper.JOBSTATUS].Value.ToString() == "Stopped" || drSelected.Cells[Helper.JOBSTATUS].Value.ToString() == "Failed") { if (IsClone) MessageBox.Show("Cloning will copy all the fields except Job name & Destination dataset name.\nSource table(s) also need to be selected explicitly!", "Live Feed", MessageBoxButtons.OK, MessageBoxIcon.Information); Cursor.Current = Cursors.WaitCursor; FormJobSettings objFormJobSettings; objFormJobSettings = new FormJobSettings(IsClone, "SQL Azure Database", drSelected.Cells[Helper.JOBNAME].Value.ToString(), drSelected.Cells[Helper.JOBINTERVAL].Value.ToString(), drSelected.Cells[Helper.JOBDATASET].Value.ToString()); Cursor.Current = Cursors.Default; if (IsClone) objFormJobSettings.NewJobCreated += FormJobSettings_NewJobCreated; else//For Edit objFormJobSettings.EditJobDetails += FormJobSettings_EditJobDetails; objFormJobSettings.ShowDialog(); } else JobStatus.Text = "Job with running state cannot be modified / cloned!"; } else JobStatus.Text = "No Jobs is selected to edit!"; }