您目前尚未登陆,请选择【登陆】或【注册
首页->电子商务->明日网上商城购物系统源码>>Manger/EditProduct.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明日网上商城购物系统源码
当前文件:文件类型 MingriNetShop/Manger/EditProduct.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12using System.Text.RegularExpressions; 13 14public partial class Manger_EditProduct : System.Web.UI.Page 15{ 16 MangerClass mcObj = new MangerClass(); 17 protected void Page_Load(object sender, EventArgs e) 18 { 19 if (!IsPostBack) 20 { 21 mcObj.ddlClassBind(ddlCategory); 22 mcObj.ddlUrl(ddlUrl); 23 GetGoodsInfo(); 24 } 25 } 26 /// <summary> 27 /// 获取指定商品的信息,并将其显示在界面上 28 /// </summary> 29 public void GetGoodsInfo() 30 { 31 DataSet ds = mcObj.GetGoodsInfoByIDDs(Convert.ToInt32(Request["GoodsID"].Trim()),"GoodsInfo"); 32 txtName.Text=ds.Tables["GoodsInfo"].Rows[0][2].ToString(); 33 ddlCategory.SelectedValue = ds.Tables["GoodsInfo"].Rows[0][1].ToString(); 34 txtBrand.Text = ds.Tables["GoodsInfo"].Rows[0][4].ToString(); 35 txtUnit.Text = ds.Tables["GoodsInfo"].Rows[0][5].ToString(); 36 txtWeight.Text =mcObj.VarStr( ds.Tables["GoodsInfo"].Rows[0][6].ToString(),2); 37 txtMarketPrice.Text = mcObj.VarStr(ds.Tables["GoodsInfo"].Rows[0][8].ToString(),2); 38 txtMemberPrice.Text = mcObj.VarStr(ds.Tables["GoodsInfo"].Rows[0][9].ToString(),2); 39 ddlUrl.SelectedValue = ds.Tables["GoodsInfo"].Rows[0][7].ToString(); 40 ImageMapPhoto.ImageUrl = ddlUrl.SelectedItem.Value; 41 cbxCommend.Checked = Convert.ToBoolean(ds.Tables["GoodsInfo"].Rows[0][10].ToString()); 42 cbxHot.Checked = Convert.ToBoolean(ds.Tables["GoodsInfo"].Rows[0][11].ToString()); 43 cbxDiscount.Checked = Convert.ToBoolean(ds.Tables["GoodsInfo"].Rows[0][13].ToString()); 44 txtShortDesc.Text = ds.Tables["GoodsInfo"].Rows[0][3].ToString(); 45 } 46 protected void btnUpdate_Click(object sender, EventArgs e) 47 { 48 if (txtName.Text == "" || txtBrand.Text == "" || txtUnit.Text == "" || txtWeight.Text == "" || txtMemberPrice.Text == "" || txtMarketPrice.Text == "") 49 { 50 Response.Write("<script>alert('请输入必要的信息!')</script>"); 51 52 } 53 else if (IsValidInt(txtWeight.Text.Trim()) == false || IsValidInt(txtMarketPrice.Text.Trim()) == false || IsValidInt(txtMemberPrice.Text.Trim()) == false) 54 { 55 Response.Write("<script>alert('请正确输入(格式:1.00)!')</script>"); 56 } 57 else 58 { 59 bool Isrefinement; 60 bool IsHot; 61 bool IsDisCount; 62 if (cbxCommend.Checked == true) 63 { 64 Isrefinement = true; 65 } 66 else 67 { 68 Isrefinement = false; 69 } 70 if (cbxHot.Checked == true) 71 { 72 IsHot = true; 73 } 74 else 75 { 76 IsHot = false; 77 } 78 if (cbxDiscount.Checked == true) 79 { 80 IsDisCount = true; 81 } 82 else 83 { 84 IsDisCount = false; 85 } 86 mcObj.UpdateGInfo(Convert.ToInt32(ddlCategory.SelectedItem.Value.ToString()), txtName.Text.Trim(), txtShortDesc.Text.Trim(), txtBrand.Text.Trim(), txtUnit.Text.Trim(), float.Parse(txtWeight.Text.Trim()), ddlUrl.SelectedItem.Value.Trim(), float.Parse(txtMarketPrice.Text.Trim()), float.Parse(txtMemberPrice.Text.Trim()), Isrefinement, IsHot, IsDisCount, Convert.ToInt32(Request["GoodsID"].Trim())); 87 Response.Write("<script>alert('该商品修改成功!');</script>"); 88 89 } 90 } 91 public bool IsValidInt(string num) 92 { 93 94 return Regex.IsMatch(num, @"^[0-9]+(.[0-9]{2})?$"); 95 96 } 97 protected void ddlUrl_SelectedIndexChanged(object sender, EventArgs e) 98 { 99 ImageMapPhoto.ImageUrl = ddlUrl.SelectedItem.Value; 100 } 101} 102
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:明日网上商城购物系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号