Ejemplo n.º 1
0
 // 得到一个用户自己登记过的用户账目信息
 public List<Entity.AccountType> getInAccTypeList(string name)
 {
     List<Entity.AccountType> types = new List<Entity.AccountType>();
     string cmdText = "select type_id,type_name from AccountType where type_id in (select type_id from Account where user_id = (select user_id from Users where user_name = '" + name + "'))";
     SqlCommand cmd = new SqlCommand(cmdText, conn);
     conn.Open();
     SqlDataReader reader = cmd.ExecuteReader() ;
     while (reader.Read())
     {
         Entity.AccountType type = new Entity.AccountType(Convert.ToInt32(reader["type_id"]),
             Convert.ToString(reader["type_name"]));
         types.Add(type);
     }
     conn.Close();
     return types;
 }
Ejemplo n.º 2
0
        // 得到所有的和账目类型名有关的信息
        public List<Entity.AccountType> getAllAccountypes()
        {
            List<Entity.AccountType> types = new List<Entity.AccountType>();

            string cmdText = "select * from AccountType";
            SqlCommand cmd = new SqlCommand(cmdText, conn);
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Entity.AccountType type = new Entity.AccountType(Convert.ToInt32(reader["type_id"]),
                    Convert.ToString(reader["type_name"]));
                types.Add(type);
            }
            conn.Close();
            return types;
        }