private void button_AddStep_Click(object sender, EventArgs e) { StepForm stepForm = new StepForm(); if (stepForm.ShowDialog() == DialogResult.OK) { CreateStep(GetQuestID(), stepForm.StepName, stepForm.Dialogue, stepForm.ExceptionDialogue, stepForm.GenericExDialogue, stepForm.TypedExDialogue, stepForm.GetReward(), stepForm.AmountOfAttempts); } }
private void button_EditStep_Click(object sender, EventArgs e) { var stepName = ""; var dataIndex = -1; if (dataGridView_Steps.SelectedRows.Count != 0 || dataGridView_Steps.SelectedCells.Count != 0) { dataIndex = dataGridView_Steps.CurrentCell.RowIndex; DataGridViewRow row = dataGridView_Steps.Rows[dataIndex]; stepName = row.Cells["StepName"].Value.ToString(); } if (stepName == "" || dataIndex == -1) { return; } var stepID = Int32.Parse(dataGridView_Steps.Rows[dataIndex].Cells["StepID"].Value.ToString()); var results = DatabaseManager.GetStep(stepID).Rows[0]; var dialogue = Convert.ToString(results["Dialogue"]); var exDialogue = Convert.ToString(results["ExceptionDialogue"]); var attempts = Convert.ToString(results["AmountOfAttempts"]); var reward = Convert.ToString(results["Reward"]).Split('|'); var rewardAmount = Convert.ToString(results["RewardAmount"]).Split('|'); var useGenerics = Convert.ToBoolean(results["UseGenericExceptionDialogue"]); var useTyped = Convert.ToBoolean(results["UseTypedExceptionDialogue"]); StepForm stepForm = new StepForm(stepName, dialogue, exDialogue, useGenerics, useTyped, reward, rewardAmount, attempts); if (stepForm.ShowDialog() == DialogResult.OK) { EditStep(GetQuestID(), stepID, stepForm.StepName, stepForm.Dialogue, stepForm.ExceptionDialogue, stepForm.GenericExDialogue, stepForm.TypedExDialogue, stepForm.GetReward(), stepForm.AmountOfAttempts); } PopulateStepsTable(GetQuestID()); }