📄 priceform.aspx.cs
字号:
//文件名:PriceForm.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 BaseManage_PriceForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("A5") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//新增报价信息
this.SqlDataSource1.Insert();
}
protected void Button2_Click(object sender, EventArgs e)
{//修改报价信息
this.SqlDataSource1.Update();
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{//弹出删除操作确认对话框
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button MyButton = (Button)e.Row.FindControl("Button1");
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')";
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//在控件中显示选择的记录
this.TextBox1.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
this.TextBox2.Text = this.GridView1.SelectedRow.Cells[3].Text.ToString();
this.TextBox3.Text = this.GridView1.SelectedRow.Cells[4].Text.ToString();
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString();
this.TextBox5.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{//打印维修报价信息
Server.Transfer("~/BaseManage/PricePrint.aspx");
}
public DataTable MyQueryTable
{//设置要传递到打印页的数据
get
{
DataTable MyTable = new DataTable();
string MySQL = "SELECT * FROM [维修报价] WHERE ([报价编号] LIKE '%" + this.TextBox6.Text + "%') ";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyServiceDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
if (MyConnection.State == ConnectionState.Open)
MyConnection.Close();
return MyTable;
}
}
public String MyPrintDate
{//设置要传递到打印页的数据
get
{
string MyDate = "打印日期:" + DateTime.Now.ToShortDateString();
return MyDate;
}
}
public String MyPrintTitle
{//设置要传递到打印页的数据
get
{
return Session["MyServiceName"].ToString() + "维修项目报价表";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -