protected void InitForm() { if (this.id != "") { //DataSet ds = adoHelper.ExecuteSqlDataset("select * from T_Goods_MorePropertySet where id='"+KillSqlIn.Form_ReplaceByString(id,20)+"';"); //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) //{ // this.txtName.Value = ds.Tables[0].Rows[0]["propertyName"].ToString(); // this.txtValues.Text = ds.Tables[0].Rows[0]["propertyOptions"].ToString(); // this.txtOrder.Value = ds.Tables[0].Rows[0]["orderBy"].ToString(); // this.rdFlag.SelectedValue = ds.Tables[0].Rows[0]["porpertyFlag"].ToString(); // this.txtRemarks.Text = ds.Tables[0].Rows[0]["remarks"].ToString(); //} MorePropertyConfigSetModel mod = bll.GetModel(this.id); if (mod != null) { this.txtName.Value = mod.propertyName; this.txtValues.Text = mod.propertyOptions; this.txtOrder.Value = mod.orderBy.ToString(); this.rdFlag.SelectedValue = mod.porpertyFlag; this.txtRemarks.Text = mod.remarks; } } else { } }
protected void GetFormInfo(ref MorePropertyConfigSetModel mod) { mod.propertyName = this.txtName.Value.Trim(); mod.propertyOptions = this.txtValues.Text.Trim(); int orderby = 0; int.TryParse(this.txtOrder.Value.Trim(), out orderby); mod.orderBy = orderby; mod.porpertyFlag = this.rdFlag.SelectedValue; mod.remarks = this.txtRemarks.Text; }
protected void btnSave_Click(object sender, EventArgs e) { if (this.id == "") { MorePropertyConfigSetModel mod = new MorePropertyConfigSetModel(); mod.propertyId = IdCreator.CreateId("T_Goods_MorePropertySet", "propertyId"); GetFormInfo(ref mod); if (bll.Add(mod) > 0) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href('MorePropertySetList.aspx');</script>"); } } else { MorePropertyConfigSetModel mod = bll.GetModel(this.id); GetFormInfo(ref mod); if (bll.Update(mod) > 0) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href('MorePropertySetList.aspx');</script>"); } } }