public static NumberInfo GetNumberInfo(string name) { string sql = String.Format("SELECT * FROM 编号信息 WHERE 编号名称 = '{0}'", name); using (SqlConnection connection = new SqlConnection(MyHelper.GetConnectionString())) { SqlDataReader reader = null; try { reader = YiKang.Data.SqlHelper.ExecuteReader(connection, System.Data.CommandType.Text, sql); if (reader.Read()) { NumberInfo ni = new NumberInfo(); ni.标识 = (int)reader["标识"]; ni.编号名称 = (string)reader["编号名称"];; ni.编号规则 = (string)reader["编号规则"]; ni.当前序号 = (int)reader["当前序号"]; ni.序号长度 = (int)reader["序号长度"]; return(ni); } } finally { if (reader != null) { reader.Close(); } } } return(null); }
/// <summary> /// 通过 Id 获取线路 /// </summary> /// <param name="id"></param> /// <returns></returns> public static NumberInfo GetNumberInfo(int id) { NumberInfo obj = (NumberInfo)MyHelper.XpoSession.GetObjectByKey(typeof(NumberInfo), id); return(obj); }