📄 repairregisterform.aspx.cs
字号:
//文件名:RepairRegisterForm.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_RepairRegisterForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("C1") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
this.TextBox20.Text = Session["MyUserName"].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{//新增维修登记信息
if (this.TextBox20.Text.Length < 2)
return;
this.SqlDataSource4.Insert();
}
protected void Button2_Click(object sender, EventArgs e)
{//修改维修登记信息
if (this.TextBox20.Text.Length < 2)
return;
this.SqlDataSource4.Update();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//显示选择维修项目数据
this.TextBox2.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
this.TextBox3.Text = this.GridView1.SelectedRow.Cells[3].Text.ToString();
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[4].Text.ToString();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{//显示商家电话
int MyID = Convert.ToInt16(this.DropDownList1.SelectedValue);
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.TextBox10.Text = MyTable.Rows[0][3].ToString();
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{//显示客户电话
int MyID = Convert.ToInt16(this.DropDownList2.SelectedValue);
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.TextBox12.Text = MyTable.Rows[0][2].ToString();
}
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.TextBox3.Text = this.GridView2.SelectedRow.Cells[4].Text.ToString();
this.TextBox4.Text = this.GridView2.SelectedRow.Cells[5].Text.ToString();
this.TextBox5.Text = this.GridView2.SelectedRow.Cells[6].Text.ToString();
this.TextBox6.Text = this.GridView2.SelectedRow.Cells[7].Text.ToString();
this.TextBox7.Text = this.GridView2.SelectedRow.Cells[8].Text.ToString();
this.TextBox8.Text = this.GridView2.SelectedRow.Cells[9].Text.ToString();
this.DropDownList1.SelectedValue = this.GridView2.SelectedRow.Cells[10].Text.ToString();
this.TextBox10.Text = this.GridView2.SelectedRow.Cells[11].Text.ToString();
this.DropDownList2.SelectedValue = this.GridView2.SelectedRow.Cells[12].Text.ToString();
this.TextBox12.Text = this.GridView2.SelectedRow.Cells[13].Text.ToString();
this.DropDownList3.SelectedValue = this.GridView2.SelectedRow.Cells[14].Text.ToString();
this.TextBox14.Text = this.GridView2.SelectedRow.Cells[15].Text.ToString();
this.TextBox15.Text = this.GridView2.SelectedRow.Cells[16].Text.ToString();
this.TextBox16.Text = this.GridView2.SelectedRow.Cells[17].Text.ToString();
this.DropDownList4.SelectedValue = this.GridView2.SelectedRow.Cells[18].Text.ToString();
this.TextBox18.Text = this.GridView2.SelectedRow.Cells[19].Text.ToString();
this.TextBox19.Text = this.GridView2.SelectedRow.Cells[20].Text.ToString();
this.TextBox20.Text = this.GridView2.SelectedRow.Cells[21].Text.ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{//打印维修登记信息
Server.Transfer("~/RepairManage/RepairRegisterPrint.aspx");
}
public String MyPrintID
{//设置要传递到打印页的数据
get
{
return this.TextBox1.Text;
}
}
public String MyPrintClient
{//设置要传递到打印页的数据
get
{
return this.DropDownList2.SelectedItem.Text.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -