/// <summary> /// 更新一条数据 /// </summary> public bool Update(WalleProject.Model.t_orderevaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_orderevaluate set "); strSql.Append("oe_sort=@oe_sort,"); strSql.Append("oe_vaild=@oe_vaild,"); strSql.Append("oe_grade=@oe_grade,"); strSql.Append("oe_isread=@oe_isread,"); strSql.Append("oe_per_type=@oe_per_type,"); strSql.Append("oe_content=@oe_content,"); strSql.Append("oe_tra_id=@oe_tra_id,"); strSql.Append("oe_per_id=@oe_per_id,"); strSql.Append("oe_pic_id=@oe_pic_id,"); strSql.Append("oe_date=@oe_date"); strSql.Append(" where oe_id=@oe_id"); MySqlParameter[] parameters = { new MySqlParameter("@oe_sort", MySqlDbType.Int32, 10), new MySqlParameter("@oe_vaild", MySqlDbType.VarChar, 20), new MySqlParameter("@oe_grade", MySqlDbType.Int32, 10), new MySqlParameter("@oe_isread", MySqlDbType.VarChar, 10), new MySqlParameter("@oe_per_type", MySqlDbType.VarChar, 20), new MySqlParameter("@oe_content", MySqlDbType.Text), new MySqlParameter("@oe_tra_id", MySqlDbType.Int32, 10), new MySqlParameter("@oe_per_id", MySqlDbType.Int32, 10), new MySqlParameter("@oe_pic_id", MySqlDbType.Int32, 10), new MySqlParameter("@oe_date", MySqlDbType.DateTime), new MySqlParameter("@oe_id", MySqlDbType.Int32, 10) }; parameters[0].Value = model.oe_sort; parameters[1].Value = model.oe_vaild; parameters[2].Value = model.oe_grade; parameters[3].Value = model.oe_isread; parameters[4].Value = model.oe_per_type; parameters[5].Value = model.oe_content; parameters[6].Value = model.oe_tra_id; parameters[7].Value = model.oe_per_id; parameters[8].Value = model.oe_pic_id; parameters[9].Value = model.oe_date; parameters[10].Value = model.oe_id; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public WalleProject.Model.t_orderevaluate DataRowToModel(DataRow row) { WalleProject.Model.t_orderevaluate model = new WalleProject.Model.t_orderevaluate(); if (row != null) { if (row["oe_sort"] != null && row["oe_sort"].ToString() != "") { model.oe_sort = int.Parse(row["oe_sort"].ToString()); } if (row["oe_vaild"] != null) { model.oe_vaild = row["oe_vaild"].ToString(); } if (row["oe_grade"] != null && row["oe_grade"].ToString() != "") { model.oe_grade = int.Parse(row["oe_grade"].ToString()); } if (row["oe_isread"] != null) { model.oe_isread = row["oe_isread"].ToString(); } if (row["oe_per_type"] != null) { model.oe_per_type = row["oe_per_type"].ToString(); } if (row["oe_content"] != null) { model.oe_content = row["oe_content"].ToString(); } if (row["oe_tra_id"] != null && row["oe_tra_id"].ToString() != "") { model.oe_tra_id = int.Parse(row["oe_tra_id"].ToString()); } if (row["oe_per_id"] != null && row["oe_per_id"].ToString() != "") { model.oe_per_id = int.Parse(row["oe_per_id"].ToString()); } if (row["oe_pic_id"] != null && row["oe_pic_id"].ToString() != "") { model.oe_pic_id = int.Parse(row["oe_pic_id"].ToString()); } if (row["oe_id"] != null && row["oe_id"].ToString() != "") { model.oe_id = int.Parse(row["oe_id"].ToString()); } if (row["oe_date"] != null && row["oe_date"].ToString() != "") { model.oe_date = DateTime.Parse(row["oe_date"].ToString()); } } return(model); }
private void ShowInfo(int oe_id) { WalleProject.BLL.t_orderevaluate bll = new WalleProject.BLL.t_orderevaluate(); WalleProject.Model.t_orderevaluate model = bll.GetModel(oe_id); this.txtoe_sort.Text = model.oe_sort.ToString(); this.txtoe_vaild.Text = model.oe_vaild; this.txtoe_grade.Text = model.oe_grade.ToString(); this.txtoe_isread.Text = model.oe_isread; this.txtoe_per_type.Text = model.oe_per_type; this.txtoe_content.Text = model.oe_content; this.txtoe_tra_id.Text = model.oe_tra_id.ToString(); this.txtoe_per_id.Text = model.oe_per_id.ToString(); this.txtoe_pic_id.Text = model.oe_pic_id.ToString(); this.lbloe_id.Text = model.oe_id.ToString(); this.txtoe_date.Text = model.oe_date.ToString(); }
/// <summary> /// 得到一个对象实体 /// </summary> public WalleProject.Model.t_orderevaluate GetModel(int oe_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select oe_sort,oe_vaild,oe_grade,oe_isread,oe_per_type,oe_content,oe_tra_id,oe_per_id,oe_pic_id,oe_id,oe_date from t_orderevaluate "); strSql.Append(" where oe_id=@oe_id"); MySqlParameter[] parameters = { new MySqlParameter("@oe_id", MySqlDbType.Int32) }; parameters[0].Value = oe_id; WalleProject.Model.t_orderevaluate model = new WalleProject.Model.t_orderevaluate(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtoe_sort.Text)) { strErr += "oe_sort格式错误!\\n"; } if (this.txtoe_vaild.Text.Trim().Length == 0) { strErr += "oe_vaild不能为空!\\n"; } if (!PageValidate.IsNumber(txtoe_grade.Text)) { strErr += "oe_grade格式错误!\\n"; } if (this.txtoe_isread.Text.Trim().Length == 0) { strErr += "oe_isread不能为空!\\n"; } if (this.txtoe_per_type.Text.Trim().Length == 0) { strErr += "oe_per_type不能为空!\\n"; } if (this.txtoe_content.Text.Trim().Length == 0) { strErr += "oe_content不能为空!\\n"; } if (!PageValidate.IsNumber(txtoe_tra_id.Text)) { strErr += "oe_tra_id格式错误!\\n"; } if (!PageValidate.IsNumber(txtoe_per_id.Text)) { strErr += "oe_per_id格式错误!\\n"; } if (!PageValidate.IsNumber(txtoe_pic_id.Text)) { strErr += "oe_pic_id格式错误!\\n"; } if (!PageValidate.IsDateTime(txtoe_date.Text)) { strErr += "oe_date格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int oe_sort = int.Parse(this.txtoe_sort.Text); string oe_vaild = this.txtoe_vaild.Text; int oe_grade = int.Parse(this.txtoe_grade.Text); string oe_isread = this.txtoe_isread.Text; string oe_per_type = this.txtoe_per_type.Text; string oe_content = this.txtoe_content.Text; int oe_tra_id = int.Parse(this.txtoe_tra_id.Text); int oe_per_id = int.Parse(this.txtoe_per_id.Text); int oe_pic_id = int.Parse(this.txtoe_pic_id.Text); int oe_id = int.Parse(this.lbloe_id.Text); DateTime oe_date = DateTime.Parse(this.txtoe_date.Text); WalleProject.Model.t_orderevaluate model = new WalleProject.Model.t_orderevaluate(); model.oe_sort = oe_sort; model.oe_vaild = oe_vaild; model.oe_grade = oe_grade; model.oe_isread = oe_isread; model.oe_per_type = oe_per_type; model.oe_content = oe_content; model.oe_tra_id = oe_tra_id; model.oe_per_id = oe_per_id; model.oe_pic_id = oe_pic_id; model.oe_id = oe_id; model.oe_date = oe_date; WalleProject.BLL.t_orderevaluate bll = new WalleProject.BLL.t_orderevaluate(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }