/// <summary> /// 更新一条数据 /// </summary> public bool Update(XHD.Model.crm_order_feat model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update crm_order_feat set "); strSql.Append("factory_Id=@factory_Id,"); strSql.Append("emp_code=@emp_code,"); strSql.Append("order_feat=@order_feat,"); strSql.Append("customer_Id=@customer_Id,"); strSql.Append("customer_name=@customer_name,"); strSql.Append("customer_Id_shop=@customer_Id_shop,"); strSql.Append("customer_name_shop=@customer_name_shop,"); strSql.Append("create_date=@create_date,"); strSql.Append("create_id=@create_id"); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@factory_Id", MySqlDbType.VarChar, 60), new MySqlParameter("@emp_code", MySqlDbType.VarChar, 50), new MySqlParameter("@order_feat", MySqlDbType.Float, 20), new MySqlParameter("@customer_Id", MySqlDbType.Int32, 11), new MySqlParameter("@customer_name", MySqlDbType.VarChar, 100), new MySqlParameter("@customer_Id_shop", MySqlDbType.Int32, 11), new MySqlParameter("@customer_name_shop", MySqlDbType.VarChar, 100), new MySqlParameter("@create_date", MySqlDbType.DateTime), new MySqlParameter("@create_id", MySqlDbType.Int32, 11), new MySqlParameter("@Id", MySqlDbType.Int32, 11) }; parameters[0].Value = model.factory_Id; parameters[1].Value = model.emp_code; parameters[2].Value = model.order_feat; parameters[3].Value = model.customer_Id; parameters[4].Value = model.customer_name; parameters[5].Value = model.customer_Id_shop; parameters[6].Value = model.customer_name_shop; parameters[7].Value = model.create_date; parameters[8].Value = model.create_id; parameters[9].Value = model.Id; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.crm_order_feat DataRowToModel(DataRow row) { XHD.Model.crm_order_feat model = new XHD.Model.crm_order_feat(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["factory_Id"] != null) { model.factory_Id = row["factory_Id"].ToString(); } if (row["emp_code"] != null) { model.emp_code = row["emp_code"].ToString(); } if (row["order_feat"] != null && row["order_feat"].ToString() != "") { model.order_feat = decimal.Parse(row["order_feat"].ToString()); } if (row["customer_Id"] != null && row["customer_Id"].ToString() != "") { model.customer_Id = int.Parse(row["customer_Id"].ToString()); } if (row["customer_name"] != null) { model.customer_name = row["customer_name"].ToString(); } if (row["customer_Id_shop"] != null && row["customer_Id_shop"].ToString() != "") { model.customer_Id_shop = int.Parse(row["customer_Id_shop"].ToString()); } if (row["customer_name_shop"] != null) { model.customer_name_shop = row["customer_name_shop"].ToString(); } if (row["create_date"] != null && row["create_date"].ToString() != "") { model.create_date = DateTime.Parse(row["create_date"].ToString()); } if (row["create_id"] != null && row["create_id"].ToString() != "") { model.create_id = int.Parse(row["create_id"].ToString()); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(XHD.Model.crm_order_feat model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into crm_order_feat("); strSql.Append("factory_Id,emp_code,order_feat,customer_Id,customer_name,customer_Id_shop,customer_name_shop,create_date,create_id)"); strSql.Append(" values ("); strSql.Append("@factory_Id,@emp_code,@order_feat,@customer_Id,@customer_name,@customer_Id_shop,@customer_name_shop,@create_date,@create_id)"); MySqlParameter[] parameters = { new MySqlParameter("@factory_Id", MySqlDbType.VarChar, 60), new MySqlParameter("@emp_code", MySqlDbType.VarChar, 50), new MySqlParameter("@order_feat", MySqlDbType.Float, 20), new MySqlParameter("@customer_Id", MySqlDbType.Int32, 11), new MySqlParameter("@customer_name", MySqlDbType.VarChar, 100), new MySqlParameter("@customer_Id_shop", MySqlDbType.Int32, 11), new MySqlParameter("@customer_name_shop", MySqlDbType.VarChar, 100), new MySqlParameter("@create_date", MySqlDbType.DateTime), new MySqlParameter("@create_id", MySqlDbType.Int32, 11) }; parameters[0].Value = model.factory_Id; parameters[1].Value = model.emp_code; parameters[2].Value = model.order_feat; parameters[3].Value = model.customer_Id; parameters[4].Value = model.customer_name; parameters[5].Value = model.customer_Id_shop; parameters[6].Value = model.customer_name_shop; parameters[7].Value = model.create_date; parameters[8].Value = model.create_id; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.crm_order_feat GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,factory_Id,emp_code,order_feat,customer_Id,customer_name,customer_Id_shop,customer_name_shop,create_date,create_id from crm_order_feat "); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = Id; XHD.Model.crm_order_feat model = new XHD.Model.crm_order_feat(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }