📄 lenspriceedit.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using NewGlassBook;
namespace NewGlassBook
{
/// <summary>
/// Summary description for lensPrice.
/// </summary>
public class LensPriceEdit : MyPage
{
protected Record r=new Record();
protected NewGlassBook.MyDropDownList aBrand;
protected NewGlassBook.MyTextBox bDegreeS;
protected NewGlassBook.MyTextBox bDegreeE;
protected NewGlassBook.MyTextBox bPrice;
protected NewGlassBook.MyButton dbtn_ok;
protected System.Web.UI.WebControls.TextBox did;
protected NewGlassBook.MyButton dbtn_cancel;
protected System.Web.UI.WebControls.Label lblWarning;
protected NewGlassBook.MyDropDownList aLevels;
protected string strID;
static string LastEndDegree,NextStartDegree;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
aBrandBind();
initData();
}
}
private void aBrandBind()
{
DataSet ds;
ds=r.GetData("brand","select * from brand where id like '0001%' and len(id)>4 order by id");
aBrand.DataSource=ds;
aBrand.DataTextField="BrandName";
aBrand.DataValueField="id";
aBrand.DataBind();
}
private void initData()
{
DataSet ds;
string strSql;
strID=Request.QueryString["id"].ToString();
strSql="select *,a.id as bid from EyeGlassPrice b,brand a where b.brandid=a.id and b.id="+strID;
ds=r.GetData("a_b",strSql);
//Response.Write(strSql);
ReSelect(ds.Tables["a_b"].Rows[0]["levels"].ToString(),aLevels);
bDegreeS.Text=ds.Tables["a_b"].Rows[0]["DegreeS"].ToString();
bDegreeE.Text=ds.Tables["a_b"].Rows[0]["DegreeE"].ToString();
bPrice.Text=ds.Tables["a_b"].Rows[0]["Price"].ToString();
did.Text=strID;
ReSelect(ds.Tables["a_b"].Rows[0]["bid"].ToString(),aBrand);
LastEndDegree=r.GetData("select top 1 degreee from EyeGlassPrice where brandid='"+ds.Tables["a_b"].Rows[0]["bid"].ToString()+"' and degreee<"+ds.Tables["a_b"].Rows[0]["DegreeS"].ToString()+" order by degreee desc",1);
NextStartDegree=r.GetData("select top 1 degrees from EyeGlassPrice where brandid='"+ds.Tables["a_b"].Rows[0]["bid"].ToString()+"' and degrees>"+ds.Tables["a_b"].Rows[0]["DegreeE"].ToString()+" order by degreee",1);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.dbtn_ok.Click += new System.EventHandler(this.dbtn_ok_Click);
this.dbtn_cancel.Click += new System.EventHandler(this.dbtn_cancel_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void dbtn_cancel_Click(object sender, System.EventArgs e)
{
Response.Write("<script lannguage='javascript'>window.close();</script>");
}
private void dbtn_ok_Click(object sender, System.EventArgs e)
{
did.Visible=true;
string StrDegreeS=bDegreeS.Text;
string StrDegreeE=bDegreeE.Text;
if(LastEndDegree!="")
{
if(float.Parse(StrDegreeS)<=float.Parse(LastEndDegree))
{
lblWarning.Text="开始度数输入错误";
return;
}
}
if(NextStartDegree!="")
{
if(float.Parse(StrDegreeE)>=float.Parse(NextStartDegree))
{
lblWarning.Text="末度数输入错误";
return;
}
}
if(r.RequestUpdate("EyeGlassPrice",Request)==1)
{
Response.Write("<script lannguage='javascript'>window.close();</script>");
Response.Write("<script lannguage='javascript'>window.opener.location.href='lensprice.aspx';</script>");
}
else
{
lblWarning.Text=r.ErrMsg;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -