protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtScenceName.Text == "") { strErr += "ScenceName²»ÄÜΪ¿Õ£¡\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int scenceId; if (!int.TryParse(lblScenceId.Text, out scenceId)) { scenceId = 0; } int SenceType = int.Parse(this.rblScenceType.SelectedValue); bool IsActive = this.chkIsActive.Checked; NoName.NetShop.Solution.Model.ScenceModel model = sbll.GetModel(scenceId); if (model == null) { model = new NoName.NetShop.Solution.Model.ScenceModel(); } model.ScenceName = txtScenceName.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.SenceType = SenceType; model.IsActive = IsActive; string fullurl, shorturl, message; if (CommonImageUpload.Upload(this.fulImage, out fullurl, out shorturl, out message)) { model.SenceImg = shorturl; } sbll.Save(model); Response.Redirect("ScenceList.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr=""; if(this.txtScenceName.Text =="") { strErr+="ScenceName����Ϊ�գ�\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int scenceId; if (!int.TryParse(lblScenceId.Text,out scenceId)) { scenceId =0; } int SenceType = int.Parse(this.rblScenceType.SelectedValue); bool IsActive=this.chkIsActive.Checked; NoName.NetShop.Solution.Model.ScenceModel model = sbll.GetModel(scenceId); if (model == null) { model = new NoName.NetShop.Solution.Model.ScenceModel(); } model.ScenceName=txtScenceName.Text.Trim(); model.Remark=txtRemark.Text.Trim(); model.SenceType=SenceType; model.IsActive=IsActive; string fullurl,shorturl,message; if (CommonImageUpload.Upload(this.fulImage,out fullurl,out shorturl,out message)) { model.SenceImg = shorturl; } sbll.Save(model); Response.Redirect("ScenceList.aspx"); }
private void ShowInfo(int scenceId) { if (scenceId != 0) { NoName.NetShop.Solution.Model.ScenceModel model = sbll.GetModel(scenceId); this.lblScenceId.Text = model.ScenceId.ToString(); this.txtRemark.Text = model.Remark; this.txtScenceName.Text = model.ScenceName; this.rblScenceType.SelectedIndex = model.SenceType; this.chkIsActive.Checked = model.IsActive; if (!String.IsNullOrEmpty(model.SenceImg)) { this.imgScence.Visible = true; this.imgScence.ImageUrl = Common.CommonImageUpload.GetCommonImageFullUrl(model.SenceImg); } else { this.imgScence.Visible = false; } } }