/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.System.Tb_System_Error GetModel(Guid ErrorCode) { SqlParameter[] parameters = { new SqlParameter("@ErrorCode", SqlDbType.UniqueIdentifier) }; parameters[0].Value = ErrorCode; MobileSoft.Model.System.Tb_System_Error model = new MobileSoft.Model.System.Tb_System_Error(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_System_Error_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ErrorCode"].ToString() != "") { model.ErrorCode = new Guid(ds.Tables[0].Rows[0]["ErrorCode"].ToString()); } if (ds.Tables[0].Rows[0]["ErrorTime"].ToString() != "") { model.ErrorTime = DateTime.Parse(ds.Tables[0].Rows[0]["ErrorTime"].ToString()); } model.ErrorURL = ds.Tables[0].Rows[0]["ErrorURL"].ToString(); model.ErrorSource = ds.Tables[0].Rows[0]["ErrorSource"].ToString(); model.ErrorMessage = ds.Tables[0].Rows[0]["ErrorMessage"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(MobileSoft.Model.System.Tb_System_Error model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@ErrorCode", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@ErrorTime", SqlDbType.DateTime), new SqlParameter("@ErrorURL", SqlDbType.NText), new SqlParameter("@ErrorSource", SqlDbType.NText), new SqlParameter("@ErrorMessage", SqlDbType.NText) }; parameters[0].Value = model.ErrorCode; parameters[1].Value = model.ErrorTime; parameters[2].Value = model.ErrorURL; parameters[3].Value = model.ErrorSource; parameters[4].Value = model.ErrorMessage; DbHelperSQL.RunProcedure("Proc_Tb_System_Error_Update", parameters, out rowsAffected); }