protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /*判断管理员是否已经登陆了系统*/ if (Session["adminFlag"] == null) { Response.Write("<script>top.location.href='../login.aspx';</script>"); return; } /*查询所有商品类别,初始化商品类别信息下拉框控件*/ DataSet goodClassDs = GoodClassLogic.QueryAllGoodClassInfo(); this.GoodClassId.Items.Add(new ListItem("请选择商品类别", "0")); for (int i = 0; i < goodClassDs.Tables[0].Rows.Count; i++) { DataRow dr = goodClassDs.Tables[0].Rows[i]; this.GoodClassId.Items.Add(new ListItem(dr["goodClassName"].ToString(), dr["goodClassId"].ToString())); } this.GridView1.DataSourceID = null; this.GridView1.DataSource = BuyInfoLogic.QueryBuyInfo("", "", 0, "", ""); this.GridView1.DataBind(); this.TotalPrice.Text = BuyInfoLogic.QueryBuyInfoTotalPrice("", "", 0, "", "").ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /*判断管理员是否已经登陆了系统*/ if (Session["adminFlag"] == null) { Response.Write("<script>top.location.href='../login.aspx';</script>"); return; } DataSet goodClassDs = GoodClassLogic.QueryAllGoodClassInfo(); for (int i = 0; i < goodClassDs.Tables[0].Rows.Count; i++) { DataRow dr = goodClassDs.Tables[0].Rows[i]; this.GoodClassId.Items.Add(new ListItem(dr["goodClassName"].ToString(), dr["goodClassId"].ToString())); } /*取得更新商品的商品编号*/ string goodNo = Request.QueryString["goodNo"]; /*调用业务层根据商品编号得到商品的信息并保存在模型中*/ GoodInfoModel goodInfoModel = GoodLogic.GetGoodInfoByNo(goodNo); /*显示该商品的各个信息*/ this.GoodNo.Text = goodInfoModel.GoodNo; this.GoodClassId.SelectedValue = goodInfoModel.GoodClassId.ToString(); this.GoodName.Text = goodInfoModel.GoodName; this.GoodUnit.Text = goodInfoModel.GoodUnit; this.GoodModel.Text = goodInfoModel.GoodModel; this.GoodSpecs.Text = goodInfoModel.GoodSpecs; this.GoodPrice.Text = goodInfoModel.GoodPrice.ToString(); this.GoodPlace.Text = goodInfoModel.GoodPlace; this.GoodMemo.Text = goodInfoModel.GoodMemo; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /*判断管理员或员工是否已经登陆了系统*/ if (Session["adminFlag"] == null && Session["employeeFlag"] == null) { Response.Write("<script>top.location.href='../login.aspx';</script>"); return; } this.GoodClassId.Items.Clear(); this.GoodClassId.Items.Add(new ListItem("请选择类别", "0")); DataSet goodClassDs = GoodClassLogic.QueryAllGoodClassInfo(); for (int i = 0; i < goodClassDs.Tables[0].Rows.Count; i++) { DataRow dr = goodClassDs.Tables[0].Rows[i]; this.GoodClassId.Items.Add(new ListItem(dr["goodClassName"].ToString(), dr["goodClassId"].ToString())); } } }