Пример #1
0
        //------------------------------------------------------------------------------------------------------------------------------------------
        public List <DTO.InventoryDTO> SelectAllInventoryByDataReader()
        {
            List <DTO.InventoryDTO> list = new List <DTO.InventoryDTO>();
            string        strCmd         = "select_all_inventory";
            SqlDataReader rd             = _DataProvicer.ExecuteQueryWithDataReader(strCmd, CommandType.StoredProcedure);

            if (rd.HasRows)
            {
                while (rd.Read())
                {
                    DTO.InventoryDTO dto = new DTO.InventoryDTO
                    {
                        InventoryID = rd.GetString(0),
                        BookID      = rd.GetString(1),
                        Index       = rd.GetString(2),
                        Status      = rd.GetInt32(3),
                    };
                    list.Add(dto);
                }
            }
            return(list);
        }
Пример #2
0
        //------------------------------------------------------------------------------------------------------------------------------------------
        public DTO.InventoryDTO SearchInventoryByInventoryID(string id)
        {
            string        strCmd = "e_select_inventory_by_inventory_id";
            SqlParameter  ID     = new SqlParameter("@InventoryID", id);
            SqlDataReader rd     = _DataProvicer.ExecuteQueryWithDataReader(strCmd, CommandType.StoredProcedure, ID);

            if (rd.HasRows)
            {
                if (rd.Read())
                {
                    DTO.InventoryDTO dto = new DTO.InventoryDTO
                    {
                        InventoryID = rd.GetString(0),
                        BookID      = rd.GetString(1),
                        Index       = rd.GetString(2),
                        Status      = rd.GetInt32(3)
                    };
                    return(dto);
                }
            }
            return(null);
        }
Пример #3
0
 public bool UpdateInventory(string id, int status)
 {
     DTO.InventoryDTO dto = this.SearchInventoryByInventoryID(id);
     return(dao.UpdateInventory(dto, status));
 }