/// <summary> /// 得到一个对象实体 /// </summary> public HM.Model.Qm.Tb_Qm_Object GetModel(string Id) { SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.VarChar, 50) }; parameters[0].Value = Id; HM.Model.Qm.Tb_Qm_Object model = new HM.Model.Qm.Tb_Qm_Object(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Qm_Object_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { model.Id = ds.Tables[0].Rows[0]["Id"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.ObjName = ds.Tables[0].Rows[0]["ObjName"].ToString(); model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "") { model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(HM.Model.Qm.Tb_Qm_Object model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.VarChar, 36), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@ObjName", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 400), new SqlParameter("@IsDelete", SqlDbType.Int, 4) }; parameters[0].Value = model.Id; parameters[1].Value = model.Sort; parameters[2].Value = model.ObjName; parameters[3].Value = model.Remark; parameters[4].Value = model.IsDelete; DbHelperSQL.RunProcedure("Proc_Tb_Qm_Object_Update", parameters, out rowsAffected); }