/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCode_CustomBookmarks model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TCode_CustomBookmarks set "); strSql.Append("s_Name=@s_Name,"); strSql.Append("s_BookMarkName=@s_BookMarkName,"); strSql.Append("s_ProcName=@s_ProcName,"); strSql.Append("s_CaseType=@s_CaseType,"); strSql.Append("s_XPObject=@s_XPObject,"); strSql.Append("s_FieldName=@s_FieldName"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_Name", SqlDbType.NVarChar, 50), new SqlParameter("@s_BookMarkName", SqlDbType.NVarChar, 50), new SqlParameter("@s_ProcName", SqlDbType.NVarChar, 50), new SqlParameter("@s_CaseType", SqlDbType.NVarChar, 2), new SqlParameter("@s_XPObject", SqlDbType.NVarChar, 50), new SqlParameter("@s_FieldName", SqlDbType.NVarChar, 50), new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_Name; parameters[1].Value = model.s_BookMarkName; parameters[2].Value = model.s_ProcName; parameters[3].Value = model.s_CaseType; parameters[4].Value = model.s_XPObject; parameters[5].Value = model.s_FieldName; parameters[6].Value = model.n_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_CustomBookmarks model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TCode_CustomBookmarks("); strSql.Append("s_Name,s_BookMarkName,s_ProcName,s_CaseType,s_XPObject,s_FieldName)"); strSql.Append(" values ("); strSql.Append("@s_Name,@s_BookMarkName,@s_ProcName,@s_CaseType,@s_XPObject,@s_FieldName)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_Name", SqlDbType.NVarChar, 50), new SqlParameter("@s_BookMarkName", SqlDbType.NVarChar, 50), new SqlParameter("@s_ProcName", SqlDbType.NVarChar, 50), new SqlParameter("@s_CaseType", SqlDbType.NVarChar, 2), new SqlParameter("@s_XPObject", SqlDbType.NVarChar, 50), new SqlParameter("@s_FieldName", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.s_Name; parameters[1].Value = model.s_BookMarkName; parameters[2].Value = model.s_ProcName; parameters[3].Value = model.s_CaseType; parameters[4].Value = model.s_XPObject; parameters[5].Value = model.s_FieldName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_CustomBookmarks DataRowToModel(DataRow row) { IPSP.Model.TCode_CustomBookmarks model = new IPSP.Model.TCode_CustomBookmarks(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["s_Name"] != null) { model.s_Name = row["s_Name"].ToString(); } if (row["s_BookMarkName"] != null) { model.s_BookMarkName = row["s_BookMarkName"].ToString(); } if (row["s_ProcName"] != null) { model.s_ProcName = row["s_ProcName"].ToString(); } if (row["s_CaseType"] != null) { model.s_CaseType = row["s_CaseType"].ToString(); } if (row["s_XPObject"] != null) { model.s_XPObject = row["s_XPObject"].ToString(); } if (row["s_FieldName"] != null) { model.s_FieldName = row["s_FieldName"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TCode_CustomBookmarks GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,s_Name,s_BookMarkName,s_ProcName,s_CaseType,s_XPObject,s_FieldName from TCode_CustomBookmarks "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.TCode_CustomBookmarks model = new IPSP.Model.TCode_CustomBookmarks(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TCode_CustomBookmarks model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.TCode_CustomBookmarks model) { return(dal.Add(model)); }