📄 frmupdatecourse.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Students1
{
using StudentLibrary.Business;
public partial class frmUpdateCourse : Form
{
private int iCourseId;
public frmUpdateCourse(int iCourseId)
{
InitializeComponent();
this.iCourseId = iCourseId;
}
/// <summary>
/// 获取信息
/// </summary>
private void GetCourseInfo()
{
Courses courses = new Courses();
DataSet dataSet = new DataSet();
try
{
dataSet = courses.SelectCourse(
iCourseId,
-1,
-1);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataRow row = dataSet.Tables[0].Rows[0];
this.dateTimePicker1.Value = Convert.ToDateTime(row["BeginDate"]);
this.dateTimePicker2.Value = Convert.ToDateTime(row["FinishDate"]);
this.textBox2.Text = row["ClassName"].ToString();
this.textBox1.Text = row["Remark"].ToString();
this.textBox3.Text = row["SubjectName"].ToString();
}
/// <summary>
/// 更改
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
Courses courses = new Courses();
courses.UpdateCourse(
iCourseId,
this.dateTimePicker1.Value,
this.dateTimePicker2.Value,
this.textBox1.Text);
MessageBox.Show("更新成功。");
this.Close();
}
private void frmUpdateCourse_Load(object sender, EventArgs e)
{
GetCourseInfo();
}
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
Courses courses = new Courses();
courses.DeleteCourse(
iCourseId,
-1,
-1);
MessageBox.Show("删除成功。");
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -