📄 editlimition.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;
public partial class EditLimition : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if ( !Page.IsPostBack )
{
string strVersion = Request.QueryString["version"];
string strModelCode = Request.QueryString["model"];
hidVersion.Value = strVersion; // 价格版本号
hidModelCode.Value = strModelCode; // 价格的车系编号
string strSQL_MakeCode = "SELECT MakeCode FROM Model WHERE ModelCode LIKE '" + strModelCode + "'";
DBConnector dbConn = new DBConnector();
string strMakeCode = dbConn.QueryString( strSQL_MakeCode );
string strSQL_PriceName = "SELECT 价格名称,波动上限,波动下限 FROM priceInfo WHERE 价格版本号 LIKE '" + strVersion + "'";
DataSet dsPriceInfo = dbConn.Query( strSQL_PriceName );
string strPriceName = dsPriceInfo.Tables[0].Rows[0]["价格名称"].ToString();
txtPriceName.Text = strPriceName;
string strSQL_ModelInfo = "SELECT * FROM Model INNER JOIN Make ON Model.MakeCode=Make.MakeCode WHERE Model.ModelCode LIKE '" + strModelCode + "'";
DataSet dsModelInfo = dbConn.Query( strSQL_ModelInfo );
txtPriceName.Text = strPriceName;
txtMakeName.Text = dsModelInfo.Tables[0].Rows[0]["MakeName"].ToString();
txtModelName.Text = dsModelInfo.Tables[0].Rows[0]["ModelName"].ToString();
string strSQL_Limit = "SELECT * FROM MatchStatus WHERE Version LIKE '" + strVersion + "' AND ModelCode LIKE '" + strModelCode + "'";
DataSet dsLimition = dbConn.Query( strSQL_Limit );
if (null != dsLimition && dsLimition.Tables[0].Rows.Count > 0 )
{
txtPrcUpper.Text = dsLimition.Tables[0].Rows[0]["UpperLimit"].ToString();
txtPrcLower.Text = dsLimition.Tables[0].Rows[0]["LowerLimit"].ToString();
hidMatchStatus.Value = "1";
}
else
{
txtPrcUpper.Text = dsPriceInfo.Tables[0].Rows[0]["波动上限"].ToString();
txtPrcLower.Text = dsPriceInfo.Tables[0].Rows[0]["波动下限"].ToString();
hidMatchStatus.Value = "0";
}
}
}
protected void btnModify_Click(object sender, EventArgs e)
{
string strSQL;
int iLimitStatus; // 1:已创建;0未创建
iLimitStatus = Convert.ToInt32( hidMatchStatus.Value );
if (0 == iLimitStatus)
{
strSQL = "INSERT INTO MatchStatus(Version,MakeCode,ModelCode,UpperLimit,LowerLimit,ValidDate) "
+"VALUES ('"+ hidVersion.Value +"','"+hidMakeCode.Value+"','"+hidModelCode.Value+"',"+txtPrcUpper.Text+","+txtPrcLower.Text+","+txtValDate.Text+")";
}
else
{
strSQL = "UPDATE MatchStatus SET LowerLimit = " + txtPrcLower.Text + ",UpperLimit=" + txtPrcUpper.Text + ",ValidDate='" + txtValDate.Text + "' WHERE Version LIKE '" + hidVersion.Value +"' AND ModelCode LIKE '" + hidModelCode.Value + "'";
}
DBConnector dbConn = new DBConnector();
int iRow = dbConn.Execute( strSQL );
if (iRow > 0)
MessageBox.Show( this, "更新成功" );
}
protected void btnShowCalendar_Click(object sender, EventArgs e)
{
calValidDate.Visible = !calValidDate.Visible;
if (calValidDate.Visible)
{
btnShowCalendar.Text = "选择";
}
else
{
btnShowCalendar.Text = "隐藏";
}
}
protected void calValidDate_SelectionChanged(object sender, EventArgs e)
{
txtValDate.Text = calValidDate.SelectedDate.ToShortDateString();
calValidDate.Visible = false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -