protected void btnSubmit_Click(object sender, EventArgs e) { string strErr = ""; if (this.bTitle.Text.Trim().Length == 0) { strErr += "标题不能为空!\\n"; } if (this.bContent.Text.Trim().Length == 0) { strErr += "内容不能为空!\\n"; } if (this.bClick.Text.Trim().Length == 0) { strErr += "点击量不能为空!\\n"; } if (!PageValidate.IsNumber(this.bClick.Text)) { strErr += "点击量格式错误!\\n"; } if (strErr != "") { MessageBox.Alert(this, strErr); return; } PaducnSoft.Model.ay_products model = new PaducnSoft.Model.ay_products(); model.bId = (int)StringPlus.ConvertNullToZero(this.bId.Value); model.bTitle = this.bTitle.Text; model.bClassID = (int)StringPlus.ConvertNullToZero(this.bClassID.SelectedValue); model.bKeywords = this.bKeywords.Text; model.bPic = this.bPic.Text; model.bIsNew = (this.bIsNew.Checked ? 1 : 0); model.bIsTop = (this.bIsTop.Checked ? 1 : 0); model.bIsBest = (this.bIsBest.Checked ? 1 : 0); model.bIsPass = (this.bIsPass.Checked ? 1 : 0); model.bClick = (int)StringPlus.ConvertNullToZero(this.bClick.Text); model.bContent = StringPlus.SafeSQL(Server.HtmlEncode(this.bContent.Text)); model.bAddTime = DateTime.Now; model.bAddUser = paducncms.Module.UserRights.AdminUserID; bool result = dal.Update(model); if (result) { MessageBox.Alert(this, "更新成功!", "default.aspx"); } else { MessageBox.Alert(this, "更新失败!"); } }
private void ShowInfo(int bId) { PaducnSoft.DAL.ay_prodclass dal_class = new PaducnSoft.DAL.ay_prodclass(); DataSet ds = dal_class.GetList(""); DropDownListHelp ddlHelper = new DropDownListHelp(); this.bClassID.Items.Clear(); ddlHelper.createDropDownTree(ds.Tables[0], "bParent", "0", "bId", "bName", "bId", this.bClassID); this.bClassID.Items.Insert(0, new ListItem("----选择分类----", "0")); PaducnSoft.Model.ay_products model = dal.GetModel(bId); this.bId.Value = model.bId.ToString(); this.bTitle.Text = model.bTitle; this.bClassID.SelectedValue = model.bClassID.ToString(); this.bKeywords.Text = model.bKeywords; this.bPic.Text = model.bPic; this.bClick.Text = model.bClick.ToString(); this.bContent.Text = Server.HtmlDecode(model.bContent); this.bIsNew.Checked = model.bIsNew.ToString() == "1" ? true : false; this.bIsTop.Checked = model.bIsTop.ToString() == "1" ? true : false; this.bIsBest.Checked = model.bIsBest.ToString() == "1" ? true : false; this.bIsPass.Checked = model.bIsPass.ToString() == "1" ? true : false; }