📄 repairfinishform.aspx.cs
字号:
//文件名:RepairFinishForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class RepairManage_RepairFinishForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("C3") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//显示选择的维修登记信息
this.TextBox2.Text = this.GridView1.SelectedRow.Cells[1].Text.ToString();
this.TextBox3.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[3].Text.ToString();
this.TextBox5.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString();
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString();
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString();
this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[11].Text.ToString();
this.TextBox10.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{//新增完修登记信息
this.SqlDataSource3.Insert();
this.SqlDataSource2.DataBind();
this.GridView1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{//修改完修登记信息
this.SqlDataSource3.Update();
}
protected void Button4_Click(object sender, EventArgs e)
{//打印完修登记凭证
Server.Transfer("~/RepairManage/RepairFinishPrint.aspx");
}
public String MyPrint维修编号
{//设置要传递到打印页的数据
get
{
return this.TextBox2.Text;
}
}
public String MyPrint修理结果
{//设置要传递到打印页的数据
get
{
return this.DropDownList1.SelectedValue;
}
}
public String MyPrint完修日期
{//设置要传递到打印页的数据
get
{
return this.TextBox9.Text;
}
}
public String MyPrint补充说明
{//设置要传递到打印页的数据
get
{
return this.TextBox8.Text;
}
}
public String MyPrint客户名称
{//设置要传递到打印页的数据
get
{
return this.DropDownList2.SelectedItem.Text;
}
}
protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)
{//弹出删除操作确认对话框
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button MyButton = (Button)e.Row.FindControl("Button1");
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')";
}
}
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{//显示选择的记录
this.TextBox1.Text = this.GridView2.SelectedRow.Cells[2].Text.ToString();
this.TextBox2.Text = this.GridView2.SelectedRow.Cells[3].Text.ToString();
this.DropDownList1.SelectedValue = this.GridView2.SelectedRow.Cells[4].Text.ToString();
this.TextBox9.Text = DateTime.Parse(this.GridView2.SelectedRow.Cells[5].Text.ToString()).ToShortDateString();
this.TextBox8.Text = this.GridView2.SelectedRow.Cells[6].Text.ToString();
String MyID = this.GridView2.SelectedRow.Cells[3].Text.ToString();
DataTable MyTable = new DataTable();
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyServiceDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
string MySQL = "SELECT * FROM [维修登记] WHERE ([维修编号]=" + MyID + ")";
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.TextBox3.Text = MyTable.Rows[0]["维修类别"].ToString();
this.TextBox4.Text = MyTable.Rows[0]["维修项目"].ToString();
this.TextBox5.Text = MyTable.Rows[0]["产品品牌"].ToString();
this.TextBox6.Text = MyTable.Rows[0]["产品型号"].ToString();
this.TextBox7.Text = MyTable.Rows[0]["机身号码"].ToString();
this.DropDownList2.SelectedValue = MyTable.Rows[0]["客户名称"].ToString();
this.TextBox10.Text = MyTable.Rows[0]["客户电话"].ToString();
}
protected void GridView2_RowDeleted(object sender, GridViewDeletedEventArgs e)
{//重置数据
this.SqlDataSource2.DataBind();
this.GridView1.DataBind();
}
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{//在GridView控件单元格中设置短日期显示格式
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime MyDate = DateTime.Parse(e.Row.Cells[5].Text);
e.Row.Cells[5].Text = MyDate.ToShortDateString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -