private void bind() { Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product(); int index = int.Parse(Request.QueryString["ProID"].ToString()); Maticsoft.Model.Product promodel = probll.GetModel(index); Maticsoft.BLL.ProductType typebll = new Maticsoft.BLL.ProductType(); Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString())); Maticsoft.BLL.ProductXing xinbll = new Maticsoft.BLL.ProductXing(); Maticsoft.Model.ProductXing xinmodel = xinbll.GetModel(int.Parse(promodel.ProXingID.ToString())); lblchutime.Text = Convert.ToDateTime(promodel.Prochutime.ToString()).ToString("yyyy-MM-dd"); lblstarttime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lbltitle.Text = promodel.ProName; lbltype.Text = typemodel.ProTypeTitle; lblxinghao.Text = xinmodel.ProXingTitle; Image1.ImageUrl = promodel.ImageURL; txtcontent.Text = promodel.Procontent; if (promodel.Toujian == 1) { toujian.Visible = false; } else { toujian.Visible = true; } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtProTypeID.Text)) { strErr += "ProTypeID格式错误!\\n"; } if (this.txtProXingTitle.Text.Trim().Length == 0) { strErr += "ProXingTitle不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int ProXingID = int.Parse(this.lblProXingID.Text); int ProTypeID = int.Parse(this.txtProTypeID.Text); string ProXingTitle = this.txtProXingTitle.Text; Maticsoft.Model.ProductXing model = new Maticsoft.Model.ProductXing(); model.ProXingID = ProXingID; model.ProTypeID = ProTypeID; model.ProXingTitle = ProXingTitle; Maticsoft.BLL.ProductXing bll = new Maticsoft.BLL.ProductXing(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void ShowInfo(int ProXingID) { Maticsoft.BLL.ProductXing bll = new Maticsoft.BLL.ProductXing(); Maticsoft.Model.ProductXing model = bll.GetModel(ProXingID); this.lblProXingID.Text = model.ProXingID.ToString(); this.lblProTypeID.Text = model.ProTypeID.ToString(); this.lblProXingTitle.Text = model.ProXingTitle; }
protected void DrpProTypeTitle_SelectedIndexChanged(object sender, EventArgs e) { int drptypeid = int.Parse(DrpProTypeTitle.SelectedValue); Maticsoft.BLL.ProductXing xingbll = new Maticsoft.BLL.ProductXing(); DataSet ds = xingbll.GetList(" ProTypeID=" + drptypeid + ""); DrpProductXing.DataSource = ds; DrpProductXing.DataTextField = "ProXingTitle"; DrpProductXing.DataValueField = "ProXingID"; DrpProductXing.DataBind(); }
protected void btnxing_Click(object sender, EventArgs e) { Maticsoft.BLL.ProductXing xingbll = new Maticsoft.BLL.ProductXing(); Maticsoft.Model.ProductXing xingmodel = new Maticsoft.Model.ProductXing(); xingmodel.ProTypeID = int.Parse(drpaddtypehao.SelectedValue.ToString()); if (txtaddxinghao.Text.Trim() == "") { lblxinghao.Text = "请填写产品型号"; return; } xingmodel.ProXingTitle = txtaddxinghao.Text.Trim(); lblxinghao.Text = ""; xingbll.Add(xingmodel); txtaddxinghao.Text = string.Empty; lblxinghao.Text = "产品型号提交成功"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ProID"] != null) { if (Request.QueryString["ProID"].ToString() != "") { int proid = int.Parse(Request.QueryString["ProID"].ToString()); Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product(); Maticsoft.Model.Product promodel = probll.GetModel(proid); Maticsoft.BLL.ProductType typebll = new Maticsoft.BLL.ProductType(); Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString())); Maticsoft.BLL.ProductXing xingbll = new Maticsoft.BLL.ProductXing(); Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(int.Parse(promodel.ProXingID.ToString())); lblFatime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd"); int hitnum = 0; if (promodel.HitNum != null) { promodel.HitNum = promodel.HitNum + 1; probll.Update(promodel); lblHitNum.Text = promodel.HitNum.ToString(); } else { promodel.HitNum = 1; probll.Update(promodel); lblHitNum.Text = promodel.HitNum.ToString(); } lblProcontent.Text = promodel.Procontent; lblProName.Text = promodel.ProName; lblProName1.Text = promodel.ProName; lblProTypeTitle.Text = typemodel.ProTypeTitle; lblProXingTitle.Text = xingmodel.ProXingTitle; ImgImageURL.ImageUrl = promodel.ImageURL; } else { Response.Redirect("product.aspx"); } } else { Response.Redirect("product.aspx"); } } }
protected void datapro_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Maticsoft.BLL.Product pronll = new Maticsoft.BLL.Product(); int proid = int.Parse(datapro.DataKeys[e.Item.ItemIndex].ToString()); Maticsoft.Model.Product promodel = pronll.GetModel(proid); Maticsoft.BLL.ProductType typebll = new Maticsoft.BLL.ProductType(); Maticsoft.BLL.ProductXing xingbll = new Maticsoft.BLL.ProductXing(); int typeid = int.Parse(promodel.ProTypeID.ToString()); int xingid = int.Parse(promodel.ProXingID.ToString()); Maticsoft.Model.ProductType typemodel = typebll.GetModel(typeid); Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(xingid); ((Label)e.Item.FindControl("lnlProXingID")).Text = xingmodel.ProXingTitle; ((Label)e.Item.FindControl("lblProTypeID")).Text = typemodel.ProTypeTitle; } }