示例#1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            if (listBoxTasks.SelectedItem == null)
            {
                return;
            }

            SchemaInfo schemaInfo = listBoxTasks.SelectedItem as SchemaInfo;

            TaskManage.Schema schema = null;

            try
            {
                QueryResult qResult = GlobalSetting.DataAccess.Excute("exec SP_GetSchema {0}", new object[] { schemaInfo.SchemaId });

                if (qResult.DataSet.Tables[0].Rows.Count > 0)
                {
                    string xmlStr = qResult.DataSet.Tables[0].Rows[0]["Schema"].ToString();
                    schema = TaskManage.Schema.ConvertFromString(xmlStr);
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            TaskManage.FrmCreateSchema frmCreateSchema = new TaskManage.FrmCreateSchema();
            frmCreateSchema.Text     = "Update task scheduler";
            frmCreateSchema.SchemaId = schemaInfo.SchemaId;
            frmCreateSchema.Schema   = schema;

            if (frmCreateSchema.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    GlobalSetting.DataAccess.Excute("exec SP_RemoveSchema {0}", new object[] { schemaInfo.SchemaId });

                    string xmlStr = frmCreateSchema.Schema.ConvertToString();

                    GlobalSetting.DataAccess.Excute("exec SP_AddSchema {0}", xmlStr);

                    List();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message,
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
示例#2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            TaskManage.FrmCreateSchema frmCreateSchema = new TaskManage.FrmCreateSchema();
            frmCreateSchema.Text = "New task scheduler";

            if (frmCreateSchema.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string xmlStr = frmCreateSchema.Schema.ConvertToString();
                    GlobalSetting.DataAccess.Excute("exec SP_AddSchema {0}", xmlStr);
                    List();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message,
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }